data/full_repos/permissive/458737381/src/verilog-parser/tests/sparc_ifu_fdp.v
1: b'%Error: data/full_repos/permissive/458737381/src/verilog-parser/tests/sparc_ifu_fdp.v:35: Cannot find include file: ifu.h\n`include "ifu.h" \n         ^~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/458737381/src/verilog-parser/tests,data/full_repos/permissive/458737381/ifu.h\n             data/full_repos/permissive/458737381/src/verilog-parser/tests,data/full_repos/permissive/458737381/ifu.h.v\n             data/full_repos/permissive/458737381/src/verilog-parser/tests,data/full_repos/permissive/458737381/ifu.h.sv\n             ifu.h\n             ifu.h.v\n             ifu.h.sv\n             obj_dir/ifu.h\n             obj_dir/ifu.h.v\n             obj_dir/ifu.h.sv\n%Error: Exiting due to 1 error(s)\n'
module sparc_ifu_fdp(

   so, fdp_itlb_ctxt_bf, fdp_icd_vaddr_bf, fdp_icv_index_bf, 
   fdp_erb_pc_f, fdp_dtu_inst_s, ifu_exu_pc_d, ifu_exu_rs1_s, 
   ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_tlu_pc_m, ifu_tlu_npc_m, 
   ifu_tlu_pc_oor_e, ifu_exu_pcver_e, fdp_fcl_swc_s2, 
   fdp_fcl_pc_oor_vec_f, fdp_fcl_pc_oor_e, fdp_fcl_op_s, 
   fdp_fcl_op3_s, fdp_fcl_ibit_s, 

   rclk, se, si, const_maskid, lsu_t0_pctxt_state, 
   lsu_t1_pctxt_state, lsu_t2_pctxt_state, lsu_t3_pctxt_state, 
   exu_ifu_brpc_e, tlu_ifu_trappc_w2, tlu_ifu_trapnpc_w2, 
   tlu_itlb_dmp_nctxt_g, tlu_itlb_dmp_actxt_g, tlu_itlb_tte_tag_w2, 
   dtu_fdp_thrconf_e, icd_fdp_fetdata_s1, icd_fdp_topdata_s1, 
   ifq_fdp_fill_inst, fcl_fdp_oddwin_s, fcl_fdp_pcoor_vec_f, 
   fcl_fdp_pcoor_f, fcl_fdp_mask32b_f, fcl_fdp_addr_mask_d, 
   fcl_fdp_tctxt_sel_prim, fcl_fdp_usenir_sel_nir_s1, 
   fcl_fdp_rbinst_sel_inste_s, fcl_fdp_thrtnpc_sel_tnpc_l, 
   fcl_fdp_thrtnpc_sel_npcw_l, fcl_fdp_thrtnpc_sel_pcf_l, 
   fcl_fdp_thrtnpc_sel_old_l, fcl_fdp_thr_s1_l, 
   fcl_fdp_next_thr_bf_l, fcl_fdp_next_ctxt_bf_l, fcl_fdp_thr_s2_l, 
   fcl_fdp_nirthr_s1_l, fcl_fdp_tpcbf_sel_pcp4_bf_l, 
   fcl_fdp_tpcbf_sel_brpc_bf_l, fcl_fdp_tpcbf_sel_trap_bf_l, 
   fcl_fdp_tpcbf_sel_old_bf_l, fcl_fdp_pcbf_sel_swpc_bf_l, 
   fcl_fdp_pcbf_sel_nosw_bf_l, fcl_fdp_pcbf_sel_br_bf_l, 
   fcl_fdp_trrbpc_sel_trap_bf_l, fcl_fdp_trrbpc_sel_rb_bf_l, 
   fcl_fdp_trrbpc_sel_err_bf_l, fcl_fdp_trrbpc_sel_pcs_bf_l, 
   fcl_fdp_noswpc_sel_tnpc_l_bf, fcl_fdp_noswpc_sel_old_l_bf, 
   fcl_fdp_noswpc_sel_inc_l_bf, fcl_fdp_nextpcs_sel_pce_f_l, 
   fcl_fdp_nextpcs_sel_pcd_f_l, fcl_fdp_nextpcs_sel_pcs_f_l, 
   fcl_fdp_nextpcs_sel_pcf_f_l, fcl_fdp_rdsr_sel_pc_e_l, 
   fcl_fdp_rdsr_sel_ver_e_l, fcl_fdp_rdsr_sel_thr_e_l, 
   fcl_fdp_inst_sel_curr_s_l, fcl_fdp_inst_sel_switch_s_l, 
   fcl_fdp_inst_sel_nir_s_l, fcl_fdp_inst_sel_nop_s_l, 
   fcl_fdp_tinst_sel_curr_s_l, fcl_fdp_tinst_sel_rb_s_l, 
   fcl_fdp_tinst_sel_old_s_l, fcl_fdp_tinst_sel_ifq_s_l, 
   fcl_fdp_dmpthr_l, fcl_fdp_ctxt_sel_dmp_bf_l, 
   fcl_fdp_ctxt_sel_sw_bf_l, fcl_fdp_ctxt_sel_curr_bf_l
   );

   input       rclk, 
	             se,
	             si;

   input [7:0] const_maskid;
   
   input [12:0] lsu_t0_pctxt_state,
		            lsu_t1_pctxt_state,
		            lsu_t2_pctxt_state,
		            lsu_t3_pctxt_state;


   input [47:0] exu_ifu_brpc_e;

   input [48:0] tlu_ifu_trappc_w2,
		            tlu_ifu_trapnpc_w2;

   input        tlu_itlb_dmp_nctxt_g,
		            tlu_itlb_dmp_actxt_g;
   
   input [12:0] tlu_itlb_tte_tag_w2;
   

   
   input [40:0]         dtu_fdp_thrconf_e;

   input [32:0]         icd_fdp_fetdata_s1,
		                    icd_fdp_topdata_s1;
   
   input [32:0]         ifq_fdp_fill_inst;

   input                fcl_fdp_oddwin_s;
   input [3:0]          fcl_fdp_pcoor_vec_f;
   input                fcl_fdp_pcoor_f;
   input                fcl_fdp_mask32b_f;
   input                fcl_fdp_addr_mask_d;   
   input [3:0]          fcl_fdp_tctxt_sel_prim;
   

   input                fcl_fdp_usenir_sel_nir_s1;
   input [3:0]          fcl_fdp_rbinst_sel_inste_s;

   input [3:0]          fcl_fdp_thrtnpc_sel_tnpc_l,
	                      fcl_fdp_thrtnpc_sel_npcw_l,
		                    fcl_fdp_thrtnpc_sel_pcf_l,
	                      fcl_fdp_thrtnpc_sel_old_l;
   
   input [3:0]          fcl_fdp_thr_s1_l;
   

   input [3:0]          fcl_fdp_next_thr_bf_l;
   input [3:0]          fcl_fdp_next_ctxt_bf_l;

   input [3:0]          fcl_fdp_thr_s2_l;
   input [3:0]          fcl_fdp_nirthr_s1_l;
   
   input [3:0]          fcl_fdp_tpcbf_sel_pcp4_bf_l,
	                      fcl_fdp_tpcbf_sel_brpc_bf_l,
	                      fcl_fdp_tpcbf_sel_trap_bf_l,
	                      fcl_fdp_tpcbf_sel_old_bf_l;

   input                fcl_fdp_pcbf_sel_swpc_bf_l,
	                      fcl_fdp_pcbf_sel_nosw_bf_l,
	                      fcl_fdp_pcbf_sel_br_bf_l;

   input [3:0]          fcl_fdp_trrbpc_sel_trap_bf_l, 
	                      fcl_fdp_trrbpc_sel_rb_bf_l,
	                      fcl_fdp_trrbpc_sel_err_bf_l,	       
	                      fcl_fdp_trrbpc_sel_pcs_bf_l;
	 
   input                fcl_fdp_noswpc_sel_tnpc_l_bf,
	                      fcl_fdp_noswpc_sel_old_l_bf,			     
	                      fcl_fdp_noswpc_sel_inc_l_bf;

   input [3:0]          fcl_fdp_nextpcs_sel_pce_f_l,  
	                      fcl_fdp_nextpcs_sel_pcd_f_l,
	                      fcl_fdp_nextpcs_sel_pcs_f_l,  
	                      fcl_fdp_nextpcs_sel_pcf_f_l;
   
   input                fcl_fdp_rdsr_sel_pc_e_l,      
	                      fcl_fdp_rdsr_sel_ver_e_l,
	                      fcl_fdp_rdsr_sel_thr_e_l;

   input                fcl_fdp_inst_sel_curr_s_l,
	                      fcl_fdp_inst_sel_switch_s_l,
	                      fcl_fdp_inst_sel_nir_s_l,
	                      fcl_fdp_inst_sel_nop_s_l;
   
   input [3:0]          fcl_fdp_tinst_sel_curr_s_l,
	                      fcl_fdp_tinst_sel_rb_s_l,	       
	                      fcl_fdp_tinst_sel_old_s_l,
	                      fcl_fdp_tinst_sel_ifq_s_l;

   input [3:0]          fcl_fdp_dmpthr_l;

   input                fcl_fdp_ctxt_sel_dmp_bf_l,
	                      fcl_fdp_ctxt_sel_sw_bf_l,
	                      fcl_fdp_ctxt_sel_curr_bf_l;


   output               so;
   output [12:0]        fdp_itlb_ctxt_bf;
   output [47:2]        fdp_icd_vaddr_bf;
   output [11:5]        fdp_icv_index_bf;   
   output [47:0]        fdp_erb_pc_f;
   output [31:0]        fdp_dtu_inst_s;

   output [47:0]        ifu_exu_pc_d;
   output [4:0]         ifu_exu_rs1_s,
		                    ifu_exu_rs2_s,
		                    ifu_exu_rs3_s;
		              
   output [48:0]        ifu_tlu_pc_m,
		                    ifu_tlu_npc_m;

   output               ifu_tlu_pc_oor_e;
   
   output [63:0]        ifu_exu_pcver_e;

   output               fdp_fcl_swc_s2;
   output [3:0]         fdp_fcl_pc_oor_vec_f;
   output               fdp_fcl_pc_oor_e;

   output [1:0]         fdp_fcl_op_s;
   output [5:2]         fdp_fcl_op3_s;
   output               fdp_fcl_ibit_s;

   
   
   







   wire [12:0] 	curr_ctxt,
		            sw_ctxt,
		            dmp_ctxt,
		            dmp_ctxt_unq,
		            dmp_ctxt1,
		            dmp_ctxt2,
		            t0_ctxt_bf,
		            t1_ctxt_bf,
		            t2_ctxt_bf,
		            t3_ctxt_bf;


   wire [48:0]  t0pc_f, t1pc_f, t2pc_f, t3pc_f,
		            t0pc_s, t1pc_s, t2pc_s, t3pc_s,
		            t0_next_pcs_f, t1_next_pcs_f, t2_next_pcs_f, t3_next_pcs_f,
		            t0npc_bf, t1npc_bf, t2npc_bf, t3npc_bf,

		            pc_s, pc_d, pc_e, pc_m, pc_w,          
		            npc_s, npc_d, npc_e, npc_m, npc_w,
		            pc_d_adj, npc_d_adj;

   wire [47:0]  pc_bf,
		            swpc_bf,
                pc_f;

   wire [48:0]  nextpc_nosw_bf,
		            am_mask;
   

   wire [48:0]  t0_trap_rb_pc_bf,
		            t1_trap_rb_pc_bf,
		            t2_trap_rb_pc_bf,
		            t3_trap_rb_pc_bf;

   wire [48:0]  thr_trappc_bf,
		            t0_trapnpc_f,
		            t1_trapnpc_f,
		            t2_trapnpc_f,
		            t3_trapnpc_f,
		            trapnpc0_bf,
		            trapnpc1_bf,
		            trapnpc2_bf,
		            trapnpc3_bf;


   wire [48:0]  pcinc_f;


   wire [32:0]  inst_s2,
		            fdp_inst_s,
		            t0inst_s1,
		            t1inst_s1,
		            t2inst_s1,
		            t3inst_s1,
		            t0inst_s2,
		            t1inst_s2,
		            t2inst_s2,
		            t3inst_s2;

   wire [32:0]  inst_s1;
   wire [32:0]  inst_s1_bf1;

   wire [32:0]  rb_inst0_s,
		            rb_inst1_s,
		            rb_inst2_s,
		            rb_inst3_s,
		            inst_d,
		            inst_e;


   wire [32:0]  nirdata_s1,
		            t0nir,
		            t1nir,
		            t2nir,
		            t3nir;

   wire         clk;
   




   assign       clk = rclk;
   



   assign t0_ctxt_bf = lsu_t0_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[0]}};

