///////////////////////////////////////////////////////////////////////////////////////////////////
// Company: <Name>
//
// File: CXP_FRM_DEMUX.v
// File history:
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//      <Revision number>: <Date>: <Comments>
//
// Description: 
//
// <Description here>
//
// Targeted device: <Family::PolarFire> <Die::MPF300T> <Package::FCG1152>
// Author: <Name>
//
/////////////////////////////////////////////////////////////////////////////////////////////////// 

//`timescale <time_units> / <precision>

module CXP_FRM_DEMUX( 
 input         clk_i,
 input         resetn_i,
 input  [7:0]  sid_i,
 input         frm_start_i,
 input         line_valid_i,
 input  [63:0] line_data_i,
 input  [7:0]  sid0_i,//from GUI
 input  [7:0]  sid1_i,//from GUI
 
 output reg        frm_start0_o,
 output reg        line_valid0_o,
 output reg [63:0] line_data0_o,
 
 output reg        frm_start1_o,
 output reg        line_valid1_o,
 output reg [63:0] line_data1_o
 );

always@(posedge clk_i, negedge resetn_i)
  if (!resetn_i) begin  
    frm_start0_o  <= 0;
    line_valid0_o <= 0;
    line_data0_o  <= 0; 
    frm_start1_o  <= 0;
    line_valid1_o <= 0;
    line_data1_o  <= 0;
  end
  else begin
   frm_start0_o  <= (sid_i == sid0_i) ? frm_start_i : 0;
   line_valid0_o <= (sid_i == sid0_i) ? line_valid_i: 0;
   line_data0_o  <= (sid_i == sid0_i) ? line_data_i : 0;
  
   frm_start1_o  <= (sid_i == sid1_i) ? frm_start_i : 0;
   line_valid1_o <= (sid_i == sid1_i) ? line_valid_i: 0;
   line_data1_o  <= (sid_i == sid1_i) ? line_data_i : 0;
  end  
 
endmodule

