// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: lib.v
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
//*************************************************************************
// Description : This is a collection of library elements from big_mac,
// xmac, xpcs, pcs ... etc.
// Copyright (c) 2008, Sun Microsystems, Inc.
// Sun Proprietary and Confidential
//*************************************************************************
/* -----------------------------------------------------------------------
* If the 10 bit data stream is i,i,i,....,i,i,a,b,c,d,e,f,g,
* the 20 bit interface can be one of the two:
* 1. {a,i} -> {c,b} -> {e,d} -> {g,f}
* 2. {b,a} -> {d,c} -> {f,e} -> {h,g}
* The a,b,c,d,e,f,g order remains the same between the above two data
* -----------------------------------------------------------------------
CtsRoot clk_CtsRoot (.Z(clk),.A(clk20b));
RegDff #(10) din10b_hi_10to20_RegDff (.din(din10b), .clk(clk10b),.qout(din10b_hi));
RegDff #(10) din10b_lo_10to20_RegDff (.din(din10b_hi),.clk(clk10b),.qout(din10b_lo));
RegDff #(20) dout20b_10to20_RegDff (.din({din10b_hi[9:0],din10b_lo[9:0]}),.clk(clk),.qout(dout20b[19:0]));
CtsRoot clk_CtsRoot (.Z(clk),.A(clk20b));
RegDff #(20) din_20to10_RegDff (.din(din20b[19:0]),.clk(clk),.qout(din20b_reg[19:0]));
// SYNC RULE 3 of LV requirements to intercept offending path in LV_TM mode.
assign clk_FUNC_MODE = clk | (~FUNC_MODE);
assign ddr_out = clk_FUNC_MODE ? din20b_reg[9:0] : din20b_reg[19:10];
RegDff #(10) dout10b_20to10_RegDff (.din(ddr_out[9:0]),.clk(clk10b),.qout(dout10b[9:0]));
// digitally delay 4 clk.
reg dly1,dly2,dly3,dly4,dly5,dly6,dly7,dly8;
SYNC_CELL hw_reset_clk_SYNC_CELL(.D(reset),.CP(clk),.Q(hw_reset_clk));
pls_gen hw_reset_clk_lead_pls_gen (.clk(clk),.in(hw_reset_clk),.out(hw_reset_clk_lead));
SYNC_CELL hw_reset_clk_SYNC_CELL(.D(reset),.CP(clk),.Q(hw_reset_clk));
pls_gen hw_reset_clk_lead_pls_gen (.clk(clk),.in(hw_reset_clk),.out(hw_reset_clk_lead));
TFF clk2_TFF (.toggle(1'b1),
.reset(hw_reset_clk_lead),
/***********************************
***********************************/
module Counter (reset,clk,ce,count);
output [dwidth-1:0] count;
casex(ce) // synopsys parallel_case full_case
1'b1: count <= count + 1;
//*****************************
//*****************************
module SRFF (reset,clk,iSet,iRst,oQ);
input reset, clk, iSet, iRst;
casex({iSet, iRst}) // synopsys parallel_case full_case
endmodule // end of Set Reset Flip Flop
//*****************************
//*****************************
module RSFF (reset,clk,iSet,iRst,oQ);
input reset, clk, iSet, iRst;
casex({iSet, iRst}) // synopsys parallel_case full_case
endmodule // end of Reset Set Flip Flop
//*****************************
//*****************************
module xREG (clk,reset,en,din,qout);
output [dwidth-1:0] qout;
//*****************************
//*****************************
module xREG2 (clk,reset,reset_value,load,din,qout);
input [dwidth-1:0] reset_value;
output [dwidth-1:0] qout;
endmodule // end of xREG2
//*****************************
//*****************************
module xREG3 (clk,reset,rst,en,din,qout);
input clk, en, reset, rst;
output [dwidth-1:0] qout;
endmodule // end of xREG3
/************************************
*************************************/
module PlsGen (reset,clk,iSigIn,oPlsOut);
input reset, clk, iSigIn;
wire oPlsOut = iSigIn & Qb;
//*******************************
// High Speed Loadable Counter
//*******************************
module hs_cntr_cell_X16 (
clk, reset, cnt, clr, load, load_value
assign toggle[15] = Q[14] & Q[13] & Q[12] & Q[11] & Q[10] & Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[14] = Q[13] & Q[12] & Q[11] & Q[10] & Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[13] = Q[12] & Q[11] & Q[10] & Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[12] = Q[11] & Q[10] & Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[11] = Q[10] & Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[10] = Q[9] & Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[9] = Q[8] & Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[8] = Q[7] & Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[7] = Q[6] & Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[6] = Q[5] & Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[5] = Q[4] & Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[4] = Q[3] & Q[2] & Q[1] & Q[0] ;
assign toggle[3] = Q[2] & Q[1] & Q[0] ;
assign toggle[2] = Q[1] & Q[0] ;
assign toggle[1] = Q[0] ;
Q[15] <= toggle[15] ? ~Q[15] : Q[15];
Q[14] <= toggle[14] ? ~Q[14] : Q[14];
Q[13] <= toggle[13] ? ~Q[13] : Q[13];
Q[12] <= toggle[12] ? ~Q[12] : Q[12];
Q[11] <= toggle[11] ? ~Q[11] : Q[11];
Q[10] <= toggle[10] ? ~Q[10] : Q[10];
Q[9] <= toggle[9] ? ~Q[9] : Q[9] ;
Q[8] <= toggle[8] ? ~Q[8] : Q[8] ;
Q[7] <= toggle[7] ? ~Q[7] : Q[7] ;
Q[6] <= toggle[6] ? ~Q[6] : Q[6] ;
Q[5] <= toggle[5] ? ~Q[5] : Q[5] ;
Q[4] <= toggle[4] ? ~Q[4] : Q[4] ;
Q[3] <= toggle[3] ? ~Q[3] : Q[3] ;
Q[2] <= toggle[2] ? ~Q[2] : Q[2] ;
Q[1] <= toggle[1] ? ~Q[1] : Q[1] ;
Q <= Q; // Hold the value.
endmodule // hs_cntr_cell_X16
//*******************************
// High Speed Loadable Counter
//*******************************
module hs_ld_counter_X32 (
clk, reset, inc, clr, max_value, load, load_value
input reset; // global signals
input inc; // Count Enable
input clr; // read auto clear input.
input [31:0] max_value; // compared value
input [31:0] load_value; // compared value
output max_value_reached;
wire [31:0] Q = {Q1[15:0],Q0[15:0]};
wire max_value_reached = (max_value[31:0] == Q[31:0]);
wire inc_count = ~max_value_reached & inc;
assign set_flag = (Q0[15:0] == 16'hFFFE) & inc_count;
SR_FF flag_count_SR_FF(.set(set_flag),
.reset(reset | clr), // loj @6-16-06
// flag_lv = (Q0 == 16'hFFFF)
assign inc_msb = flag_lv & inc_count;
/* ----- counter instantiation ----- */
hs_cntr_cell_X16 lsb_hs_cntr_cell_X16(
.load_value(load_value[15:0]),
hs_cntr_cell_X16 msb_hs_cntr_cell_X16(
.load_value(load_value[31:16]),
endmodule // hs_ld_counter_X31
//*****************************
//*****************************
module RAC_FF (clk,reset,set,rst,
input clk,reset ; // global signals
input load_data ; // compared value
// \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
/**********************************************************************
* From here on are mainly for mac and xmac design
* ********************************************************************/
/* ------------------------------ Flip-Flops ------------------------------- */
always @(posedge CP) Q <= D;
// vlint flag_negedge_always_block off
always @(negedge CP) Q <= D;
// vlint flag_negedge_always_block on
/* ----------------------- Synchronizers ----------------------------- */
/******************************************
* The following SYNC_CELLs are used by mac
******************************************/
module SYNC_CELL(D,CP,Q);
// vlint flag_dangling_net_within_module off
// vlint flag_net_has_no_load off
// vlint flag_net_has_no_load on
// vlint flag_dangling_net_within_module on
cl_a1_clksyncff_4x SYNC_CELL (.l1clk(CP),
module FAST_SYNC_CELL(D,CP,Q);
// vlint flag_negedge_always_block off
always @ (negedge CP) // Negative edge clock
// vlint flag_negedge_always_block on
endmodule // FAST_SYNC_CELL
module FAST_INV_SYNC_CELL(D,CP,Q);
// vlint flag_negedge_always_block off
// vlint flag_negedge_always_block on
endmodule // FAST_INV_SYNC_CELL
//*****************************
//*****************************
module SYNC_PLS (src_pls,src_clk,src_reset,des_clk,out_pls);
input src_reset; // power on reset
wire sr_ff_2_sync_cell,src_rst_internal,des_level_out;
SR_FF SR_FF_u1(.set(src_pls),
.qout(sr_ff_2_sync_cell));
SYNC_CELL go_to_des_SYNC_CELL (.D(sr_ff_2_sync_cell),.CP(des_clk),
SYNC_CELL back_to_src_SYNC_CELL(.D(des_level_out),.CP(src_clk),
pls_gen pls_gen_u6(.clk(des_clk),.in(des_level_out),.out(out_pls));
/******************************************
* The following SYNC_CELLs are used by pcs
******************************************/
** NEC library dependent wrapper for SYNC generic
module SYNCREG (qout, clk, din);
//non-resettable variable width register
SYNC_CELL PCS_SYNC_CELL(.D(din),.CP(clk),.Q(qout));
module SYNCREG16 (qout, clk, din);
//non-resettable variable width register
SYNCREG R_SYNC_0(.din(din[0]), .clk(clk), .qout(qout[0]));
SYNCREG R_SYNC_1(.din(din[1]), .clk(clk), .qout(qout[1]));
SYNCREG R_SYNC_2(.din(din[2]), .clk(clk), .qout(qout[2]));
SYNCREG R_SYNC_3(.din(din[3]), .clk(clk), .qout(qout[3]));
SYNCREG R_SYNC_4(.din(din[4]), .clk(clk), .qout(qout[4]));
SYNCREG R_SYNC_5(.din(din[5]), .clk(clk), .qout(qout[5]));
SYNCREG R_SYNC_6(.din(din[6]), .clk(clk), .qout(qout[6]));
SYNCREG R_SYNC_7(.din(din[7]), .clk(clk), .qout(qout[7]));
SYNCREG R_SYNC_8(.din(din[8]), .clk(clk), .qout(qout[8]));
SYNCREG R_SYNC_9(.din(din[9]), .clk(clk), .qout(qout[9]));
SYNCREG R_SYNC_10(.din(din[10]), .clk(clk), .qout(qout[10]));
SYNCREG R_SYNC_11(.din(din[11]), .clk(clk), .qout(qout[11]));
SYNCREG R_SYNC_12(.din(din[12]), .clk(clk), .qout(qout[12]));
SYNCREG R_SYNC_13(.din(din[13]), .clk(clk), .qout(qout[13]));
SYNCREG R_SYNC_14(.din(din[14]), .clk(clk), .qout(qout[14]));
SYNCREG R_SYNC_15(.din(din[15]), .clk(clk), .qout(qout[15]));
// @(#)SYNCREG17.v 1.2 06/07/99
module SYNCREG17 (qout, clk, din);
//non-resettable variable width register
SYNCREG R_SYNC_0(.din(din[0]), .clk(clk), .qout(qout[0]));
SYNCREG R_SYNC_1(.din(din[1]), .clk(clk), .qout(qout[1]));
SYNCREG R_SYNC_2(.din(din[2]), .clk(clk), .qout(qout[2]));
SYNCREG R_SYNC_3(.din(din[3]), .clk(clk), .qout(qout[3]));
SYNCREG R_SYNC_4(.din(din[4]), .clk(clk), .qout(qout[4]));
SYNCREG R_SYNC_5(.din(din[5]), .clk(clk), .qout(qout[5]));
SYNCREG R_SYNC_6(.din(din[6]), .clk(clk), .qout(qout[6]));
SYNCREG R_SYNC_7(.din(din[7]), .clk(clk), .qout(qout[7]));
SYNCREG R_SYNC_8(.din(din[8]), .clk(clk), .qout(qout[8]));
SYNCREG R_SYNC_9(.din(din[9]), .clk(clk), .qout(qout[9]));
SYNCREG R_SYNC_10(.din(din[10]), .clk(clk), .qout(qout[10]));
SYNCREG R_SYNC_11(.din(din[11]), .clk(clk), .qout(qout[11]));
SYNCREG R_SYNC_12(.din(din[12]), .clk(clk), .qout(qout[12]));
SYNCREG R_SYNC_13(.din(din[13]), .clk(clk), .qout(qout[13]));
SYNCREG R_SYNC_14(.din(din[14]), .clk(clk), .qout(qout[14]));
SYNCREG R_SYNC_15(.din(din[15]), .clk(clk), .qout(qout[15]));
SYNCREG R_SYNC_16(.din(din[16]), .clk(clk), .qout(qout[16]));
// @(#)SYNCREG22.v 1.2 06/07/99
module SYNCREG22 (qout, clk, din);
//non-resettable variable width register
SYNCREG R_SYNC_0(.din(din[0]), .clk(clk), .qout(qout[0]));
SYNCREG R_SYNC_1(.din(din[1]), .clk(clk), .qout(qout[1]));
SYNCREG R_SYNC_2(.din(din[2]), .clk(clk), .qout(qout[2]));
SYNCREG R_SYNC_3(.din(din[3]), .clk(clk), .qout(qout[3]));
SYNCREG R_SYNC_4(.din(din[4]), .clk(clk), .qout(qout[4]));
SYNCREG R_SYNC_5(.din(din[5]), .clk(clk), .qout(qout[5]));
SYNCREG R_SYNC_6(.din(din[6]), .clk(clk), .qout(qout[6]));
SYNCREG R_SYNC_7(.din(din[7]), .clk(clk), .qout(qout[7]));
SYNCREG R_SYNC_8(.din(din[8]), .clk(clk), .qout(qout[8]));
SYNCREG R_SYNC_9(.din(din[9]), .clk(clk), .qout(qout[9]));
SYNCREG R_SYNC_10(.din(din[10]), .clk(clk), .qout(qout[10]));
SYNCREG R_SYNC_11(.din(din[11]), .clk(clk), .qout(qout[11]));
SYNCREG R_SYNC_12(.din(din[12]), .clk(clk), .qout(qout[12]));
SYNCREG R_SYNC_13(.din(din[13]), .clk(clk), .qout(qout[13]));
SYNCREG R_SYNC_14(.din(din[14]), .clk(clk), .qout(qout[14]));
SYNCREG R_SYNC_15(.din(din[15]), .clk(clk), .qout(qout[15]));
SYNCREG R_SYNC_16(.din(din[16]), .clk(clk), .qout(qout[16]));
SYNCREG R_SYNC_17(.din(din[17]), .clk(clk), .qout(qout[17]));
SYNCREG R_SYNC_18(.din(din[18]), .clk(clk), .qout(qout[18]));
SYNCREG R_SYNC_19(.din(din[19]), .clk(clk), .qout(qout[19]));
SYNCREG R_SYNC_20(.din(din[20]), .clk(clk), .qout(qout[20]));
SYNCREG R_SYNC_21(.din(din[21]), .clk(clk), .qout(qout[21]));
// @(#)SYNCREG6.v 1.2 06/07/99
module SYNCREG6 (qout, clk, din);
//non-resettable variable width register
SYNCREG R_SYNC_0(.din(din[0]), .clk(clk), .qout(qout[0]));
SYNCREG R_SYNC_1(.din(din[1]), .clk(clk), .qout(qout[1]));
SYNCREG R_SYNC_2(.din(din[2]), .clk(clk), .qout(qout[2]));
SYNCREG R_SYNC_3(.din(din[3]), .clk(clk), .qout(qout[3]));
SYNCREG R_SYNC_4(.din(din[4]), .clk(clk), .qout(qout[4]));
SYNCREG R_SYNC_5(.din(din[5]), .clk(clk), .qout(qout[5]));
/* -----------------end of Synchronizers ----------------------------- */
/* ------------------------- Registers ------------------------------- */
module register_X8(clk,din,dout);
module register_X8_inv(clk,din,dout);
endmodule // register_X8_inv
module register_X10(clk,din,dout);
endmodule // register_X10
module register_X14(clk,din,dout);
module register_X15(clk,din,dout);
module register_X16(clk,din,dout);
endmodule // register_X16
module register_X17(clk,din,dout);
endmodule // register_X17
module register_X32(clk,din,dout,dout_n);
endmodule // register_X32
module register_load_X4(clk,load,din,dout);
module register_load_X8(clk,load,din,dout);
endmodule // register_load_X8
module register_load_X10(clk,load,din,dout);
endmodule // register_load_X10
module register_load_X14(clk,load,din,dout);
endmodule // register_load_X14
module register_load_X15(clk,load,din,dout);
endmodule // register_load_X15
module register_load_X16(clk,load,din,dout);
endmodule // register_load_X16
module register_load_X17(clk,load,din,dout);
endmodule // register_load_X17
module register_load_X64(clk,load,din,dout);
module register_load_X66(clk,load,din,dout);
endmodule // register_load_X66
/* ------------------------------- Pipelines ------------------------------- */
module pipeline_4X8(clk,din,dout);
wire [7:0] stage0_dout,stage1_dout,stage2_dout;
register_X8 STAGE0(clk,din,stage0_dout);
register_X8 STAGE1(clk,stage0_dout,stage1_dout);
register_X8 STAGE2(clk,stage1_dout,stage2_dout);
register_X8 STAGE3(clk,stage2_dout,dout);
module bit_shifter_en_ld_X32(reset,clk,ld_en,shift_en,shift_in,din,shift_out,dout);
assign shift_out = dout[31];
endmodule // bit_shifter_en_ld_X32
module nibble_shifter_X16(clk,din,dout);
FD1 FD1_0(.D(din[0]),.CP(clk),.Q(dout[0]));
FD1 FD1_1(.D(din[1]),.CP(clk),.Q(dout[1]));
FD1 FD1_2(.D(din[2]),.CP(clk),.Q(dout[2]));
FD1 FD1_3(.D(din[3]),.CP(clk),.Q(dout[3]));
FD1 FD1_4(.D(dout[0]),.CP(clk),.Q(dout[4]));
FD1 FD1_5(.D(dout[1]),.CP(clk),.Q(dout[5]));
FD1 FD1_6(.D(dout[2]),.CP(clk),.Q(dout[6]));
FD1 FD1_7(.D(dout[3]),.CP(clk),.Q(dout[7]));
FD1 FD1_8(.D(dout[4]),.CP(clk),.Q(dout[8]));
FD1 FD1_9(.D(dout[5]),.CP(clk),.Q(dout[9]));
FD1 FD1_10(.D(dout[6]),.CP(clk),.Q(dout[10]));
FD1 FD1_11(.D(dout[7]),.CP(clk),.Q(dout[11]));
FD1 FD1_12(.D(dout[8]),.CP(clk),.Q(dout[12]));
FD1 FD1_13(.D(dout[9]),.CP(clk),.Q(dout[13]));
FD1 FD1_14(.D(dout[10]),.CP(clk),.Q(dout[14]));
FD1 FD1_15(.D(dout[11]),.CP(clk),.Q(dout[15]));
endmodule // nibble_shifter_X16
module byte_shifter_X16(clk,din,dout); // for fedx
wire [7:0] stage0_dout,stage1_dout;
register_X8 STAGE0(clk,din,stage0_dout);
register_X8 STAGE1(clk,stage0_dout,stage1_dout);
assign dout = {stage0_dout,stage1_dout};
endmodule // byte_shifter_X16
module byte_shifter_X64(clk,din,dout); // for cassini
wire [7:0] stage0_dout,stage1_dout,stage2_dout,stage3_dout,
stage4_dout,stage5_dout,stage6_dout,stage7_dout;
register_X8 STAGE0(clk,din,stage0_dout);
register_X8 STAGE1(clk,stage0_dout,stage1_dout);
register_X8 STAGE2(clk,stage1_dout,stage2_dout);
register_X8 STAGE3(clk,stage2_dout,stage3_dout);
register_X8 STAGE4(clk,stage3_dout,stage4_dout);
register_X8 STAGE5(clk,stage4_dout,stage5_dout);
register_X8 STAGE6(clk,stage5_dout,stage6_dout);
register_X8 STAGE7(clk,stage6_dout,stage7_dout);
assign dout = {stage0_dout,stage1_dout,stage2_dout,stage3_dout,
stage4_dout,stage5_dout,stage6_dout,stage7_dout
/* -------------------------------- Counters ------------------------------- */
module counter_X2(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X3(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X4(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X5(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X6(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X8(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X10(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X12(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X14(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X15(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_X16(clk,clr,enable,count);
else if (enable) count <= count + 1;
module counter_load_X8(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X8
module counter_rac_load_X8(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {8{1'b1}}))
endmodule // counter_rac_load_X8
module counter_load_X10(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X10
module counter_ld_dn_X15(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count - 1;
endmodule // counter_ld_dn_X15
module counter_load_X16(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X16
module counter_rac_load_X16(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {16{1'b1}}))
endmodule // counter_rac_load_X16
module counter_load_X17(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X17
module counter_rac_load_X17(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {17{1'b1}}))
endmodule // counter_rac_load_X17
module counter_load_X18(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X18
module counter_rac_load_X18(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {18{1'b1}}))
endmodule // counter_rac_load_X18
module counter_load_X19(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X19
module counter_rac_load_X19(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {19{1'b1}}))
endmodule // counter_rac_load_X19
module counter_rac_load_X20(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {20{1'b1}}))
endmodule // counter_rac_load_X20
module counter_load_X21(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X21
module counter_rac_load_X21(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {21{1'b1}}))
endmodule // counter_rac_load_X21
module counter_load_X24(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X24
module counter_rac_load_X24(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {24{1'b1}}))
endmodule // counter_rac_load_X24
module counter_load_X27(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count + 1;
endmodule // counter_load_X27
module counter_rac_load_X27(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable & (count != {27{1'b1}}))
endmodule // counter_rac_load_X27
/* ------------------------------------------------------------------------- */
module counter_ld_dn_X16(clk,clr,enable,load,din,count);
else if (load) count <= din;
else if (enable) count <= count - 1;
endmodule // counter_ld_dn_X16
module inc_1_2_3_4(clk,clr,inc1,inc2,inc3,inc4,count);
function [2:0] counter_logic;
if (clr) new_count = 3'h0;
case ({inc1,inc2,inc3,inc4}) // synopsys parallel_case full_case
4'h1: new_count = count + 3'h1;
4'h2: new_count = count + 3'h1;
4'h3: new_count = count + 3'h2;
4'h4: new_count = count + 3'h1;
4'h5: new_count = count + 3'h2;
4'h6: new_count = count + 3'h2;
4'h7: new_count = count + 3'h3;
4'h8: new_count = count + 3'h1;
4'h9: new_count = count + 3'h2;
4'hA: new_count = count + 3'h2;
4'hB: new_count = count + 3'h3;
4'hC: new_count = count + 3'h2;
4'hD: new_count = count + 3'h3;
4'hE: new_count = count + 3'h3;
4'hF: new_count = count + 3'h4;
counter_logic = new_count;
assign new_count = counter_logic(clr,inc1,inc2,inc3,inc4,count);
RegDff #(3) inc_1_2_3_4_RegDff(.din(new_count),.clk(clk),.qout(count));
module inc_1_2_3_4_5_6_7_8(clk,clr,inc1,inc2,inc3,inc4,inc5,inc6,inc7,inc8,count);
function [2:0] counter_logic_1;
case ({inc1,inc2,inc3,inc4}) // synopsys parallel_case full_case
4'h0: add_count_1 = 3'h0;
4'h1: add_count_1 = 3'h1;
4'h2: add_count_1 = 3'h1;
4'h3: add_count_1 = 3'h2;
4'h4: add_count_1 = 3'h1;
4'h5: add_count_1 = 3'h2;
4'h6: add_count_1 = 3'h2;
4'h7: add_count_1 = 3'h3;
4'h8: add_count_1 = 3'h1;
4'h9: add_count_1 = 3'h2;
4'hA: add_count_1 = 3'h2;
4'hB: add_count_1 = 3'h3;
4'hC: add_count_1 = 3'h2;
4'hD: add_count_1 = 3'h3;
4'hE: add_count_1 = 3'h3;
4'hF: add_count_1 = 3'h4;
counter_logic_1 = add_count_1;
assign add_count_1 = counter_logic_1(inc1,inc2,inc3,inc4);
function [2:0] counter_logic_2;
case ({inc5,inc6,inc7,inc8}) // synopsys parallel_case full_case
4'h0: add_count_2 = 3'h0;
4'h1: add_count_2 = 3'h1;
4'h2: add_count_2 = 3'h1;
4'h3: add_count_2 = 3'h2;
4'h4: add_count_2 = 3'h1;
4'h5: add_count_2 = 3'h2;
4'h6: add_count_2 = 3'h2;
4'h7: add_count_2 = 3'h3;
4'h8: add_count_2 = 3'h1;
4'h9: add_count_2 = 3'h2;
4'hA: add_count_2 = 3'h2;
4'hB: add_count_2 = 3'h3;
4'hC: add_count_2 = 3'h2;
4'hD: add_count_2 = 3'h3;
4'hE: add_count_2 = 3'h3;
4'hF: add_count_2 = 3'h4;
counter_logic_2 = add_count_2;
assign add_count_2 = counter_logic_2(inc5,inc6,inc7,inc8);
function [2:0] counter_logic_3;
if (clr) new_count = 3'h0;
else new_count = count + add_count_1 + add_count_2;
counter_logic_3 = new_count;
assign new_count = counter_logic_3(clr,add_count_1,add_count_2,count);
RegDff #(3) inc_1_2_3_4_5_6_7_8_RegDff(.din(new_count),.clk(clk),.qout(count));
endmodule // inc_1_2_3_4_5_6_7_8
module counter_udh_X3(clk,clr,enable_up,enable_down,count);
else if (enable_up & !enable_down & (count != 3'h7))
else if (!enable_up & enable_down & (count != 3'h0))
endmodule // counter_udh_X3
module inc_1_16(clk,clr,inc1,inc2,inc3,inc4,inc5,inc6,inc7,inc8,inc9,inc10,inc11,
inc12,inc13,inc14,inc15,inc16,count);
function [2:0] encoder_1;
case ({inc1,inc2,inc3,inc4}) // synopsys parallel_case full_case
assign count_1 = encoder_1(inc1,inc2,inc3,inc4);
function [2:0] encoder_2;
case ({inc5,inc6,inc7,inc8}) // synopsys parallel_case full_case
assign count_2 = encoder_2(inc5,inc6,inc7,inc8);
function [2:0] encoder_3;
case ({inc9,inc10,inc11,inc12}) // synopsys parallel_case full_case
assign count_3 = encoder_3(inc9,inc10,inc11,inc12);
function [2:0] encoder_4;
case ({inc13,inc14,inc15,inc16}) // synopsys parallel_case full_case
assign count_4 = encoder_4(inc13,inc14,inc15,inc16);
assign add_1 = {1'b0,count_1} + {1'b0,count_2};
assign add_2 = {1'b0,count_3} + {1'b0,count_4};
assign add_3 = add_1 + add_2;
assign new_count = clr ? 4'h0 : (count + add_3);
RegDff #(4) inc_1_16_RegDff(.din(new_count),.clk(clk),.qout(count));
module counter_udh_X4(clk,clr,enable_up,enable_down,count);
else if (enable_up & !enable_down & (count != 4'hF))
else if (!enable_up & enable_down & (count != 4'h0))
endmodule // counter_udh_X4
module inc_1_2_dec_1(clk,clr,inc1,inc2,dec,count);
function [1:0] counter_logic;
if (clr) new_count = 2'h0;
case ({inc1,inc2,dec}) // synopsys parallel_case full_case
3'h1: new_count = count - 2'h1;
3'h2: new_count = count + 2'h1;
3'h4: new_count = count + 2'h1;
3'h6: new_count = count + 2'h2;
3'h7: new_count = count + 2'h1;
counter_logic = new_count;
assign new_count = counter_logic(clr,inc1,inc2,dec,count);
FD1 FD1_0(.D(new_count[0]),.CP(clk),.Q(count[0]));
FD1 FD1_1(.D(new_count[1]),.CP(clk),.Q(count[1]));
endmodule // inc_1_2_dec_1
/* ------------- ---------- Muxes --------------------------------- */
module xMUX_2to1 (din0,din1,sel,dout);
// variable width row of 2 to 1 muxes; active high output
output [dwidth-1:0] dout;
always @ (sel or din0 or din1)
case (sel) // synopsys parallel_case full_case
endmodule // end of xMUX_2to1
module xMUX_3to1(dout,sel,din0,din1,din2);
// variable width row of 3 to 1 muxes; active high output
output [dwidth-1:0] dout;
always @ (sel or din0 or din1 or din2)
case (sel) // synopsys parallel_case full_case
module xMUX_4to1 (din0,din1,din2,din3,sel,dout);
// variable width row of 4 to 1 muxes; active high output
output [dwidth-1:0] dout;
always @ (sel or din0 or din1 or din2 or din3)
case (sel) // synopsys parallel_case full_case
module xMUX_6to1 (dout,sel,din0,din1,din2,din3,din4,din5);
// variable width row of 6 to 1 muxes; active high output
output [dwidth-1:0] dout;
always @ (sel or din0 or din1 or din2 or din3 or din4 or din5)
case (sel) // synopsys parallel_case full_case
module func_mux1(dout, select, din1, din0);
always @ (select or din1 or din0)
case (select) // synopsys parallel_case full_case infer_mux
// wire dout = select ? din1 : din0;
// sel0 is negative signal so the din1 and din0 are swapped.
cl_a1_clk_mux2_8x n2_FUNC_MUX (
module lv_mux1(dout, select, din1, din0);
always @ (select or din1 or din0)
case (select) // synopsys parallel_case full_case infer_mux
// wire dout = select ? din1 : din0;
// sel0 is negative signal so the din1 and din0 are swapped.
cl_a1_clk_mux2_8x n2_LV_MUX (
module mux_2_1_X1(dout, select, din1, din0);
always @ (select or din1 or din0)
case (select) // synopsys parallel_case full_case
module mux_2_1_X2(dout, select, din1, din0);
always @ (select or din1 or din0)
case (select) // synopsys parallel_case full_case
module mux_2_1_X4(dout, select, din1, din0);
always @ (select or din1 or din0)
case (select) // synopsys parallel_case full_case
module mux_821_X16(din0,din1,din2,din3,din4,din5,din6,din7,select,dout);
input [15:0] din0,din1,din2,din3,din4,din5,din6,din7;
wire [15:0] din0,din1,din2,din3,din4,din5,din6,din7;
always @ (/*AUTOSENSE*/din0 or din1 or din2 or din3 or din4 or din5
or din6 or din7 or select)
case (select) // synopsys parallel_case full_case
module mux_821_X17(din0,din1,din2,din3,din4,din5,din6,din7,select,dout);
input [16:0] din0,din1,din2,din3,din4,din5,din6,din7;
wire [16:0] din0,din1,din2,din3,din4,din5,din6,din7;
always @ (/*AUTOSENSE*/din0 or din1 or din2 or din3 or din4 or din5
or din6 or din7 or select)
case (select) // synopsys parallel_case full_case
module mux_421_X64(din0,din1,din2,din3,select,dout);
input [63:0] din0,din1,din2,din3;
wire [63:0] din0,din1,din2,din3;
always @ (/*AUTOSENSE*/din0 or din1 or din2 or din3 or select)
case (select) // synopsys parallel_case full_case
module mux_821_X64(din0,din1,din2,din3,din4,din5,din6,din7,select,dout);
input [63:0] din0,din1,din2,din3,din4,din5,din6,din7;
wire [63:0] din0,din1,din2,din3,din4,din5,din6,din7;
always @ (/*AUTOSENSE*/din0 or din1 or din2 or din3 or din4 or din5
or din6 or din7 or select)
case (select) // synopsys parallel_case full_case
module mux_1621_X65(din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,
din11,din12,din13,din14,din15,select,dout);
input [64:0] din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,din11,
wire [64:0] din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,din11,
always @ (/*AUTOSENSE*/din0 or din1 or din10 or din11 or din12
or din13 or din14 or din15 or din2 or din3 or din4 or din5
or din6 or din7 or din8 or din9 or select)
case (select) // synopsys parallel_case full_case
endmodule // mux_1621_X65
module mux_1621_X66(din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,
din11,din12,din13,din14,din15,select,dout);
input [65:0] din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,din11,
wire [65:0] din0,din1,din2,din3,din4,din5,din6,din7,din8,din9,din10,din11,
always @ (/*AUTOSENSE*/din0 or din1 or din10 or din11 or din12
or din13 or din14 or din15 or din2 or din3 or din4 or din5
or din6 or din7 or din8 or din9 or select)
case (select) // synopsys parallel_case full_case
endmodule // mux_1621_X65
/* ------ end of big_mac stuff --------------------------------------- */
module RS_FF (set,rst,clk,reset,qout);
2'b00: qout <= qout;// hold
module SR_FF (set,rst,clk,reset,qout);
2'b00: qout <= qout;// hold
module TFF (toggle,clk,reset,qout);
1'b0: qout <= qout; // hold
1'b1: qout <= ~qout;// toggle
//*****************************
//* Leading Edge Digital Pulse Generator
//*****************************
module pls_gen (clk,in,out);
//*****************************
//* Trailing Edge Digital Pulse Generator
//*****************************
module pls_gen_trail (clk,in,out);
/***********************************
* *********************************/
module RegDff (din,clk,qout);
output [dwidth-1:0] qout;
/***********************************
* *********************************/
module RegDffWithMux (din0,din1,sel,clk,qout);
output [dwidth-1:0] qout;
xMUX_2to1 #(dwidth) dout_xMUX_2to1(.din0(din0),
RegDff #(dwidth) qout_RegDff(.din(dout),.clk(clk),.qout(qout));
endmodule // RegDffWithMux
/*****************************
*****************************/
module RegRst (clk,reset,din,qout);
output [dwidth-1:0] qout;
/*****************************
*****************************/
module RegRst2 (clk,reset,reset_value,din,qout);
input [dwidth-1:0] reset_value;
output [dwidth-1:0] qout;
module PlsGen2 (sig_in,clk,lead,trail);
wire sig_in, sig_out,lead,trail;
FD1 sig_out_FD1(.D(sig_in),.CP(clk),.Q(sig_out));
assign lead = sig_in & ~sig_out;
assign trail= ~sig_in & sig_out;
/* ---------- start of 5bit domain ----------------------------------- */
module g_cntr_5bit (reset,clk,ce,g_cnt);
-message "(* 0in test 5bit gray_code counter *)"
wire [4:0] g_cnt; // current state
reg [4:0] nx_g_cnt; // next state
parameter g_ZERO = 5'b0_0000,
g_FIFTEEN = 5'b0_1000, // reflection
g_SIXTEEN = 5'b1_1000, // reflection
g_TWENTY_ONE = 5'b1_1111,
g_TWENTY_TWO = 5'b1_1101,
g_TWENTY_THREE = 5'b1_1100,
g_TWENTY_FOUR = 5'b1_0100,
g_TWENTY_FIVE = 5'b1_0101,
g_TWENTY_SIX = 5'b1_0111,
g_TWENTY_SEVEN = 5'b1_0110,
g_TWENTY_EIGHT = 5'b1_0010,
g_TWENTY_NINE = 5'b1_0011,
g_THIRTY_ONE = 5'b1_0000;
case(g_cnt) // synopsys parallel_case full_case
g_ZERO : nx_g_cnt = g_ONE;
g_ONE : nx_g_cnt = g_TWO;
g_TWO : nx_g_cnt = g_THREE;
g_THREE : nx_g_cnt = g_FOUR;
g_FOUR : nx_g_cnt = g_FIVE;
g_FIVE : nx_g_cnt = g_SIX;
g_SIX : nx_g_cnt = g_SEVEN;
g_SEVEN : nx_g_cnt = g_EIGHT;
g_EIGHT : nx_g_cnt = g_NINE;
g_NINE : nx_g_cnt = g_TEN;
g_TEN : nx_g_cnt = g_ELEVEN;
g_ELEVEN : nx_g_cnt = g_TWELVE;
g_TWELVE : nx_g_cnt = g_THIRTEEN;
g_THIRTEEN : nx_g_cnt = g_FORTEEN;
g_FORTEEN : nx_g_cnt = g_FIFTEEN;
g_FIFTEEN : nx_g_cnt = g_SIXTEEN;
g_SIXTEEN : nx_g_cnt = g_SEVENTEEN;
g_SEVENTEEN : nx_g_cnt = g_EIGHTEEN;
g_EIGHTEEN : nx_g_cnt = g_NINETEEN;
g_NINETEEN : nx_g_cnt = g_TWENTY;
g_TWENTY : nx_g_cnt = g_TWENTY_ONE;
g_TWENTY_ONE : nx_g_cnt = g_TWENTY_TWO;
g_TWENTY_TWO : nx_g_cnt = g_TWENTY_THREE;
g_TWENTY_THREE : nx_g_cnt = g_TWENTY_FOUR;
g_TWENTY_FOUR : nx_g_cnt = g_TWENTY_FIVE;
g_TWENTY_FIVE : nx_g_cnt = g_TWENTY_SIX;
g_TWENTY_SIX : nx_g_cnt = g_TWENTY_SEVEN;
g_TWENTY_SEVEN : nx_g_cnt = g_TWENTY_EIGHT;
g_TWENTY_EIGHT : nx_g_cnt = g_TWENTY_NINE;
g_TWENTY_NINE : nx_g_cnt = g_THIRTY;
g_THIRTY : nx_g_cnt = g_THIRTY_ONE;
g_THIRTY_ONE : nx_g_cnt = g_ZERO;
default : nx_g_cnt = g_ZERO;
else nx_g_cnt = g_cnt; // hold the value
end // always @ (ce or g_cnt)
RegRst #(5) gb5_cntr_RegRst (.clk(clk),
module g2b_5bit (g_cnt,b_cnt);
parameter g_ZERO = 5'b0_0000,
g_FIFTEEN = 5'b0_1000, // reflection
g_SIXTEEN = 5'b1_1000, // reflection
g_TWENTY_ONE = 5'b1_1111,
g_TWENTY_TWO = 5'b1_1101,
g_TWENTY_THREE = 5'b1_1100,
g_TWENTY_FOUR = 5'b1_0100,
g_TWENTY_FIVE = 5'b1_0101,
g_TWENTY_SIX = 5'b1_0111,
g_TWENTY_SEVEN = 5'b1_0110,
g_TWENTY_EIGHT = 5'b1_0010,
g_TWENTY_NINE = 5'b1_0011,
g_THIRTY_ONE = 5'b1_0000;
parameter ZERO = 5'b0_0000,
TWENTY_THREE = 5'b1_0111,
TWENTY_SEVEN = 5'b1_1011,
TWENTY_EIGHT = 5'b1_1100,
case(g_cnt) // synopsys parallel_case full_case
g_ELEVEN : b_cnt = ELEVEN;
g_TWELVE : b_cnt = TWELVE;
g_THIRTEEN : b_cnt = THIRTEEN;
g_FORTEEN : b_cnt = FORTEEN;
g_FIFTEEN : b_cnt = FIFTEEN;
g_SIXTEEN : b_cnt = SIXTEEN;
g_SEVENTEEN : b_cnt = SEVENTEEN;
g_EIGHTEEN : b_cnt = EIGHTEEN;
g_NINETEEN : b_cnt = NINETEEN;
g_TWENTY : b_cnt = TWENTY;
g_TWENTY_ONE : b_cnt = TWENTY_ONE;
g_TWENTY_TWO : b_cnt = TWENTY_TWO;
g_TWENTY_THREE : b_cnt = TWENTY_THREE;
g_TWENTY_FOUR : b_cnt = TWENTY_FOUR;
g_TWENTY_FIVE : b_cnt = TWENTY_FIVE;
g_TWENTY_SIX : b_cnt = TWENTY_SIX;
g_TWENTY_SEVEN : b_cnt = TWENTY_SEVEN;
g_TWENTY_EIGHT : b_cnt = TWENTY_EIGHT;
g_TWENTY_NINE : b_cnt = TWENTY_NINE;
g_THIRTY : b_cnt = THIRTY;
g_THIRTY_ONE : b_cnt = THIRTY_ONE;
/* ---------- end of 5bit domain ------------------------------------- */
/* ---------- start of 4bit domain ----------------------------------- */
module g_cntr_4bit (reset,clk,ce,g_cnt);
-message "(* 0in test 4bit gray_code counter *)"
wire [3:0] g_cnt; // current state
reg [3:0] nx_g_cnt; // next state
parameter g_ZERO = 4'b0000,
g_FIFTEEN = 4'b1000; // reflection
case(g_cnt) // synopsys parallel_case full_case
g_ZERO : nx_g_cnt = g_ONE;
g_ONE : nx_g_cnt = g_TWO;
g_TWO : nx_g_cnt = g_THREE;
g_THREE : nx_g_cnt = g_FOUR;
g_FOUR : nx_g_cnt = g_FIVE;
g_FIVE : nx_g_cnt = g_SIX;
g_SIX : nx_g_cnt = g_SEVEN;
g_SEVEN : nx_g_cnt = g_EIGHT;
g_EIGHT : nx_g_cnt = g_NINE;
g_NINE : nx_g_cnt = g_TEN;
g_TEN : nx_g_cnt = g_ELEVEN;
g_ELEVEN : nx_g_cnt = g_TWELVE;
g_TWELVE : nx_g_cnt = g_THIRTEEN;
g_THIRTEEN : nx_g_cnt = g_FORTEEN;
g_FORTEEN : nx_g_cnt = g_FIFTEEN;
g_FIFTEEN : nx_g_cnt = g_ZERO;
default : nx_g_cnt = g_ZERO;
else nx_g_cnt = g_cnt; // hold the value
end // always @ (ce or g_cnt)
RegRst #(4) g_cnt_RegRst (.clk(clk),
module g2b_4bit (g_cnt,b_cnt);
parameter g_ZERO = 4'b0000,
g_FIFTEEN = 4'b1000; // reflection
parameter ZERO = 4'b0000,
case(g_cnt) // synopsys parallel_case full_case
g_ELEVEN : b_cnt = ELEVEN;
g_TWELVE : b_cnt = TWELVE;
g_THIRTEEN : b_cnt = THIRTEEN;
g_FORTEEN : b_cnt = FORTEEN;
g_FIFTEEN : b_cnt = FIFTEEN;
/* ---------- end of 4bit domain ------------------------------------- */
/* ---------- start of 3bit domain ----------------------------------- */
module g_cntr_3bit (reset,clk,ce,g_cnt);
-message "(* 0in test 3bit gray_code counter *)"
wire [2:0] g_cnt; // current state
reg [2:0] nx_g_cnt; // next state
parameter g_ZERO = 3'b000,
g_SEVEN = 3'b100; // reflection
case(g_cnt) // synopsys parallel_case full_case
g_ZERO : nx_g_cnt = g_ONE;
g_ONE : nx_g_cnt = g_TWO;
g_TWO : nx_g_cnt = g_THREE;
g_THREE : nx_g_cnt = g_FOUR;
g_FOUR : nx_g_cnt = g_FIVE;
g_FIVE : nx_g_cnt = g_SIX;
g_SIX : nx_g_cnt = g_SEVEN;
g_SEVEN : nx_g_cnt = g_ZERO;
default : nx_g_cnt = g_ZERO;
else nx_g_cnt = g_cnt; // hold the value
end // always @ (ce or g_cnt)
RegRst #(3) g_cnt_RegRst (.clk(clk),
module g2b_3bit (g_cnt,b_cnt);
parameter g_ZERO = 3'b000,
g_SEVEN = 3'b100; // reflection
case(g_cnt) // synopsys parallel_case full_case
/* ---------- end of 3bit domain ------------------------------------- */
module SYNC_FAST_5bit (din,clk,qout);
FAST_SYNC_CELL bit_0_FAST_SYNC_CELL (.D(din[0]),
FAST_SYNC_CELL bit_1_FAST_SYNC_CELL (.D(din[1]),
FAST_SYNC_CELL bit_2_FAST_SYNC_CELL (.D(din[2]),
FAST_SYNC_CELL bit_3_FAST_SYNC_CELL (.D(din[3]),
FAST_SYNC_CELL bit_4_FAST_SYNC_CELL (.D(din[4]),
endmodule // SYNC_FAST_5bit
module SYNC_5bit (din,clk,qout);
SYNC_CELL bit_0_SYNC_CELL (.D(din[0]),
SYNC_CELL bit_1_SYNC_CELL (.D(din[1]),
SYNC_CELL bit_2_SYNC_CELL (.D(din[2]),
SYNC_CELL bit_3_SYNC_CELL (.D(din[3]),
SYNC_CELL bit_4_SYNC_CELL (.D(din[4]),
module SYNC_4bit (din,clk,qout);
SYNC_CELL bit_0_SYNC_CELL (.D(din[0]),
SYNC_CELL bit_1_SYNC_CELL (.D(din[1]),
SYNC_CELL bit_2_SYNC_CELL (.D(din[2]),
SYNC_CELL bit_3_SYNC_CELL (.D(din[3]),
module SYNC_3bit (din,clk,qout);
SYNC_CELL bit_0_SYNC_CELL (.D(din[0]),
SYNC_CELL bit_1_SYNC_CELL (.D(din[1]),
SYNC_CELL bit_2_SYNC_CELL (.D(din[2]),
dv_en_8bit, // data valid enable
output [13:0] byte_count;
output [13:0] nx_byte_count;
wire [13:0] nx_byte_count;
/***** byte_count * ****/
always @ (byte_count_en or dv_en_8bit)
casex (dv_en_8bit) // synopsys parallel_case full_case
8'b1xxxxxxx: addend = 14'd8;
8'b01xxxxxx: addend = 14'd7;
8'b001xxxxx: addend = 14'd6;
8'b0001xxxx: addend = 14'd5;
8'b00001xxx: addend = 14'd4;
8'b000001xx: addend = 14'd3;
8'b0000001x: addend = 14'd2;
8'b00000001: addend = 14'd1;
8'b00000000: addend = 14'd0; // hold
default: addend = 14'd0; // hold
endcase // casex(dv_en_8bit)
else addend = 14'd0; // hold
assign nx_byte_count = byte_count + addend;
// original total cell: 396
// improved total cell: 269 + very fast compilation time
// We can only support 16k jumbo packet
RegRst #(14) byte_count_RegRst (.clk(clk),
endmodule // byte_counter
module ones_comp_16bit_adder (
sum_big // in big endian format
output [15:0] sum_big; // in big endian format
/**************************************************************************
* the look_ahead_adder: to save one adder for just adding "1", a technique
* is used. By adding one more bit to look_ahead_adder LSB on both addends
* and make them '1' then effectively the result is 2'b10. Discard the
* LSB position to get the effective 1
* ************************************************************************/
wire [17:0] look_ahead_adder = {1'b0, addend1, 1'b1} + {1'b0, addend2, 1'b1};
wire [17:0] twos_comp_16bit_adder = {1'b0, addend1, 1'b0} + {1'b0, addend2, 1'b0};
assign sum_big [15:0]= twos_comp_16bit_adder[17] ? look_ahead_adder[16:1]:
twos_comp_16bit_adder[16:1];
endmodule // ones_comp_16bit_adder
module clock_doubler_model(rbc0,rbc1,rbcx2);
input rbc0; // input from external SERDES, clocks odd bytes
input rbc1; // input from external SERDES, clocks even bytes
output rbcx2; // doubled version of clocks
wire rbc0_del4ns; // rbc0 delayed 4 ns
wire rbc1_del4ns; // rbc1 delayed 4 ns
// The following two lines should be replaced with ASIC vendor's delay cell.
//DEL4ns d_rbc0_del4ns (.A(rbc0),.Z(rbc0_del4ns));
//DEL4ns d_rbc1_del4ns (.A(rbc1),.Z(rbc1_del4ns));
// vlint flag_unsynthesizable_delay_control off
assign #4 rbc0_del4ns = rbc0;
assign #4 rbc1_del4ns = rbc1;
// vlint flag_unsynthesizable_delay_control on
assign rbcx2 = (~rbc0_del4ns & rbc0) | (~rbc1_del4ns & rbc1);
wire [dwidth-1:0] b = ~a;
wire [dwidth-1:0] z = ~b;
// vlint flag_unsynthesizable_delay_control off
// vlint flag_unsynthesizable_delay_control on
// -----------------------------------------------------------
// NEC relatively balanced (rise/fall) output delay cell spec.
// -----------------------------------------------------------
// Tpd Tpd Tdp of delay circuit
// cell name Min case Max case Typ (info only)
// --------- -------- -------- ------ -----------------
// TCDLY1VX2 ~200ps ~400ps 300ps 2 levels
// TCDLY2VX2 ~350ps ~700ps 500ps 4 levels
// TCDLY3VX2 ~500ps ~1000ps 750ps 6 levels
// vlint flag_unsynthesizable_delay_control off
// vlint flag_unsynthesizable_delay_control on
// vlint flag_unsynthesizable_delay_control off
// vlint flag_unsynthesizable_delay_control on
// vlint flag_unsynthesizable_delay_control off
// vlint flag_unsynthesizable_delay_control on
/**********************************************************************/
/* Module Name : DEL_PAT */
/* Description : Delay element to aid in meeting hold requirement */
/* Parent module : pcs_lfsr.v */
/* Child modules : none */
/* Author Name : Linda Cheng */
/* Date Created : 11/7/97 */
/* Copyright (c) 1994, Sun Microsystems, Inc. */
/* Sun Proprietary and Confidential */
/* Modifications : none yet */
/* Synthesis Notes : none yet */
/************************************************************************/
DEL2ns PAT0_DEL2ns (.Z(Z[0]), .A(A[0]));
DEL2ns PAT1_DEL2ns (.Z(Z[1]), .A(A[1]));
DEL2ns PAT2_DEL2ns (.Z(Z[2]), .A(A[2]));
DEL2ns PAT3_DEL2ns (.Z(Z[3]), .A(A[3]));
DEL2ns PAT4_DEL2ns (.Z(Z[4]), .A(A[4]));
DEL2ns PAT5_DEL2ns (.Z(Z[5]), .A(A[5]));
DEL2ns PAT6_DEL2ns (.Z(Z[6]), .A(A[6]));
DEL2ns PAT7_DEL2ns (.Z(Z[7]), .A(A[7]));
DEL2ns PAT8_DEL2ns (.Z(Z[8]), .A(A[8]));
DEL2ns PAT9_DEL2ns (.Z(Z[9]), .A(A[9]));
DEL2ns PAT10_DEL2ns (.Z(Z[10]), .A(A[10]));
DEL2ns PAT11_DEL2ns (.Z(Z[11]), .A(A[11]));
DEL2ns PAT12_DEL2ns (.Z(Z[12]), .A(A[12]));
DEL2ns PAT13_DEL2ns (.Z(Z[13]), .A(A[13]));
DEL2ns PAT14_DEL2ns (.Z(Z[14]), .A(A[14]));
DEL2ns PAT15_DEL2ns (.Z(Z[15]), .A(A[15]));
DEL2ns PAT16_DEL2ns (.Z(Z[16]), .A(A[16]));
DEL2ns PAT17_DEL2ns (.Z(Z[17]), .A(A[17]));
/****************************************************
* copy from: /import/cassini/central/asic/LIB/
****************************************************/
module MUX2TO1 (dout, sel, data0, data1);
output [dwidth-1:0] dout;
input [dwidth-1:0] data0;
input [dwidth-1:0] data1;
always @ (sel or data0 or data1)
case (sel) // synopsys parallel_case full_case
// but from /vobs/vega_asic/mac/phy/rtl/
module MUX3TO1(dout,sel,data0,data1,data2);
output [dwidth-1:0] dout;
input [dwidth-1:0] data0;
input [dwidth-1:0] data1;
input [dwidth-1:0] data2;
always @ (sel or data0 or data1 or data2)
case (sel) // synopsys parallel_case full_case
module MUX4TO1 (dout, sel, data0, data1, data2, data3);
output [dwidth-1:0] dout;
input [dwidth-1:0] data0;
input [dwidth-1:0] data1;
input [dwidth-1:0] data2;
input [dwidth-1:0] data3;
always @ (sel or data0 or data1 or data2 or data3)
case (sel) // synopsys parallel_case full_case
module MUX6TO1 (dout,sel,D0,D1,D2,D3,D4,D5);
output [dwidth-1:0] dout;
always @ (sel or D0 or D1 or D2 or D3 or D4 or D5)
case (sel) // synopsys parallel_case full_case
module REG (qout, clk, din);
//non-resettable variable width register
//if used as flop, just instantiate with #1
output [dwidth-1:0] qout;
module RREG (qout, clk, rst, din);
//synchronous reset variable width register
//if used as flop, just instantiate with #1
output [dwidth-1:0] qout;
module SRREG (qout, clk, en, rst, din);
//synchronous reset variable width register with active hi enable
//if used as flop, just instantiate with #1
output [dwidth-1:0] qout;
module EREG (qout, clk, en, din);
//synchronous variable width register with active hi enable
//if used as flop, just instantiate with #1
output [dwidth-1:0] qout;
/*********************************************************
Description : 4 sets of {nand3, nor2, inv, mux2, reg}
***********************************************************/
ND3M1P nand3_3 ( .Z(do_nad[3]), .A(di_nd3[0]), .B(di_nd3[1]), .C(di_nd3[2]) );
ND3M1P nand3_2 ( .Z(do_nad[2]), .A(di_nd2[0]), .B(di_nd2[1]), .C(di_nd2[2]) );
ND3M1P nand3_1 ( .Z(do_nad[1]), .A(di_nd1[0]), .B(di_nd1[1]), .C(di_nd1[2]) );
ND3M1P nand3_0 ( .Z(do_nad[0]), .A(di_nd0[0]), .B(di_nd0[1]), .C(di_nd0[2]) );
NR2M1P nor_3 ( .Z(do_nor[3]), .A(di_nr3[0]), .B(di_nr3[1]) );
NR2M1P nor_2 ( .Z(do_nor[2]), .A(di_nr2[0]), .B(di_nr2[1]) );
NR2M1P nor_1 ( .Z(do_nor[1]), .A(di_nr1[0]), .B(di_nr1[1]) );
NR2M1P nor_0 ( .Z(do_nor[0]), .A(di_nr0[0]), .B(di_nr0[1]) );
N1M1P inv_3 ( .Z(do_inv[3]), .A(di_inv[3]) );
N1M1P inv_2 ( .Z(do_inv[2]), .A(di_inv[2]) );
N1M1P inv_1 ( .Z(do_inv[1]), .A(di_inv[1]) );
N1M1P inv_0 ( .Z(do_inv[0]), .A(di_inv[0]) );
MUX21HM1P mux21_3 ( .Z(do_mux[3]), .A(di_mx3[0]), .B(di_mx3[1]), .S(mx_sel[3]) );
MUX21HM1P mux21_2 ( .Z(do_mux[2]), .A(di_mx2[0]), .B(di_mx2[1]), .S(mx_sel[2]) );
MUX21HM1P mux21_1 ( .Z(do_mux[1]), .A(di_mx1[0]), .B(di_mx1[1]), .S(mx_sel[1]) );
MUX21HM1P mux21_0 ( .Z(do_mux[0]), .A(di_mx0[0]), .B(di_mx0[1]), .S(mx_sel[0]) );
FD2SL2QM1P regtre_3 ( .Q(do_q[3]), .D(di_reg[3]), .CP(clk), .CD(rst_l[3]), .TI(do_q[2]), .TE(se), .LD(wt_ena[3]) );
FD2SL2QM1P regtre_2 ( .Q(do_q[2]), .D(di_reg[2]), .CP(clk), .CD(rst_l[2]), .TI(do_q[1]), .TE(se), .LD(wt_ena[2]) );
FD2SL2QM1P regtre_1 ( .Q(do_q[1]), .D(di_reg[1]), .CP(clk), .CD(rst_l[1]), .TI(do_q[0]), .TE(se), .LD(wt_ena[1]) );
FD2SL2QM1P regtre_0 ( .Q(do_q[0]), .D(di_reg[0]), .CP(clk), .CD(rst_l[0]), .TI(si), .TE(se), .LD(wt_ena[0]) );
N1M1P inv_rst_3( .Z(rst_l[3]), .A(rst[3]) );
N1M1P inv_rst_2( .Z(rst_l[2]), .A(rst[2]) );
N1M1P inv_rst_1( .Z(rst_l[1]), .A(rst[1]) );
N1M1P inv_rst_0( .Z(rst_l[0]), .A(rst[0]) );