`ifdef FPGA_SYN_1THREAD

   assign sw_ctxt = t0_ctxt_bf;
   assign curr_ctxt = t0_ctxt_bf;
   assign dmp_ctxt_unq = lsu_t0_pctxt_state;
   
`else

   assign t1_ctxt_bf = lsu_t1_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[1]}};
   assign t2_ctxt_bf = lsu_t2_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[2]}};
   assign t3_ctxt_bf = lsu_t3_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[3]}};

   dp_mux4ds #(13) sw_ctxt_mux(.dout (sw_ctxt),
			       .in0  (t0_ctxt_bf),
			       .in1  (t1_ctxt_bf),
			       .in2  (t2_ctxt_bf),
			       .in3  (t3_ctxt_bf),
			       .sel0_l (fcl_fdp_next_ctxt_bf_l[0]),
			       .sel1_l (fcl_fdp_next_ctxt_bf_l[1]),
			       .sel2_l (fcl_fdp_next_ctxt_bf_l[2]),
			       .sel3_l (fcl_fdp_next_ctxt_bf_l[3]));
   
   dp_mux4ds #(13) curr_ctxt_mux(.dout (curr_ctxt),
			     .in0  (t0_ctxt_bf),
			     .in1  (t1_ctxt_bf),
			     .in2  (t2_ctxt_bf),
			     .in3  (t3_ctxt_bf),
			     .sel0_l (fcl_fdp_thr_s2_l[0]),
			     .sel1_l (fcl_fdp_thr_s2_l[1]),
			     .sel2_l (fcl_fdp_thr_s2_l[2]),
			     .sel3_l (fcl_fdp_thr_s2_l[3]));

   dp_mux4ds #(13) dmp_ctxt_mux(.dout (dmp_ctxt_unq),
			      .in0  (lsu_t0_pctxt_state),
			      .in1  (lsu_t1_pctxt_state),
			      .in2  (lsu_t2_pctxt_state),
			      .in3  (lsu_t3_pctxt_state),
			      .sel0_l (fcl_fdp_dmpthr_l[0]),
			      .sel1_l (fcl_fdp_dmpthr_l[1]),
			      .sel2_l (fcl_fdp_dmpthr_l[2]),
			      .sel3_l (fcl_fdp_dmpthr_l[3]));
`endif
   
   assign dmp_ctxt1 = dmp_ctxt_unq & {13{~(tlu_itlb_dmp_nctxt_g |
					                                 tlu_itlb_dmp_actxt_g)}};

   assign dmp_ctxt2 = {tlu_itlb_tte_tag_w2[12:7],tlu_itlb_tte_tag_w2[6:0]} & 
	                    {13{tlu_itlb_dmp_actxt_g}};





   assign dmp_ctxt = dmp_ctxt1 | dmp_ctxt2;

   dp_mux3ds #(13) ctxt_mux (.dout (fdp_itlb_ctxt_bf),
			                     .in0  (curr_ctxt),
			                     .in1  (sw_ctxt),
			                     .in2  (dmp_ctxt),
			                     .sel0_l  (fcl_fdp_ctxt_sel_curr_bf_l),
			                     .sel1_l  (fcl_fdp_ctxt_sel_sw_bf_l),
			                     .sel2_l  (fcl_fdp_ctxt_sel_dmp_bf_l));
   
   






   dp_mux3ds #(64) ver_mux(.dout (ifu_exu_pcver_e[63:0]),
			                   .in0  ({{16{pc_e[47]}}, pc_e[47:0]}),
			                   .in1  ({`VER_MANUF, 
                                 `VER_IMPL,
                                 const_maskid[7:0],
                                 `VER_MAXGL, 
                                 `VER_MAXTL,
                                 `VER_MAXWIN}),
			                   .in2  ({12'b0, 
                                 dtu_fdp_thrconf_e[40:29],
                                 4'b0,
                                 dtu_fdp_thrconf_e[28:9],
                                 2'b0,
                                 dtu_fdp_thrconf_e[8:3],
                                 5'b0,
                                 dtu_fdp_thrconf_e[2:0]}),
			                   .sel0_l  (fcl_fdp_rdsr_sel_pc_e_l),
			                   .sel1_l  (fcl_fdp_rdsr_sel_ver_e_l),
			                   .sel2_l  (fcl_fdp_rdsr_sel_thr_e_l));
   

   dp_mux4ds #(49) t0_pcbf_mux(.dout (t0npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[0], t0pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t0_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[0]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[0]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[0]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(49) t1_pcbf_mux(.dout (t1npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[1], t1pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t1_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[1]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[1]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[1]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[1]));
   
   dp_mux4ds #(49) t2_pcbf_mux(.dout (t2npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[2], t2pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t2_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[2]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[2]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[2]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[2]));
   
   dp_mux4ds #(49) t3_pcbf_mux(.dout (t3npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[3], t3pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t3_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[3]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[3]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[3]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[3]));
`endif
   

   dff_s  #(49)  t0_pcf_reg(.din (t0npc_bf), 
			                  .clk (clk), 
			                  .q   (t0pc_f), 
			                  .se  (se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign fdp_fcl_pc_oor_vec_f = {3'b0, t0pc_f[48]};
   assign swpc_bf = t0pc_f[47:0];
`else
   dff_s  #(49)  t1_pcf_reg(.din (t1npc_bf), 
			                  .clk (clk), 
			                  .q   (t1pc_f), 
			                  .se  (se), .si(), .so());
   dff_s  #(49)  t2_pcf_reg(.din (t2npc_bf), 
			                  .clk (clk), 
			                  .q   (t2pc_f), 
			                  .se  (se), .si(), .so());
   dff_s  #(49)  t3_pcf_reg(.din (t3npc_bf), 
			                  .clk (clk), 
			                  .q   (t3pc_f), 
			                  .se  (se), .si(), .so());

   assign fdp_fcl_pc_oor_vec_f = {t3pc_f[48], t2pc_f[48], 
				                          t1pc_f[48], t0pc_f[48]};

   

   dp_mux4ds #(48) swpc_mux(.dout (swpc_bf), 
			                    .in0 (t0pc_f[47:0]), 
			                    .in1 (t1pc_f[47:0]), 
			                    .in2 (t2pc_f[47:0]), 
			                    .in3 (t3pc_f[47:0]),
			                    .sel0_l (fcl_fdp_next_thr_bf_l[0]),
			                    .sel1_l (fcl_fdp_next_thr_bf_l[1]),
			                    .sel2_l (fcl_fdp_next_thr_bf_l[2]),
			                    .sel3_l (fcl_fdp_next_thr_bf_l[3]));
`endif

























   assign fdp_icd_vaddr_bf = pc_bf[47:2];


   assign fdp_icv_index_bf = pc_bf[11:5];


   dp_mux3ds #(48) pcbf_mux(.dout  (pc_bf[47:0]),
			  .in0   (swpc_bf[47:0]),        
			  .in1   (nextpc_nosw_bf[47:0]),
			  .in2   (exu_ifu_brpc_e[47:0]), 
			  .sel0_l (fcl_fdp_pcbf_sel_swpc_bf_l),
			  .sel1_l (fcl_fdp_pcbf_sel_nosw_bf_l),
			  .sel2_l (fcl_fdp_pcbf_sel_br_bf_l));

   dff_s #(48)  pcf_reg(.din  (pc_bf), 
		    .clk  (clk), 
		    .q    (pc_f), 
		    .se   (se), .si(), .so());

   assign fdp_erb_pc_f = pc_f[47:0];


   dp_mux4ds #(49) trap_pc0_mux(.dout (t0_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t0pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[0]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[0]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[0]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[0]));
  
`ifdef FPGA_SYN_1THREAD
`else 
   dp_mux4ds #(49) trap_pc1_mux(.dout (t1_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t1pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[1]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[1]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[1]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[1]));
   
   dp_mux4ds #(49) trap_pc2_mux(.dout (t2_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t2pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[2]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[2]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[2]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[2]));
   
   dp_mux4ds #(49) trap_pc3_mux(.dout (t3_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t3pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[3]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[3]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[3]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[3]));
`endif
   



   dp_mux3ds #(49) pcp4_mux(.dout  (nextpc_nosw_bf),
			  .in0   (pcinc_f),
			  .in1   (thr_trappc_bf),
			  .in2   ({fcl_fdp_pcoor_f, pc_f[47:0]}),
			  .sel0_l (fcl_fdp_noswpc_sel_inc_l_bf),
			  .sel1_l (fcl_fdp_noswpc_sel_tnpc_l_bf),
			  .sel2_l (fcl_fdp_noswpc_sel_old_l_bf));





   dp_mux4ds #(49) t0pcf_mux(.dout (t0_next_pcs_f), 
			   .in0  (t0pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[0], t0pc_f[47:0]}),
			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[0]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[0]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[0]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[0]));

`ifdef FPGA_SYN_1THREAD
`else  
   dp_mux4ds #(49) t1pcf_mux(.dout (t1_next_pcs_f), 
			   .in0  (t1pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[1], t1pc_f[47:0]}),
			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[1]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[1]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[1]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[1]));
   
   dp_mux4ds #(49) t2pcf_mux(.dout (t2_next_pcs_f), 
			   .in0  (t2pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[2], t2pc_f[47:0]}),

			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[2]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[2]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[2]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[2]));
   
   dp_mux4ds #(49) t3pcf_mux(.dout (t3_next_pcs_f), 
			   .in0  (t3pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[3], t3pc_f[47:0]}),

			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[3]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[3]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[3]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[3]));
`endif
   
   

   dff_s  #(49)  t0pcs_reg(.din  (t0_next_pcs_f),  
		                   .q    (t0pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign pc_s = t0pc_s;
   assign npc_s = t0_next_pcs_f;
`else  
   dff_s  #(49)  t1pcs_reg(.din  (t1_next_pcs_f),  
		                   .q    (t1pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  t2pcs_reg(.din  (t2_next_pcs_f),  
		                   .q    (t2pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  t3pcs_reg(.din  (t3_next_pcs_f),  
		                   .q    (t3pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   

   dp_mux4ds #(49) pcs_mux(.dout (pc_s),
			 .in0  (t0pc_s), 
			 .in1  (t1pc_s), 
			 .in2  (t2pc_s), 
			 .in3  (t3pc_s),
			 .sel0_l (fcl_fdp_thr_s2_l[0]),
			 .sel1_l (fcl_fdp_thr_s2_l[1]),
			 .sel2_l (fcl_fdp_thr_s2_l[2]),
			 .sel3_l (fcl_fdp_thr_s2_l[3]));


   dp_mux4ds #(49) npcs_mux(.dout (npc_s),
			  .in0  (t0_next_pcs_f), 
			  .in1  (t1_next_pcs_f), 
			  .in2  (t2_next_pcs_f), 
			  .in3  (t3_next_pcs_f),
			  .sel0_l (fcl_fdp_thr_s2_l[0]),
			  .sel1_l (fcl_fdp_thr_s2_l[1]),
			  .sel2_l (fcl_fdp_thr_s2_l[2]),
			  .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif


   dff_s  #(49)  pcd_reg(.din (pc_s), 
		                 .q   (pc_d), 
		                 .clk (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcd_reg(.din  (npc_s), 
		                  .q    (npc_d), 
		                  .clk  (clk), .se(se), .si(), .so());

   assign am_mask = {{17{~fcl_fdp_addr_mask_d}}, 32'hffffffff};


   assign pc_d_adj = pc_d & am_mask;
   assign npc_d_adj = npc_d & am_mask;
   
   assign ifu_exu_pc_d = pc_d_adj[47:0];


   dff_s  #(49)  pce_reg(.din (pc_d_adj), 
		                 .q   (pc_e), 
		                 .clk (clk), .se(se), .si(), .so());
   dff_s  #(49)  npce_reg(.din  (npc_d_adj), 
		                  .q    (npc_e), 
		                  .clk (clk), .se(se), .si(), .so());

   assign fdp_fcl_pc_oor_e = pc_e[48];
   assign ifu_tlu_pc_oor_e = pc_e[48];


   dff_s  #(49)  pcm_reg(.din  (pc_e), 
		                 .q    (pc_m), 
		                 .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcm_reg(.din (npc_e), 
		                  .q   (npc_m), 
		                  .clk (clk), .se(se), .si(), .so());
   assign ifu_tlu_pc_m = pc_m[48:0];
   assign ifu_tlu_npc_m = npc_m[48:0];
   

   dff_s  #(49)  pcw_reg(.din  (pc_m), 
		                 .q    (pc_w), 
		                 .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcw_reg(.din (npc_m), 
		                  .q   (npc_w), 
		                  .clk (clk), .se(se), .si(), .so());
   





   assign pcinc_f[1:0] = pc_f[1:0];
   sparc_ifu_incr46 pc_inc(.a     (pc_f[47:2]), 
			                     .a_inc (pcinc_f[47:2]), 
			                     .ofl   ());
   

   assign pcinc_f[48] = ~pc_f[47] & pcinc_f[47] & ~fcl_fdp_mask32b_f | 
                        fcl_fdp_pcoor_f;   


   dp_mux4ds #(49) t0tnpc_mux(.dout (trapnpc0_bf),
			                        .in0  (tlu_ifu_trapnpc_w2),
			                        .in1  (npc_w),
                              .in2  (t0pc_f),
			                        .in3  (t0_trapnpc_f),
			                        .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[0]),
			                        .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[0]),
			                        .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[0]),
			                        .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[0]));
  
`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(49) t1tnpc_mux(.dout (trapnpc1_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t1pc_f),
			    .in3  (t1_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[1]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[1]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[1]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[1]));
   
   dp_mux4ds #(49) t2tnpc_mux(.dout (trapnpc2_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t2pc_f),
			    .in3  (t2_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[2]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[2]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[2]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[2]));
   
   dp_mux4ds #(49) t3tnpc_mux(.dout (trapnpc3_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t3pc_f),
			    .in3  (t3_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[3]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[3]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[3]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[3]));
`endif
   

   dff_s #(49) t0tnpcf_reg(.din  (trapnpc0_bf),
		                   .q    (t0_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign thr_trappc_bf = t0_trapnpc_f;
`else
   dff_s #(49) t1tnpcf_reg(.din  (trapnpc1_bf),
		                   .q    (t1_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(49) t2tnpcf_reg(.din  (trapnpc2_bf),
		                   .q    (t2_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(49) t3tnpcf_reg(.din  (trapnpc3_bf),
		                   .q    (t3_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());

   dp_mux4ds #(49) nxttpc_mux(.dout (thr_trappc_bf),
			    .in0  (t0_trapnpc_f), 
			    .in1  (t1_trapnpc_f),
			    .in2  (t2_trapnpc_f),
			    .in3  (t3_trapnpc_f),
			    .sel0_l (fcl_fdp_thr_s2_l[0]),
			    .sel1_l (fcl_fdp_thr_s2_l[1]),
			    .sel2_l (fcl_fdp_thr_s2_l[2]),
			    .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif















   
   









   dp_mux2es #(33)  usenir_mux(.dout (inst_s1), 
			                       .in0  (icd_fdp_fetdata_s1[32:0]), 
			                       .in1  (nirdata_s1),
			                       .sel  (fcl_fdp_usenir_sel_nir_s1));



   dp_mux4ds  #(33)  instout_mux(.dout (fdp_inst_s),  
			                         .in0 (icd_fdp_fetdata_s1[32:0]), 
			                         .in1 (inst_s2), 
			                         .in2 ({`NOP, 1'b0}),
			                         .in3 (nirdata_s1[32:0]), 
			                         .sel0_l (fcl_fdp_inst_sel_curr_s_l),
			                         .sel1_l (fcl_fdp_inst_sel_switch_s_l),
			                         .sel2_l (fcl_fdp_inst_sel_nop_s_l),
			                         .sel3_l (fcl_fdp_inst_sel_nir_s_l));

   assign fdp_fcl_swc_s2 = fdp_inst_s[0];

   assign fdp_fcl_op_s = fdp_inst_s[32:31];
   assign fdp_fcl_op3_s = fdp_inst_s[25:22];
   assign fdp_fcl_ibit_s = fdp_inst_s[14];
   
   assign fdp_dtu_inst_s = fdp_inst_s[32:1];





   assign ifu_exu_rs1_s[4] = fdp_inst_s[19] ^ 
			                       (fdp_inst_s[18] & fcl_fdp_oddwin_s);
   assign ifu_exu_rs1_s[3:0] = fdp_inst_s[18:15];
   
   assign ifu_exu_rs2_s[4] = (fdp_inst_s[5] ^ 
			                        (fdp_inst_s[4] & fcl_fdp_oddwin_s));
   assign ifu_exu_rs2_s[3:0] = fdp_inst_s[4:1];

   assign ifu_exu_rs3_s[4] = (fdp_inst_s[30] ^ 
			                        (fdp_inst_s[29] & fcl_fdp_oddwin_s));
   assign ifu_exu_rs3_s[3:0] = fdp_inst_s[29:26];


   dp_buffer #(33) insts1_buf(inst_s1_bf1, inst_s1[32:0]);
		

   dp_mux4ds #(33)  t0inst_mux(.dout (t0inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t0inst_s2),
			     .in3 (rb_inst0_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[0]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[0]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[0]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(33)  t1inst_mux(.dout (t1inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t1inst_s2),
			     .in3 (rb_inst1_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[1]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[1]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[1]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[1]));

   dp_mux4ds #(33)  t2inst_mux(.dout (t2inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t2inst_s2),
			     .in3 (rb_inst2_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[2]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[2]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[2]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[2]));

   dp_mux4ds #(33)  t3inst_mux(.dout (t3inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t3inst_s2),
			     .in3 (rb_inst3_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[3]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[3]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[3]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[3]));
`endif


   dff_s #(33) t0_inst_reg(.din  (t0inst_s1), 
		                   .q    (t0inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign inst_s2 = t0inst_s2;
`else
   dff_s #(33) t1_inst_reg(.din  (t1inst_s1), 
		                   .q    (t1inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(33) t2_inst_reg(.din  (t2inst_s1), 
		                   .q    (t2inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(33) t3_inst_reg(.din  (t3inst_s1), 
		                   .q    (t3inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   


   dp_mux4ds  #(33) swinst_mux(.dout (inst_s2),
			     .in0  (t0inst_s2), 
			     .in1  (t1inst_s2), 
			     .in2  (t2inst_s2), 
			     .in3  (t3inst_s2),
			     .sel0_l (fcl_fdp_thr_s2_l[0]),
			     .sel1_l (fcl_fdp_thr_s2_l[1]),
			     .sel2_l (fcl_fdp_thr_s2_l[2]),
			     .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif


   dff_s #(33) rbinst_d_reg(.din (fdp_inst_s[32:0]),
			                  .q   (inst_d),
			                  .clk (clk),
			                  .se  (se), .si(), .so());
   
   dff_s #(33) rbinst_e_reg(.din (inst_d),
			                  .q   (inst_e),
			                  .clk (clk),
			                  .se  (se), .si(), .so());

   dp_mux2es #(33) rbinst0_mux(.dout (rb_inst0_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux2es #(33) rbinst1_mux(.dout (rb_inst1_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[1]));

   dp_mux2es #(33) rbinst2_mux(.dout (rb_inst2_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[2]));

   dp_mux2es #(33) rbinst3_mux(.dout (rb_inst3_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[3]));
`endif
























   wire   clk_nir0;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir0(.rclk (rclk),
                              .clk  (clk_nir0),
                              .en_l (fcl_fdp_thr_s1_l[0]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t0nir_reg(.din (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t0nir), 
		                   .en  (~(fcl_fdp_thr_s1_l[0])), .clk(rclk), .se(se), .si(), .so());
`else
   
   dff_s #(33) t0nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t0nir), 
		                   .clk  (clk_nir0), .se(se), .si(), .so());
`endif
   
`ifdef FPGA_SYN_1THREAD
   assign nirdata_s1 = t0nir; 
`else
   wire   clk_nir1;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir1(.rclk (rclk),
                              .clk  (clk_nir1),
                              .en_l (fcl_fdp_thr_s1_l[1]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33)  t1nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t1nir), 
		                   .en (~(fcl_fdp_thr_s1_l[1])), .clk  (rclk), .se(se), .si(), .so());
`else
   dff_s #(33) t1nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t1nir), 
		                   .clk  (clk_nir1), .se(se), .si(), .so());
`endif
   
   wire   clk_nir2;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir2(.rclk (rclk),
                              .clk  (clk_nir2),
                              .en_l (fcl_fdp_thr_s1_l[2]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t2nir_reg(.din  (icd_fdp_topdata_s1[32:0]),
		                   .q    (t2nir), 
		                   .en (~(fcl_fdp_thr_s1_l[2])), .clk  (rclk), .se(se), .si(), .so());
`else
   dff_s #(33) t2nir_reg(.din  (icd_fdp_topdata_s1[32:0]),
		                   .q    (t2nir), 
		                   .clk  (clk_nir2), .se(se), .si(), .so());
`endif
   wire   clk_nir3;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir3(.rclk (rclk),
                              .clk  (clk_nir3),
                              .en_l (fcl_fdp_thr_s1_l[3]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t3nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t3nir), 
		                   .en (~(fcl_fdp_thr_s1_l[3])), .clk  (rclk), .se(se), .si(), .so());
`else
   
   dff_s #(33) t3nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t3nir), 
		                   .clk  (clk_nir3), .se(se), .si(), .so());
`endif
   

   dp_mux4ds  #(33) nextnir_mux(.dout (nirdata_s1),
		                          .in0 (t0nir), 
                              .in1 (t1nir), 
                              .in2 (t2nir), 
                              .in3 (t3nir),
		                          .sel0_l (fcl_fdp_nirthr_s1_l[0]),
		                          .sel1_l (fcl_fdp_nirthr_s1_l[1]),
		                          .sel2_l (fcl_fdp_nirthr_s1_l[2]),
		                          .sel3_l (fcl_fdp_nirthr_s1_l[3]));
`endif





endmodule
module sparc_ifu_fdp(

   so, fdp_itlb_ctxt_bf, fdp_icd_vaddr_bf, fdp_icv_index_bf, 
   fdp_erb_pc_f, fdp_dtu_inst_s, ifu_exu_pc_d, ifu_exu_rs1_s, 
   ifu_exu_rs2_s, ifu_exu_rs3_s, ifu_tlu_pc_m, ifu_tlu_npc_m, 
   ifu_tlu_pc_oor_e, ifu_exu_pcver_e, fdp_fcl_swc_s2, 
   fdp_fcl_pc_oor_vec_f, fdp_fcl_pc_oor_e, fdp_fcl_op_s, 
   fdp_fcl_op3_s, fdp_fcl_ibit_s, 

   rclk, se, si, const_maskid, lsu_t0_pctxt_state, 
   lsu_t1_pctxt_state, lsu_t2_pctxt_state, lsu_t3_pctxt_state, 
   exu_ifu_brpc_e, tlu_ifu_trappc_w2, tlu_ifu_trapnpc_w2, 
   tlu_itlb_dmp_nctxt_g, tlu_itlb_dmp_actxt_g, tlu_itlb_tte_tag_w2, 
   dtu_fdp_thrconf_e, icd_fdp_fetdata_s1, icd_fdp_topdata_s1, 
   ifq_fdp_fill_inst, fcl_fdp_oddwin_s, fcl_fdp_pcoor_vec_f, 
   fcl_fdp_pcoor_f, fcl_fdp_mask32b_f, fcl_fdp_addr_mask_d, 
   fcl_fdp_tctxt_sel_prim, fcl_fdp_usenir_sel_nir_s1, 
   fcl_fdp_rbinst_sel_inste_s, fcl_fdp_thrtnpc_sel_tnpc_l, 
   fcl_fdp_thrtnpc_sel_npcw_l, fcl_fdp_thrtnpc_sel_pcf_l, 
   fcl_fdp_thrtnpc_sel_old_l, fcl_fdp_thr_s1_l, 
   fcl_fdp_next_thr_bf_l, fcl_fdp_next_ctxt_bf_l, fcl_fdp_thr_s2_l, 
   fcl_fdp_nirthr_s1_l, fcl_fdp_tpcbf_sel_pcp4_bf_l, 
   fcl_fdp_tpcbf_sel_brpc_bf_l, fcl_fdp_tpcbf_sel_trap_bf_l, 
   fcl_fdp_tpcbf_sel_old_bf_l, fcl_fdp_pcbf_sel_swpc_bf_l, 
   fcl_fdp_pcbf_sel_nosw_bf_l, fcl_fdp_pcbf_sel_br_bf_l, 
   fcl_fdp_trrbpc_sel_trap_bf_l, fcl_fdp_trrbpc_sel_rb_bf_l, 
   fcl_fdp_trrbpc_sel_err_bf_l, fcl_fdp_trrbpc_sel_pcs_bf_l, 
   fcl_fdp_noswpc_sel_tnpc_l_bf, fcl_fdp_noswpc_sel_old_l_bf, 
   fcl_fdp_noswpc_sel_inc_l_bf, fcl_fdp_nextpcs_sel_pce_f_l, 
   fcl_fdp_nextpcs_sel_pcd_f_l, fcl_fdp_nextpcs_sel_pcs_f_l, 
   fcl_fdp_nextpcs_sel_pcf_f_l, fcl_fdp_rdsr_sel_pc_e_l, 
   fcl_fdp_rdsr_sel_ver_e_l, fcl_fdp_rdsr_sel_thr_e_l, 
   fcl_fdp_inst_sel_curr_s_l, fcl_fdp_inst_sel_switch_s_l, 
   fcl_fdp_inst_sel_nir_s_l, fcl_fdp_inst_sel_nop_s_l, 
   fcl_fdp_tinst_sel_curr_s_l, fcl_fdp_tinst_sel_rb_s_l, 
   fcl_fdp_tinst_sel_old_s_l, fcl_fdp_tinst_sel_ifq_s_l, 
   fcl_fdp_dmpthr_l, fcl_fdp_ctxt_sel_dmp_bf_l, 
   fcl_fdp_ctxt_sel_sw_bf_l, fcl_fdp_ctxt_sel_curr_bf_l
   );


   input       rclk, 
	             se,
	             si;

   input [7:0] const_maskid;
   
   input [12:0] lsu_t0_pctxt_state,
		            lsu_t1_pctxt_state,
		            lsu_t2_pctxt_state,
		            lsu_t3_pctxt_state;


   input [47:0] exu_ifu_brpc_e;

   input [48:0] tlu_ifu_trappc_w2,
		            tlu_ifu_trapnpc_w2;

   input        tlu_itlb_dmp_nctxt_g,
		            tlu_itlb_dmp_actxt_g;
   
   input [12:0] tlu_itlb_tte_tag_w2;
   

   
   input [40:0]         dtu_fdp_thrconf_e;

   input [32:0]         icd_fdp_fetdata_s1,
		                    icd_fdp_topdata_s1;
   
   input [32:0]         ifq_fdp_fill_inst;

   input                fcl_fdp_oddwin_s;
   input [3:0]          fcl_fdp_pcoor_vec_f;
   input                fcl_fdp_pcoor_f;
   input                fcl_fdp_mask32b_f;
   input                fcl_fdp_addr_mask_d;   
   input [3:0]          fcl_fdp_tctxt_sel_prim;
   

   input                fcl_fdp_usenir_sel_nir_s1;
   input [3:0]          fcl_fdp_rbinst_sel_inste_s;

   input [3:0]          fcl_fdp_thrtnpc_sel_tnpc_l,
	                      fcl_fdp_thrtnpc_sel_npcw_l,
		                    fcl_fdp_thrtnpc_sel_pcf_l,
	                      fcl_fdp_thrtnpc_sel_old_l;
   
   input [3:0]          fcl_fdp_thr_s1_l;
   

   input [3:0]          fcl_fdp_next_thr_bf_l;
   input [3:0]          fcl_fdp_next_ctxt_bf_l;

   input [3:0]          fcl_fdp_thr_s2_l;
   input [3:0]          fcl_fdp_nirthr_s1_l;
   
   input [3:0]          fcl_fdp_tpcbf_sel_pcp4_bf_l,
	                      fcl_fdp_tpcbf_sel_brpc_bf_l,
	                      fcl_fdp_tpcbf_sel_trap_bf_l,
	                      fcl_fdp_tpcbf_sel_old_bf_l;

   input                fcl_fdp_pcbf_sel_swpc_bf_l,
	                      fcl_fdp_pcbf_sel_nosw_bf_l,
	                      fcl_fdp_pcbf_sel_br_bf_l;

   input [3:0]          fcl_fdp_trrbpc_sel_trap_bf_l, 
	                      fcl_fdp_trrbpc_sel_rb_bf_l,
	                      fcl_fdp_trrbpc_sel_err_bf_l,	       
	                      fcl_fdp_trrbpc_sel_pcs_bf_l;
	 
   input                fcl_fdp_noswpc_sel_tnpc_l_bf,
	                      fcl_fdp_noswpc_sel_old_l_bf,			     
	                      fcl_fdp_noswpc_sel_inc_l_bf;

   input [3:0]          fcl_fdp_nextpcs_sel_pce_f_l,  
	                      fcl_fdp_nextpcs_sel_pcd_f_l,
	                      fcl_fdp_nextpcs_sel_pcs_f_l,  
	                      fcl_fdp_nextpcs_sel_pcf_f_l;
   
   input                fcl_fdp_rdsr_sel_pc_e_l,      
	                      fcl_fdp_rdsr_sel_ver_e_l,
	                      fcl_fdp_rdsr_sel_thr_e_l;

   input                fcl_fdp_inst_sel_curr_s_l,
	                      fcl_fdp_inst_sel_switch_s_l,
	                      fcl_fdp_inst_sel_nir_s_l,
	                      fcl_fdp_inst_sel_nop_s_l;
   
   input [3:0]          fcl_fdp_tinst_sel_curr_s_l,
	                      fcl_fdp_tinst_sel_rb_s_l,	       
	                      fcl_fdp_tinst_sel_old_s_l,
	                      fcl_fdp_tinst_sel_ifq_s_l;

   input [3:0]          fcl_fdp_dmpthr_l;

   input                fcl_fdp_ctxt_sel_dmp_bf_l,
	                      fcl_fdp_ctxt_sel_sw_bf_l,
	                      fcl_fdp_ctxt_sel_curr_bf_l;


   output               so;
   output [12:0]        fdp_itlb_ctxt_bf;
   output [47:2]        fdp_icd_vaddr_bf;
   output [11:5]        fdp_icv_index_bf;   
   output [47:0]        fdp_erb_pc_f;
   output [31:0]        fdp_dtu_inst_s;

   output [47:0]        ifu_exu_pc_d;
   output [4:0]         ifu_exu_rs1_s,
		                    ifu_exu_rs2_s,
		                    ifu_exu_rs3_s;
		              
   output [48:0]        ifu_tlu_pc_m,
		                    ifu_tlu_npc_m;

   output               ifu_tlu_pc_oor_e;
   
   output [63:0]        ifu_exu_pcver_e;

   output               fdp_fcl_swc_s2;
   output [3:0]         fdp_fcl_pc_oor_vec_f;
   output               fdp_fcl_pc_oor_e;

   output [1:0]         fdp_fcl_op_s;
   output [5:2]         fdp_fcl_op3_s;
   output               fdp_fcl_ibit_s;

   
   
   







   wire [12:0] 	curr_ctxt,
		            sw_ctxt,
		            dmp_ctxt,
		            dmp_ctxt_unq,
		            dmp_ctxt1,
		            dmp_ctxt2,
		            t0_ctxt_bf,
		            t1_ctxt_bf,
		            t2_ctxt_bf,
		            t3_ctxt_bf;


   wire [48:0]  t0pc_f, t1pc_f, t2pc_f, t3pc_f,
		            t0pc_s, t1pc_s, t2pc_s, t3pc_s,
		            t0_next_pcs_f, t1_next_pcs_f, t2_next_pcs_f, t3_next_pcs_f,
		            t0npc_bf, t1npc_bf, t2npc_bf, t3npc_bf,

		            pc_s, pc_d, pc_e, pc_m, pc_w,          
		            npc_s, npc_d, npc_e, npc_m, npc_w,
		            pc_d_adj, npc_d_adj;

   wire [47:0]  pc_bf,
		            swpc_bf,
                pc_f;

   wire [48:0]  nextpc_nosw_bf,
		            am_mask;
   

   wire [48:0]  t0_trap_rb_pc_bf,
		            t1_trap_rb_pc_bf,
		            t2_trap_rb_pc_bf,
		            t3_trap_rb_pc_bf;

   wire [48:0]  thr_trappc_bf,
		            t0_trapnpc_f,
		            t1_trapnpc_f,
		            t2_trapnpc_f,
		            t3_trapnpc_f,
		            trapnpc0_bf,
		            trapnpc1_bf,
		            trapnpc2_bf,
		            trapnpc3_bf;


   wire [48:0]  pcinc_f;


   wire [32:0]  inst_s2,
		            fdp_inst_s,
		            t0inst_s1,
		            t1inst_s1,
		            t2inst_s1,
		            t3inst_s1,
		            t0inst_s2,
		            t1inst_s2,
		            t2inst_s2,
		            t3inst_s2;

   wire [32:0]  inst_s1;
   wire [32:0]  inst_s1_bf1;

   wire [32:0]  rb_inst0_s,
		            rb_inst1_s,
		            rb_inst2_s,
		            rb_inst3_s,
		            inst_d,
		            inst_e;


   wire [32:0]  nirdata_s1,
		            t0nir,
		            t1nir,
		            t2nir,
		            t3nir;

   wire         clk;
   




   assign       clk = rclk;
   



   assign t0_ctxt_bf = lsu_t0_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[0]}};

`ifdef FPGA_SYN_1THREAD

   assign sw_ctxt = t0_ctxt_bf;
   assign curr_ctxt = t0_ctxt_bf;
   assign dmp_ctxt_unq = lsu_t0_pctxt_state;
   
`else

   assign t1_ctxt_bf = lsu_t1_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[1]}};
   assign t2_ctxt_bf = lsu_t2_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[2]}};
   assign t3_ctxt_bf = lsu_t3_pctxt_state & {13{fcl_fdp_tctxt_sel_prim[3]}};

   dp_mux4ds #(13) sw_ctxt_mux(.dout (sw_ctxt),
			       .in0  (t0_ctxt_bf),
			       .in1  (t1_ctxt_bf),
			       .in2  (t2_ctxt_bf),
			       .in3  (t3_ctxt_bf),
			       .sel0_l (fcl_fdp_next_ctxt_bf_l[0]),
			       .sel1_l (fcl_fdp_next_ctxt_bf_l[1]),
			       .sel2_l (fcl_fdp_next_ctxt_bf_l[2]),
			       .sel3_l (fcl_fdp_next_ctxt_bf_l[3]));
   
   dp_mux4ds #(13) curr_ctxt_mux(.dout (curr_ctxt),
			     .in0  (t0_ctxt_bf),
			     .in1  (t1_ctxt_bf),
			     .in2  (t2_ctxt_bf),
			     .in3  (t3_ctxt_bf),
			     .sel0_l (fcl_fdp_thr_s2_l[0]),
			     .sel1_l (fcl_fdp_thr_s2_l[1]),
			     .sel2_l (fcl_fdp_thr_s2_l[2]),
			     .sel3_l (fcl_fdp_thr_s2_l[3]));

   dp_mux4ds #(13) dmp_ctxt_mux(.dout (dmp_ctxt_unq),
			      .in0  (lsu_t0_pctxt_state),
			      .in1  (lsu_t1_pctxt_state),
			      .in2  (lsu_t2_pctxt_state),
			      .in3  (lsu_t3_pctxt_state),
			      .sel0_l (fcl_fdp_dmpthr_l[0]),
			      .sel1_l (fcl_fdp_dmpthr_l[1]),
			      .sel2_l (fcl_fdp_dmpthr_l[2]),
			      .sel3_l (fcl_fdp_dmpthr_l[3]));
`endif
   
   assign dmp_ctxt1 = dmp_ctxt_unq & {13{~(tlu_itlb_dmp_nctxt_g |
					                                 tlu_itlb_dmp_actxt_g)}};

   assign dmp_ctxt2 = {tlu_itlb_tte_tag_w2[12:7],tlu_itlb_tte_tag_w2[6:0]} & 
	                    {13{tlu_itlb_dmp_actxt_g}};





   assign dmp_ctxt = dmp_ctxt1 | dmp_ctxt2;

   dp_mux3ds #(13) ctxt_mux (.dout (fdp_itlb_ctxt_bf),
			                     .in0  (curr_ctxt),
			                     .in1  (sw_ctxt),
			                     .in2  (dmp_ctxt),
			                     .sel0_l  (fcl_fdp_ctxt_sel_curr_bf_l),
			                     .sel1_l  (fcl_fdp_ctxt_sel_sw_bf_l),
			                     .sel2_l  (fcl_fdp_ctxt_sel_dmp_bf_l));
   
   






   dp_mux3ds #(64) ver_mux(.dout (ifu_exu_pcver_e[63:0]),
			                   .in0  ({{16{pc_e[47]}}, pc_e[47:0]}),
			                   .in1  ({`VER_MANUF, 
                                 `VER_IMPL,
                                 const_maskid[7:0],
                                 `VER_MAXGL, 
                                 `VER_MAXTL,
                                 `VER_MAXWIN}),
			                   .in2  ({12'b0, 
                                 dtu_fdp_thrconf_e[40:29],
                                 4'b0,
                                 dtu_fdp_thrconf_e[28:9],
                                 2'b0,
                                 dtu_fdp_thrconf_e[8:3],
                                 5'b0,
                                 dtu_fdp_thrconf_e[2:0]}),
			                   .sel0_l  (fcl_fdp_rdsr_sel_pc_e_l),
			                   .sel1_l  (fcl_fdp_rdsr_sel_ver_e_l),
			                   .sel2_l  (fcl_fdp_rdsr_sel_thr_e_l));
   

   dp_mux4ds #(49) t0_pcbf_mux(.dout (t0npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[0], t0pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t0_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[0]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[0]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[0]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(49) t1_pcbf_mux(.dout (t1npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[1], t1pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t1_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[1]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[1]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[1]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[1]));
   
   dp_mux4ds #(49) t2_pcbf_mux(.dout (t2npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[2], t2pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t2_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[2]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[2]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[2]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[2]));
   
   dp_mux4ds #(49) t3_pcbf_mux(.dout (t3npc_bf), 
			                       .in0 ({fcl_fdp_pcoor_vec_f[3], t3pc_f[47:0]}), 
			                       .in1 (nextpc_nosw_bf), 
			                       .in2 (t3_trap_rb_pc_bf), 
			                       .in3 ({1'b0, exu_ifu_brpc_e}),
			                       .sel0_l (fcl_fdp_tpcbf_sel_old_bf_l[3]),
			                       .sel1_l (fcl_fdp_tpcbf_sel_pcp4_bf_l[3]),
			                       .sel2_l (fcl_fdp_tpcbf_sel_trap_bf_l[3]),
			                       .sel3_l (fcl_fdp_tpcbf_sel_brpc_bf_l[3]));
`endif
   

   dff_s  #(49)  t0_pcf_reg(.din (t0npc_bf), 
			                  .clk (clk), 
			                  .q   (t0pc_f), 
			                  .se  (se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign fdp_fcl_pc_oor_vec_f = {3'b0, t0pc_f[48]};
   assign swpc_bf = t0pc_f[47:0];
`else
   dff_s  #(49)  t1_pcf_reg(.din (t1npc_bf), 
			                  .clk (clk), 
			                  .q   (t1pc_f), 
			                  .se  (se), .si(), .so());
   dff_s  #(49)  t2_pcf_reg(.din (t2npc_bf), 
			                  .clk (clk), 
			                  .q   (t2pc_f), 
			                  .se  (se), .si(), .so());
   dff_s  #(49)  t3_pcf_reg(.din (t3npc_bf), 
			                  .clk (clk), 
			                  .q   (t3pc_f), 
			                  .se  (se), .si(), .so());

   assign fdp_fcl_pc_oor_vec_f = {t3pc_f[48], t2pc_f[48], 
				                          t1pc_f[48], t0pc_f[48]};

   

   dp_mux4ds #(48) swpc_mux(.dout (swpc_bf), 
			                    .in0 (t0pc_f[47:0]), 
			                    .in1 (t1pc_f[47:0]), 
			                    .in2 (t2pc_f[47:0]), 
			                    .in3 (t3pc_f[47:0]),
			                    .sel0_l (fcl_fdp_next_thr_bf_l[0]),
			                    .sel1_l (fcl_fdp_next_thr_bf_l[1]),
			                    .sel2_l (fcl_fdp_next_thr_bf_l[2]),
			                    .sel3_l (fcl_fdp_next_thr_bf_l[3]));
`endif

























   assign fdp_icd_vaddr_bf = pc_bf[47:2];


   assign fdp_icv_index_bf = pc_bf[11:5];


   dp_mux3ds #(48) pcbf_mux(.dout  (pc_bf[47:0]),
			  .in0   (swpc_bf[47:0]),        
			  .in1   (nextpc_nosw_bf[47:0]),
			  .in2   (exu_ifu_brpc_e[47:0]), 
			  .sel0_l (fcl_fdp_pcbf_sel_swpc_bf_l),
			  .sel1_l (fcl_fdp_pcbf_sel_nosw_bf_l),
			  .sel2_l (fcl_fdp_pcbf_sel_br_bf_l));

   dff_s #(48)  pcf_reg(.din  (pc_bf), 
		    .clk  (clk), 
		    .q    (pc_f), 
		    .se   (se), .si(), .so());

   assign fdp_erb_pc_f = pc_f[47:0];


   dp_mux4ds #(49) trap_pc0_mux(.dout (t0_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t0pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[0]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[0]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[0]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[0]));
  
`ifdef FPGA_SYN_1THREAD
`else 
   dp_mux4ds #(49) trap_pc1_mux(.dout (t1_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t1pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[1]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[1]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[1]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[1]));
   
   dp_mux4ds #(49) trap_pc2_mux(.dout (t2_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t2pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[2]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[2]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[2]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[2]));
   
   dp_mux4ds #(49) trap_pc3_mux(.dout (t3_trap_rb_pc_bf),
			      .in0  (tlu_ifu_trappc_w2),
			      .in1  (pc_d_adj),
			      .in2  (t3pc_s),
			      .in3  (pc_w),
			      .sel0_l  (fcl_fdp_trrbpc_sel_trap_bf_l[3]),
			      .sel1_l  (fcl_fdp_trrbpc_sel_rb_bf_l[3]),
			      .sel2_l  (fcl_fdp_trrbpc_sel_pcs_bf_l[3]),
			      .sel3_l  (fcl_fdp_trrbpc_sel_err_bf_l[3]));
`endif
   



   dp_mux3ds #(49) pcp4_mux(.dout  (nextpc_nosw_bf),
			  .in0   (pcinc_f),
			  .in1   (thr_trappc_bf),
			  .in2   ({fcl_fdp_pcoor_f, pc_f[47:0]}),
			  .sel0_l (fcl_fdp_noswpc_sel_inc_l_bf),
			  .sel1_l (fcl_fdp_noswpc_sel_tnpc_l_bf),
			  .sel2_l (fcl_fdp_noswpc_sel_old_l_bf));





   dp_mux4ds #(49) t0pcf_mux(.dout (t0_next_pcs_f), 
			   .in0  (t0pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[0], t0pc_f[47:0]}),
			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[0]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[0]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[0]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[0]));

`ifdef FPGA_SYN_1THREAD
`else  
   dp_mux4ds #(49) t1pcf_mux(.dout (t1_next_pcs_f), 
			   .in0  (t1pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[1], t1pc_f[47:0]}),
			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[1]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[1]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[1]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[1]));
   
   dp_mux4ds #(49) t2pcf_mux(.dout (t2_next_pcs_f), 
			   .in0  (t2pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[2], t2pc_f[47:0]}),

			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[2]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[2]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[2]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[2]));
   
   dp_mux4ds #(49) t3pcf_mux(.dout (t3_next_pcs_f), 
			   .in0  (t3pc_s), 
			   .in1  ({fcl_fdp_pcoor_vec_f[3], t3pc_f[47:0]}),

			   .in2  (pc_d_adj),
			   .in3  (pc_e),
			   .sel0_l (fcl_fdp_nextpcs_sel_pcs_f_l[3]),
			   .sel1_l (fcl_fdp_nextpcs_sel_pcf_f_l[3]),
			   .sel2_l (fcl_fdp_nextpcs_sel_pcd_f_l[3]),
			   .sel3_l (fcl_fdp_nextpcs_sel_pce_f_l[3]));
`endif
   
   

   dff_s  #(49)  t0pcs_reg(.din  (t0_next_pcs_f),  
		                   .q    (t0pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign pc_s = t0pc_s;
   assign npc_s = t0_next_pcs_f;
`else  
   dff_s  #(49)  t1pcs_reg(.din  (t1_next_pcs_f),  
		                   .q    (t1pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  t2pcs_reg(.din  (t2_next_pcs_f),  
		                   .q    (t2pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  t3pcs_reg(.din  (t3_next_pcs_f),  
		                   .q    (t3pc_s), 
		                   .clk  (clk),  .se(se), .si(), .so());
   

   dp_mux4ds #(49) pcs_mux(.dout (pc_s),
			 .in0  (t0pc_s), 
			 .in1  (t1pc_s), 
			 .in2  (t2pc_s), 
			 .in3  (t3pc_s),
			 .sel0_l (fcl_fdp_thr_s2_l[0]),
			 .sel1_l (fcl_fdp_thr_s2_l[1]),
			 .sel2_l (fcl_fdp_thr_s2_l[2]),
			 .sel3_l (fcl_fdp_thr_s2_l[3]));


   dp_mux4ds #(49) npcs_mux(.dout (npc_s),
			  .in0  (t0_next_pcs_f), 
			  .in1  (t1_next_pcs_f), 
			  .in2  (t2_next_pcs_f), 
			  .in3  (t3_next_pcs_f),
			  .sel0_l (fcl_fdp_thr_s2_l[0]),
			  .sel1_l (fcl_fdp_thr_s2_l[1]),
			  .sel2_l (fcl_fdp_thr_s2_l[2]),
			  .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif


   dff_s  #(49)  pcd_reg(.din (pc_s), 
		                 .q   (pc_d), 
		                 .clk (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcd_reg(.din  (npc_s), 
		                  .q    (npc_d), 
		                  .clk  (clk), .se(se), .si(), .so());

   assign am_mask = {{17{~fcl_fdp_addr_mask_d}}, 32'hffffffff};


   assign pc_d_adj = pc_d & am_mask;
   assign npc_d_adj = npc_d & am_mask;
   
   assign ifu_exu_pc_d = pc_d_adj[47:0];


   dff_s  #(49)  pce_reg(.din (pc_d_adj), 
		                 .q   (pc_e), 
		                 .clk (clk), .se(se), .si(), .so());
   dff_s  #(49)  npce_reg(.din  (npc_d_adj), 
		                  .q    (npc_e), 
		                  .clk (clk), .se(se), .si(), .so());

   assign fdp_fcl_pc_oor_e = pc_e[48];
   assign ifu_tlu_pc_oor_e = pc_e[48];


   dff_s  #(49)  pcm_reg(.din  (pc_e), 
		                 .q    (pc_m), 
		                 .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcm_reg(.din (npc_e), 
		                  .q   (npc_m), 
		                  .clk (clk), .se(se), .si(), .so());
   assign ifu_tlu_pc_m = pc_m[48:0];
   assign ifu_tlu_npc_m = npc_m[48:0];
   

   dff_s  #(49)  pcw_reg(.din  (pc_m), 
		                 .q    (pc_w), 
		                 .clk  (clk),  .se(se), .si(), .so());
   dff_s  #(49)  npcw_reg(.din (npc_m), 
		                  .q   (npc_w), 
		                  .clk (clk), .se(se), .si(), .so());
   





   assign pcinc_f[1:0] = pc_f[1:0];
   sparc_ifu_incr46 pc_inc(.a     (pc_f[47:2]), 
			                     .a_inc (pcinc_f[47:2]), 
			                     .ofl   ());
   

   assign pcinc_f[48] = ~pc_f[47] & pcinc_f[47] & ~fcl_fdp_mask32b_f | 
                        fcl_fdp_pcoor_f;   


   dp_mux4ds #(49) t0tnpc_mux(.dout (trapnpc0_bf),
			                        .in0  (tlu_ifu_trapnpc_w2),
			                        .in1  (npc_w),
                              .in2  (t0pc_f),
			                        .in3  (t0_trapnpc_f),
			                        .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[0]),
			                        .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[0]),
			                        .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[0]),
			                        .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[0]));
  
`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(49) t1tnpc_mux(.dout (trapnpc1_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t1pc_f),
			    .in3  (t1_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[1]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[1]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[1]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[1]));
   
   dp_mux4ds #(49) t2tnpc_mux(.dout (trapnpc2_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t2pc_f),
			    .in3  (t2_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[2]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[2]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[2]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[2]));
   
   dp_mux4ds #(49) t3tnpc_mux(.dout (trapnpc3_bf),
			    .in0  (tlu_ifu_trapnpc_w2),
			    .in1  (npc_w),
          .in2  (t3pc_f),
			    .in3  (t3_trapnpc_f), 
			    .sel0_l  (fcl_fdp_thrtnpc_sel_tnpc_l[3]),
			    .sel1_l  (fcl_fdp_thrtnpc_sel_npcw_l[3]),
          .sel2_l  (fcl_fdp_thrtnpc_sel_pcf_l[3]),
			    .sel3_l  (fcl_fdp_thrtnpc_sel_old_l[3]));
`endif
   

   dff_s #(49) t0tnpcf_reg(.din  (trapnpc0_bf),
		                   .q    (t0_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign thr_trappc_bf = t0_trapnpc_f;
`else
   dff_s #(49) t1tnpcf_reg(.din  (trapnpc1_bf),
		                   .q    (t1_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(49) t2tnpcf_reg(.din  (trapnpc2_bf),
		                   .q    (t2_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(49) t3tnpcf_reg(.din  (trapnpc3_bf),
		                   .q    (t3_trapnpc_f),
		                   .clk  (clk),  .se(se), .si(), .so());

   dp_mux4ds #(49) nxttpc_mux(.dout (thr_trappc_bf),
			    .in0  (t0_trapnpc_f), 
			    .in1  (t1_trapnpc_f),
			    .in2  (t2_trapnpc_f),
			    .in3  (t3_trapnpc_f),
			    .sel0_l (fcl_fdp_thr_s2_l[0]),
			    .sel1_l (fcl_fdp_thr_s2_l[1]),
			    .sel2_l (fcl_fdp_thr_s2_l[2]),
			    .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif















   
   









   dp_mux2es #(33)  usenir_mux(.dout (inst_s1), 
			                       .in0  (icd_fdp_fetdata_s1[32:0]), 
			                       .in1  (nirdata_s1),
			                       .sel  (fcl_fdp_usenir_sel_nir_s1));



   dp_mux4ds  #(33)  instout_mux(.dout (fdp_inst_s),  
			                         .in0 (icd_fdp_fetdata_s1[32:0]), 
			                         .in1 (inst_s2), 
			                         .in2 ({`NOP, 1'b0}),
			                         .in3 (nirdata_s1[32:0]), 
			                         .sel0_l (fcl_fdp_inst_sel_curr_s_l),
			                         .sel1_l (fcl_fdp_inst_sel_switch_s_l),
			                         .sel2_l (fcl_fdp_inst_sel_nop_s_l),
			                         .sel3_l (fcl_fdp_inst_sel_nir_s_l));

   assign fdp_fcl_swc_s2 = fdp_inst_s[0];

   assign fdp_fcl_op_s = fdp_inst_s[32:31];
   assign fdp_fcl_op3_s = fdp_inst_s[25:22];
   assign fdp_fcl_ibit_s = fdp_inst_s[14];
   
   assign fdp_dtu_inst_s = fdp_inst_s[32:1];





   assign ifu_exu_rs1_s[4] = fdp_inst_s[19] ^ 
			                       (fdp_inst_s[18] & fcl_fdp_oddwin_s);
   assign ifu_exu_rs1_s[3:0] = fdp_inst_s[18:15];
   
   assign ifu_exu_rs2_s[4] = (fdp_inst_s[5] ^ 
			                        (fdp_inst_s[4] & fcl_fdp_oddwin_s));
   assign ifu_exu_rs2_s[3:0] = fdp_inst_s[4:1];

   assign ifu_exu_rs3_s[4] = (fdp_inst_s[30] ^ 
			                        (fdp_inst_s[29] & fcl_fdp_oddwin_s));
   assign ifu_exu_rs3_s[3:0] = fdp_inst_s[29:26];


   dp_buffer #(33) insts1_buf(inst_s1_bf1, inst_s1[32:0]);
		

   dp_mux4ds #(33)  t0inst_mux(.dout (t0inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t0inst_s2),
			     .in3 (rb_inst0_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[0]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[0]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[0]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux4ds #(33)  t1inst_mux(.dout (t1inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t1inst_s2),
			     .in3 (rb_inst1_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[1]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[1]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[1]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[1]));

   dp_mux4ds #(33)  t2inst_mux(.dout (t2inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t2inst_s2),
			     .in3 (rb_inst2_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[2]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[2]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[2]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[2]));

   dp_mux4ds #(33)  t3inst_mux(.dout (t3inst_s1),
			     .in0 (ifq_fdp_fill_inst),  
			     .in1 (inst_s1_bf1), 
			     .in2 (t3inst_s2),
			     .in3 (rb_inst3_s),
			     .sel0_l (fcl_fdp_tinst_sel_ifq_s_l[3]),
			     .sel1_l (fcl_fdp_tinst_sel_curr_s_l[3]),
			     .sel2_l (fcl_fdp_tinst_sel_old_s_l[3]),
			     .sel3_l (fcl_fdp_tinst_sel_rb_s_l[3]));
`endif


   dff_s #(33) t0_inst_reg(.din  (t0inst_s1), 
		                   .q    (t0inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
`ifdef FPGA_SYN_1THREAD
   assign inst_s2 = t0inst_s2;
`else
   dff_s #(33) t1_inst_reg(.din  (t1inst_s1), 
		                   .q    (t1inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(33) t2_inst_reg(.din  (t2inst_s1), 
		                   .q    (t2inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   dff_s #(33) t3_inst_reg(.din  (t3inst_s1), 
		                   .q    (t3inst_s2),
		                   .clk  (clk),  .se(se), .si(), .so());
   


   dp_mux4ds  #(33) swinst_mux(.dout (inst_s2),
			     .in0  (t0inst_s2), 
			     .in1  (t1inst_s2), 
			     .in2  (t2inst_s2), 
			     .in3  (t3inst_s2),
			     .sel0_l (fcl_fdp_thr_s2_l[0]),
			     .sel1_l (fcl_fdp_thr_s2_l[1]),
			     .sel2_l (fcl_fdp_thr_s2_l[2]),
			     .sel3_l (fcl_fdp_thr_s2_l[3]));
`endif


   dff_s #(33) rbinst_d_reg(.din (fdp_inst_s[32:0]),
			                  .q   (inst_d),
			                  .clk (clk),
			                  .se  (se), .si(), .so());
   
   dff_s #(33) rbinst_e_reg(.din (inst_d),
			                  .q   (inst_e),
			                  .clk (clk),
			                  .se  (se), .si(), .so());

   dp_mux2es #(33) rbinst0_mux(.dout (rb_inst0_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[0]));

`ifdef FPGA_SYN_1THREAD
`else
   dp_mux2es #(33) rbinst1_mux(.dout (rb_inst1_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[1]));

   dp_mux2es #(33) rbinst2_mux(.dout (rb_inst2_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[2]));

   dp_mux2es #(33) rbinst3_mux(.dout (rb_inst3_s),
			                       .in0  (inst_d),
			                       .in1  (inst_e),
			                       .sel  (fcl_fdp_rbinst_sel_inste_s[3]));
`endif
























   wire   clk_nir0;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir0(.rclk (rclk),
                              .clk  (clk_nir0),
                              .en_l (fcl_fdp_thr_s1_l[0]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t0nir_reg(.din (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t0nir), 
		                   .en  (~(fcl_fdp_thr_s1_l[0])), .clk(rclk), .se(se), .si(), .so());
`else
   
   dff_s #(33) t0nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t0nir), 
		                   .clk  (clk_nir0), .se(se), .si(), .so());
`endif
   
`ifdef FPGA_SYN_1THREAD
   assign nirdata_s1 = t0nir; 
`else
   wire   clk_nir1;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir1(.rclk (rclk),
                              .clk  (clk_nir1),
                              .en_l (fcl_fdp_thr_s1_l[1]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33)  t1nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t1nir), 
		                   .en (~(fcl_fdp_thr_s1_l[1])), .clk  (rclk), .se(se), .si(), .so());
`else
   dff_s #(33) t1nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t1nir), 
		                   .clk  (clk_nir1), .se(se), .si(), .so());
`endif
   
   wire   clk_nir2;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir2(.rclk (rclk),
                              .clk  (clk_nir2),
                              .en_l (fcl_fdp_thr_s1_l[2]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t2nir_reg(.din  (icd_fdp_topdata_s1[32:0]),
		                   .q    (t2nir), 
		                   .en (~(fcl_fdp_thr_s1_l[2])), .clk  (rclk), .se(se), .si(), .so());
`else
   dff_s #(33) t2nir_reg(.din  (icd_fdp_topdata_s1[32:0]),
		                   .q    (t2nir), 
		                   .clk  (clk_nir2), .se(se), .si(), .so());
`endif
   wire   clk_nir3;
`ifdef FPGA_SYN_CLK_EN
`else
   
   bw_u1_ckenbuf_6x  ckennir3(.rclk (rclk),
                              .clk  (clk_nir3),
                              .en_l (fcl_fdp_thr_s1_l[3]),
                              .tm_l (~se));
`endif
`ifdef FPGA_SYN_CLK_DFF
   dffe_s #(33) t3nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t3nir), 
		                   .en (~(fcl_fdp_thr_s1_l[3])), .clk  (rclk), .se(se), .si(), .so());
`else
   
   dff_s #(33) t3nir_reg(.din  (icd_fdp_topdata_s1[32:0]), 
		                   .q    (t3nir), 
		                   .clk  (clk_nir3), .se(se), .si(), .so());
`endif
   

   dp_mux4ds  #(33) nextnir_mux(.dout (nirdata_s1),
		                          .in0 (t0nir), 
                              .in1 (t1nir), 
                              .in2 (t2nir), 
                              .in3 (t3nir),
		                          .sel0_l (fcl_fdp_nirthr_s1_l[0]),
		                          .sel1_l (fcl_fdp_nirthr_s1_l[1]),
		                          .sel2_l (fcl_fdp_nirthr_s1_l[2]),
		                          .sel3_l (fcl_fdp_nirthr_s1_l[3]));
`endif





endmodule