// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: cl_rtl_ext.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 ============================================
module mux2e ( dout, in0, in1, sel );
always @ ( sel or in0 or in1 )
dout = { SIZE { 1'bx } };
end // always @ ( sel or in0 or in1 )
module mux3 ( dout, in0, in1, in2,
sel0, sel1, sel2, muxtst );
wire [3:0] sel = { muxtst, sel2, sel1, sel0 };
//0in one_hot -var sel[2:0] -message "mux3 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 )
4'b0000: dout = { SIZE {1'b1 }};
dout = { SIZE { 1'bx } };
module mux4 ( dout, in0, in1, in2, in3,
sel0, sel1, sel2, sel3, muxtst );
wire [4:0] sel = { muxtst, sel3, sel2, sel1, sel0 };
//0in one_hot -var sel[3:0] -message "mux4 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 or in3 )
5'b00000: dout = { SIZE { 1'b1 } };
dout = { SIZE { 1'bx } };
module mux5 ( dout, in0, in1, in2, in3, in4,
sel0, sel1, sel2, sel3, sel4, muxtst );
wire [5:0] sel = { muxtst, sel4, sel3, sel2, sel1, sel0 };
//0in one_hot -var sel[4:0] -message "mux5 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 or in3 or in4 )
6'b000000: dout = { SIZE { 1'b1 }};
dout = { SIZE { 1'bx } };
module mux6 ( dout, in0, in1, in2, in3, in4, in5,
sel0, sel1, sel2, sel3, sel4, sel5, muxtst );
wire [6:0] sel = { muxtst, sel5,
sel4, sel3, sel2, sel1, sel0 };
//0in one_hot -var sel[5:0] -message "mux6 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 or in3 or in4 or
7'b0000000: dout = { SIZE { 1'b1 } };
dout = { SIZE { 1'bx } };
module mux7 ( dout, in0, in1, in2, in3, in4, in5, in6,
sel0, sel1, sel2, sel3, sel4, sel5, sel6, muxtst );
wire [7:0] sel = { muxtst, sel6, sel5,
sel4, sel3, sel2, sel1, sel0 };
//0in one_hot -var sel[6:0] -message "mux7 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 or in3 or in4 or
8'b00000000: dout = { SIZE { 1'b1 } };
dout = { SIZE { 1'bx } };
module mux8 ( dout, in0, in1, in2, in3, in4, in5, in6, in7,
sel0, sel1, sel2, sel3, sel4, sel5, sel6, sel7, muxtst );
wire [8:0] sel = { muxtst, sel7, sel6, sel5,
sel4, sel3, sel2, sel1, sel0 };
//0in one_hot -var sel[7:0] -message "mux8 selects not one-hot!"
always @ ( sel or in0 or in1 or in2 or in3 or in4 or
9'bx00000001: dout = in0;
9'bx00000010: dout = in1;
9'bx00000100: dout = in2;
9'bx00001000: dout = in3;
9'bx00010000: dout = in4;
9'bx00100000: dout = in5;
9'bx01000000: dout = in6;
9'bx10000000: dout = in7;
9'b000000000: dout = { SIZE { 1'b1 } };
dout = { SIZE { 1'bx } };
module mux2s ( dout, in0, in1,
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) );
module mux3s ( dout, in0, in1, in2,
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) );
module mux4s ( dout, in0, in1, in2, in3,
sel0, sel1, sel2, sel3 );
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) |
( in3 & { SIZE { sel3 } } ) );
module mux5s ( dout, in0, in1, in2, in3, in4,
sel0, sel1, sel2, sel3, sel4 );
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) |
( in3 & { SIZE { sel3 } } ) |
( in4 & { SIZE { sel4 } } ) );
module mux6s ( dout, in0, in1, in2, in3, in4, in5,
sel0, sel1, sel2, sel3, sel4, sel5 );
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) |
( in3 & { SIZE { sel3 } } ) |
( in4 & { SIZE { sel4 } } ) |
( in5 & { SIZE { sel5 } } ) );
module mux7s ( dout, in0, in1, in2, in3, in4, in5, in6,
sel0, sel1, sel2, sel3, sel4, sel5, sel6 );
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) |
( in3 & { SIZE { sel3 } } ) |
( in4 & { SIZE { sel4 } } ) |
( in5 & { SIZE { sel5 } } ) |
( in6 & { SIZE { sel6 } } ) );
module mux8s ( dout, in0, in1, in2, in3, in4, in5, in6, in7,
sel0, sel1, sel2, sel3, sel4, sel5, sel6, sel7 );
assign dout = ( ( in0 & { SIZE { sel0 } } ) |
( in1 & { SIZE { sel1 } } ) |
( in2 & { SIZE { sel2 } } ) |
( in3 & { SIZE { sel3 } } ) |
( in4 & { SIZE { sel4 } } ) |
( in5 & { SIZE { sel5 } } ) |
( in6 & { SIZE { sel6 } } ) |
( in7 & { SIZE { sel7 } } ) );
// There are inverted and non-inverted versions of this...different between power levels!
// First the non-inverting
module tisram_blb ( latout_l, d, l1clk);
output [SIZE-1:0] latout_l;
initial latout_l[SIZE-1:0] = {SIZE{1'b0}};
always @(l1clk or d) begin
if (!l1clk) latout_l[SIZE-1:0] <= d[SIZE-1:0];
module tisram_blb_inv ( latout_l, d, l1clk);
output [SIZE-1:0] latout_l;
initial latout_l[SIZE-1:0] = {SIZE{1'b0}};
always @(l1clk or d) begin
if (!l1clk) latout_l[SIZE-1:0] <= ~d[SIZE-1:0];
module tisram_bla (q_a, d_b, l1clk);
initial q_a[SIZE-1:0] = {SIZE{1'b0}};
always @(l1clk or d_b) begin
q_a[SIZE-1:0] <= d_b[SIZE-1:0];
module msffi ( q_l, so, d, l1clk, si, siclk, soclk );
// Level sensitive in SCAN_MODE
// Edge triggered when not in SCAN_MODE
wire l1clk, siclk, soclk;
always @(posedge l1clk or posedge siclk ) begin
q[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
q[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si)
if (!l1clk && !siclk) l1[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
else if ( l1clk && !siclk && !soclk) q[SIZE-1:0] <= l1[SIZE-1:0]; // Load slave with master data
if ( l1clk && siclk && !soclk) q[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused;
assign si_unused[SIZE-1:0] = si[SIZE-1:0];
assign siclk_unused = siclk;
assign soclk_unused = soclk;
initial q[SIZE-1:0] = {SIZE{1'b0}};
initial q_l[SIZE-1:0] = {SIZE{1'b1}};
if (!siclk && !soclk) q[SIZE-1:0] <= d[SIZE-1:0];
else q[SIZE-1:0] <= {SIZE{1'bx}};
assign so[SIZE-1:0] = q[SIZE-1:0];
module msffi_dp ( q_l, so, d, l1clk, si, siclk, soclk );
// Level sensitive in SCAN_MODE
// Edge triggered when not in SCAN_MODE
wire l1clk, siclk, soclk;
always @(posedge l1clk or posedge siclk ) begin
q[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
q[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si)
if (!l1clk && !siclk) l1[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
else if ( l1clk && !siclk && !soclk) q[SIZE-1:0] <= l1[SIZE-1:0]; // Load slave with master data
if ( l1clk && siclk && !soclk) q[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused;
assign si_unused[SIZE-1:0] = si[SIZE-1:0];
assign siclk_unused = siclk;
assign soclk_unused = soclk;
initial q[SIZE-1:0] = {SIZE{1'b0}};
initial q_l[SIZE-1:0] = {SIZE{1'b1}};
if (!siclk && !soclk) q[SIZE-1:0] <= d[SIZE-1:0];
else q[SIZE-1:0] <= {SIZE{1'bx}};
assign so[SIZE-1:0] = q[SIZE-1:0];
module msffiz_dp ( q_l, so, d, l1clk, si, siclk, soclk );
// Level sensitive in SCAN_MODE
// Edge triggered when not in SCAN_MODE
wire l1clk, siclk, soclk;
always @(posedge l1clk or posedge siclk ) begin
q_l[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
q_l[SIZE-1:0] <= ~d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si)
if (!l1clk && !siclk) l1[SIZE-1:0] <= ~d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE {1'bx}}; // Conflict between data and scan
else if ( l1clk && !siclk && !soclk) q_l[SIZE-1:0] <= l1[SIZE-1:0]; // Load slave with master data
if ( l1clk && siclk && !soclk) q_l[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused;
assign si_unused[SIZE-1:0] = si[SIZE-1:0];
assign siclk_unused = siclk;
assign soclk_unused = soclk;
initial q_l[SIZE-1:0] = {SIZE {1'b0}};
if (!siclk && !soclk) q_l[SIZE-1:0] <= ~d[SIZE-1:0];
else q_l[SIZE-1:0] <= {SIZE {1'bx}};
assign so[SIZE-1:0] = q_l[SIZE-1:0];
module bs_cell2 (q, so, d, l1clk, si, siclk, soclk, updateclk, mode, muxd, highZ_N);
input [SIZE-1:0] d, muxd;
input updateclk, mode, highZ_N;
wire l1clk, siclk, soclk, updateclk;
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) l1[SIZE-1:0] <= d[SIZE-1:0];
if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0];
if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE {1'bx}};
if ( l1clk && !soclk) so[SIZE-1:0] <= l1[SIZE-1:0];
if ( l1clk && siclk && !soclk) so[SIZE-1:0] <= si[SIZE-1:0]; // Flush
initial qm[SIZE-1:0] = {SIZE {1'b0}};
always @(updateclk or l1) begin
if (updateclk) qm[SIZE-1:0] <=l1[SIZE-1:0];
always@(mode or muxd or qm or highZ_N) begin
if (mode==0) q[SIZE-1:0] = (qm[SIZE-1:0] && {SIZE {highZ_N}});
else q[SIZE-1:0] = muxd[SIZE-1:0];
module scm_msff_lat ( latout, q, q_l, so, d, l1clk, si, siclk, soclk);
output [SIZE-1:0] latout;
always @(l1clk or siclk or d ) begin // vcs optimized code
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && siclk) begin // flush reset
m[SIZE-1:0] <= {SIZE {1'b0}};
s[SIZE-1:0] <= {SIZE {1'b0}};
// always @(posedge l1clk or posedge siclk ) begin
// m[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
// s[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
// m[SIZE-1:0] <= d[SIZE-1:0];
// s[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE {1'bx}}; // Conflict between data and scan
if ( l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && siclk && !soclk) s[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused = si;
initial m[SIZE-1:0] = {SIZE {1'b0}};
initial s[SIZE-1:0] = {SIZE {1'b0}};
always @(l1clk or d or si or siclk) begin
if(siclk==0 && l1clk==0) m[SIZE-1:0] = d[SIZE-1:0];
else if(siclk && !l1clk) m[SIZE-1:0] = {SIZE {1'bx}};
if(siclk && l1clk) m[SIZE-1:0] = si[SIZE-1:0];
if(l1clk && !soclk) s[SIZE-1:0] = m[SIZE-1:0];
assign latout[SIZE-1:0] = m[SIZE-1:0];
assign so[SIZE-1:0] = s[SIZE-1:0];
assign q[SIZE-1:0] = s[SIZE-1:0];
assign q_l[SIZE-1:0] = ~s[SIZE-1:0];
endmodule // scm_msff_lat
module tisram_msff ( latout, latout_l, so, d, l1clk, si, siclk, soclk );
output [SIZE-1:0] latout;
output [SIZE-1:0] latout_l;
wire [SIZE-1:0] latout, latout_l, so;
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE {1'bx}}; // Conflict between data and scan
if ( l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && siclk && !soclk) s[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused = si;
wire soclk_unused = soclk;
initial m[SIZE-1:0] = {SIZE {1'b0}};
initial s[SIZE-1:0] = {SIZE {1'b0}};
always @(l1clk or d or si or siclk) begin
if(siclk==0 && l1clk==0) m[SIZE-1:0] <= d[SIZE-1:0];
if(siclk && !l1clk) m[SIZE-1:0] <= {SIZE {1'bx}};
else if(siclk && l1clk) m[SIZE-1:0] <= si[SIZE-1:0];
assign latout[SIZE-1:0] = m[SIZE-1:0];
assign latout_l[SIZE-1:0] = ~m[SIZE-1:0];
assign so[SIZE-1:0] = s[SIZE-1:0];
module blat ( latout, so, d, l1clk, si, siclk, soclk );
output [SIZE-1:0] latout;
wire [SIZE-1:0] latout, so;
always @(posedge l1clk or posedge siclk ) begin
m[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
s[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
m[SIZE-1:0] <= d[SIZE-1:0];
s[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE {1'bx}}; // Conflict between data and scan
if ( l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && siclk && !soclk) s[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused = si;
wire soclk_unused = soclk;
initial m[SIZE-1:0] = {SIZE {1'b0}};
initial s[SIZE-1:0] = {SIZE {1'b0}};
always @(l1clk or d or si or siclk) begin
if(siclk==0 && l1clk==0) m[SIZE-1:0] <= d[SIZE-1:0];
if(siclk && !l1clk) m[SIZE-1:0] <= {SIZE {1'bx}};
else if(siclk && l1clk) m[SIZE-1:0] <= si[SIZE-1:0];
assign latout[SIZE-1:0] = m[SIZE-1:0];
assign so[SIZE-1:0] = s[SIZE-1:0];
module dlat ( latout, latout_l, so, d, l1clk, si, siclk, soclk );
output [SIZE-1:0] latout;
output [SIZE-1:0] latout_l;
wire [SIZE-1:0] latout, latout_l, so;
always @(posedge l1clk or posedge siclk ) begin
m[SIZE-1:0] <= {SIZE{1'b1}}; //pseudo flush reset
s[SIZE-1:0] <= {SIZE{1'b1}}; //pseudo flush reset
m[SIZE-1:0] <= ~d[SIZE-1:0];
s[SIZE-1:0] <= ~d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= ~d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= ~si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE {1'bx}}; // Conflict between data and scan
if ( l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && !soclk && siclk) s[SIZE-1:0] <= ~si[SIZE-1:0]; // Flush
assign so[SIZE-1:0] = ~s[SIZE-1:0];
wire [SIZE-1:0] si_unused = si[SIZE-1:0];
wire soclk_unused = soclk;
initial m[SIZE-1:0] = {SIZE{1'b1}};
initial s[SIZE-1:0] = {SIZE{1'b1}};
always @(l1clk or d or si or siclk) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= ~d[SIZE-1:0];
else if ( l1clk && siclk) m[SIZE-1:0] <= ~si[SIZE-1:0];
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE {1'bx}};
// Don't model slave...since is a don't care for normal sim
// below is a hack since we don't really care about s, so use m
assign so[SIZE-1:0] = ~m[SIZE-1:0];
assign latout[SIZE-1:0] = ~m[SIZE-1:0];
assign latout_l[SIZE-1:0] = m[SIZE-1:0];
module dlata ( latout, latout_l, q, q_l, so, d, l1clk, si, siclk, soclk );
output [SIZE-1:0] latout;
output [SIZE-1:0] latout_l;
wire [SIZE-1:0] so, latout, latout_l;
always @(posedge l1clk or posedge siclk ) begin
m[SIZE-1:0] <= {SIZE{1'b1}}; //pseudo flush reset
s[SIZE-1:0] <= {SIZE{1'b1}}; //pseudo flush reset
m[SIZE-1:0] <= ~d[SIZE-1:0];
s[SIZE-1:0] <= ~d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= ~d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= ~si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
if (l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && !soclk && siclk) s[SIZE-1:0] <= ~si[SIZE-1:0]; // Flush
// wire [SIZE-1:0] si_unused = si[SIZE-1:0];
initial m[SIZE-1:0] = {SIZE{1'b1}};
initial s[SIZE-1:0] = {SIZE{1'b1}};
always @(l1clk or d or si or siclk) begin
if (!siclk && !l1clk) m[SIZE-1:0] <= ~d[SIZE-1:0];
else if ( siclk && !l1clk) m[SIZE-1:0] <= {SIZE {1'bx}};
else if ( siclk && l1clk) m[SIZE-1:0] <= ~si[SIZE-1:0];
if ( l1clk && !soclk) s[SIZE-1:0] <= m[SIZE-1:0];
// always @(l1clk or d or siclk or si) begin
// m[SIZE-1:0] <= ~d[SIZE-1:0];
// m[SIZE-1:0] <= {SIZE{1'bx}};
// else begin // l1clk == 1
// if (!soclk) s[SIZE-1:0] <= m[SIZE-1:0];
assign latout[SIZE-1:0] = ~m[SIZE-1:0] & {SIZE {l1clk}};
assign latout_l[SIZE-1:0] = m[SIZE-1:0] & {SIZE {l1clk}};
assign so[SIZE-1:0] = ~s[SIZE-1:0];
assign q[SIZE-1:0] = ~s[SIZE-1:0];
assign q_l[SIZE-1:0] = s[SIZE-1:0];
module new_dlata ( and_clk, mq, mq_l, q, q_l, so, d, l1clk, si, siclk, soclk );
wire [SIZE-1:0] mq, mq_l, q, q_l, so;
always @(l1clk or siclk or d ) begin // vcs optimized code
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if ( l1clk && siclk) begin // flush reset
m[SIZE-1:0] <= {SIZE{1'b0}};
s[SIZE-1:0] <= {SIZE{1'b0}};
// always @(posedge l1clk or posedge siclk ) begin
// m[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
// s[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
// m[SIZE-1:0] <= d[SIZE-1:0];
// s[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
if (l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && !soclk && siclk) s[SIZE-1:0] <= si[SIZE-1:0]; // Flush
// wire [SIZE-1:0] si_unused = si[SIZE-1:0];
initial m[SIZE-1:0] = {SIZE{1'b0}};
initial s[SIZE-1:0] = {SIZE{1'b0}};
always @(l1clk or d or si or siclk) begin
if (!siclk && !l1clk) m[SIZE-1:0] <= d[SIZE-1:0];
else if ( siclk && !l1clk) m[SIZE-1:0] <= {SIZE {1'bx}};
else if ( siclk && l1clk) m[SIZE-1:0] <= si[SIZE-1:0];
if ( l1clk && !soclk) s[SIZE-1:0] <= m[SIZE-1:0];
assign mq[SIZE-1:0] = m[SIZE-1:0] & {SIZE {(and_clk & l1clk)}};
assign mq_l[SIZE-1:0] = ~m[SIZE-1:0] & {SIZE {(and_clk & l1clk)}};
wire and_clk_unused = and_clk;
assign mq[SIZE-1:0] = m[SIZE-1:0];
assign mq_l[SIZE-1:0] = ~m[SIZE-1:0];
assign so[SIZE-1:0] = s[SIZE-1:0];
assign q[SIZE-1:0] = s[SIZE-1:0];
assign q_l[SIZE-1:0] = ~s[SIZE-1:0];
module new_dlat ( latout, latout_l, q, q_l, so, d, l1clk, si, siclk, soclk );
output [SIZE-1:0] latout;
output [SIZE-1:0] latout_l;
wire [SIZE-1:0] mq, mq_l, q, q_l, so;
always @(posedge l1clk or posedge siclk ) begin
m[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
s[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
m[SIZE-1:0] <= d[SIZE-1:0];
s[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si) begin
if (!l1clk && !siclk) m[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) m[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) m[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
if (l1clk && !soclk && !siclk) s[SIZE-1:0] <= m[SIZE-1:0]; // Load slave with master data
else if (l1clk && !soclk && siclk) s[SIZE-1:0] <= si[SIZE-1:0]; // Flush
// wire [SIZE-1:0] si_unused = si[SIZE-1:0];
initial m[SIZE-1:0] = {SIZE{1'b0}};
initial s[SIZE-1:0] = {SIZE{1'b0}};
always @(l1clk or d or si or siclk) begin
if (!siclk && !l1clk) m[SIZE-1:0] <= d[SIZE-1:0];
else if ( siclk && !l1clk) m[SIZE-1:0] <= {SIZE {1'bx}};
else if ( siclk && l1clk) m[SIZE-1:0] <= si[SIZE-1:0];
if ( l1clk && !soclk) s[SIZE-1:0] <= m[SIZE-1:0];
assign latout[SIZE-1:0] = m[SIZE-1:0] & {SIZE {l1clk}};
assign latout_l[SIZE-1:0] = ~m[SIZE-1:0] & {SIZE {l1clk}};
assign latout[SIZE-1:0] = m[SIZE-1:0];
assign latout_l[SIZE-1:0] = ~m[SIZE-1:0];
assign so[SIZE-1:0] = s[SIZE-1:0];
assign q[SIZE-1:0] = s[SIZE-1:0];
assign q_l[SIZE-1:0] = ~s[SIZE-1:0];
module ccx_mac_a (l1clk0,l1clk1,siclk,soclk,grant_x,data_a,data_x_l,qsel0_buf,shift_buf,si,so);
output [SIZE-1:0] data_x_l;
wire [SIZE-1:0] msff1_so,msff1_si,msff0_so,msff0_si;
assign q0_in[SIZE-1:0] = ({SIZE{qsel0_buf}} & data_a[SIZE-1:0]) |
({SIZE{shift_buf}} & q1[SIZE-1:0]);
assign data_x_l[SIZE-1:0] = ~(q0[SIZE-1:0] & {SIZE{grant_x}});
//assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:0],si};
//assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
//assign so = msff0_so[SIZE-1];
//assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:0],si};
//assign msff1_si[9:5] = {msff0_so[SIZE-2:5],si};
//assign msff1_si[0] = msff0_so[SIZE-1];
//assign msff1_si[4:1] = msff0_so[3:0];
//assign so = msff0_so[4];
assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:5],si,msff0_so[3:0],msff0_so[SIZE-1]};
assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
module ccx_mac_b (l1clk0,l1clk1,siclk,soclk,grant_x,data_a,data_prev_x_l,data_x_l,qsel0_buf,shift_buf,si,so);
input [SIZE-1:0] data_prev_x_l;
output [SIZE-1:0] data_x_l;
wire [SIZE-1:0] msff1_so,msff1_si,msff0_so,msff0_si;
wire [SIZE-1:0] q0_in,x4,x5;
assign q0_in[SIZE-1:0] = ({SIZE{qsel0_buf}} & data_a[SIZE-1:0]) |
({SIZE{shift_buf}} & q1[SIZE-1:0]);
assign x4[SIZE-1:0] = ~(q0[SIZE-1:0] & {SIZE{grant_x}});
assign x5[SIZE-1:0] = ~(x4[SIZE-1:0] & data_prev_x_l[SIZE-1:0]);
assign data_x_l[SIZE-1:0] = ~x5[SIZE-1:0];
//assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:0],si};
//assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
//assign so = msff0_so[SIZE-1];
assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:5],si,msff0_so[3:0],msff0_so[SIZE-1]};
assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
module ccx_mac_c (l1clk0,l1clk1,siclk,soclk,grant_x,data_a,data_crit_x_l,data_ncrit_x_l,data_x_l,qsel0_buf,shift_buf,si,so);
input [SIZE-1:0] data_crit_x_l;
input [SIZE-1:0] data_ncrit_x_l;
output [SIZE-1:0] data_x_l;
wire [SIZE-1:0] msff1_so,msff1_si,msff0_so,msff0_si;
wire [SIZE-1:0] q0_in,x4,x5;
assign q0_in[SIZE-1:0] = ({SIZE{qsel0_buf}} & data_a[SIZE-1:0]) |
({SIZE{shift_buf}} & q1[SIZE-1:0]);
assign x4[SIZE-1:0] = ~(q0[SIZE-1:0] & {SIZE{grant_x}});
assign x5[SIZE-1:0] = ~(x4[SIZE-1:0] & data_crit_x_l[SIZE-1:0] & data_ncrit_x_l[SIZE-1:0]);
assign data_x_l[SIZE-1:0] = ~x5[SIZE-1:0];
//assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:0],si};
//assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
//assign so = msff0_so[SIZE-1];
assign msff1_si[SIZE-1:0] = {msff0_so[SIZE-2:5],si,msff0_so[3:0],msff0_so[SIZE-1]};
assign msff0_si[SIZE-1:0] = {msff1_so[SIZE-1:0]};
// new dff from RM with init to zero in scan section
module dff ( q, so, d, l1clk, si, siclk, soclk );
// Level sensitive in SCAN_MODE
// Edge triggered when not in SCAN_MODE
// 4-25-2005 added initlatzero to scan_mode
wire l1clk, siclk, soclk;
initial l1[SIZE-1:0] = {SIZE{1'b0}};
initial q[SIZE-1:0] = {SIZE{1'b0}};
always @(posedge l1clk or posedge siclk ) begin
q[SIZE-1:0] <= {SIZE{1'b0}}; //pseudo flush reset
q[SIZE-1:0] <= d[SIZE-1:0];
always @(l1clk or siclk or soclk or d or si)
if (!l1clk && !siclk) l1[SIZE-1:0] <= d[SIZE-1:0]; // Load master with data
else if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0]; // Load master with scan or flush
else if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE{1'bx}}; // Conflict between data and scan
else if ( l1clk && !siclk && !soclk) q[SIZE-1:0] <= l1[SIZE-1:0]; // Load slave with master data
if ( l1clk && siclk && !soclk) q[SIZE-1:0] <= si[SIZE-1:0]; // Flush
wire [SIZE-1:0] si_unused;
assign si_unused[SIZE-1:0] = si[SIZE-1:0];
assign siclk_unused = siclk;
assign soclk_unused = soclk;
initial q[SIZE-1:0] = {SIZE{1'b0}};
if (!siclk && !soclk) q[SIZE-1:0] <= d[SIZE-1:0];
else q[SIZE-1:0] <= {SIZE{1'bx}};
assign so[SIZE-1:0] = q[SIZE-1:0];
module dff_jtag ( q, so, d, l1clk, si, siclk, soclk, reset, updateclk );
// modified 2/15/05 gfg as per Shawn
wire l1clk, siclk, soclk, updateclk;
always @(l1clk or siclk or soclk or d or si or reset)
if (!l1clk && !siclk) l1[SIZE-1:0] <= d[SIZE-1:0];
else if ( l1clk && siclk) l1[SIZE-1:0] <= si[SIZE-1:0];
else if (!l1clk && siclk) l1[SIZE-1:0] <= {SIZE{1'bx}};
if ( reset ) so[SIZE-1:0] <= {SIZE{1'b0}};
if ( l1clk && !siclk && !soclk && !reset) so[SIZE-1:0] <= l1[SIZE-1:0];
if ( l1clk && siclk && !soclk && !reset) so[SIZE-1:0] <= si[SIZE-1:0];
initial q[SIZE-1:0] = {SIZE{1'b0}};
always@(updateclk or reset or l1)
if(reset) q[SIZE-1:0] <= {SIZE{1'b0}};
else if(updateclk) q[SIZE-1:0] <= l1[SIZE-1:0];
// parameterized sim sections for the common sunv macros besides muxes and flops
module and2 (out, in0, in1);
assign out[SIZE-1:0] = in0[SIZE-1:0] & in1[SIZE-1:0];
module and3 (out, in0, in1, in2);
assign out[SIZE-1:0] = in0[SIZE-1:0] & in1[SIZE-1:0] & in2[SIZE-1:0];
module and4 (out, in0, in1, in2, in3);
assign out[SIZE-1:0] = in0[SIZE-1:0] & in1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0];
module nand2 (out, in0, in1);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] & in1[SIZE-1:0]);
module nand3 (out, in0, in1, in2);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] & in1[SIZE-1:0] & in2[SIZE-1:0]);
module nand4 (out, in0, in1, in2, in3);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] & in1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0]);
module or2 (out, in0, in1);
assign out[SIZE-1:0] = in0[SIZE-1:0] | in1[SIZE-1:0];
module or3 (out, in0, in1, in2);
assign out[SIZE-1:0] = in0[SIZE-1:0] | in1[SIZE-1:0] | in2[SIZE-1:0];
module nor2 (out, in0, in1);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] | in1[SIZE-1:0]);
module nor3 (out, in0, in1, in2);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] | in1[SIZE-1:0] | in2[SIZE-1:0]);
module xor2 ( out, in0, in1 );
input [SIZE-1:0] in0, in1;
module xor3 (out, in0, in1, in2);
assign out[SIZE-1:0] = in0[SIZE-1:0] ^ in1[SIZE-1:0] ^ in2[SIZE-1:0];
module xnor2 ( out, in0, in1 );
input [SIZE-1:0] in0, in1;
assign out = ~(in0 ^ in1) ;
module xnor3 (out, in0, in1, in2);
assign out[SIZE-1:0] = ~(in0[SIZE-1:0] ^ in1[SIZE-1:0] ^ in2[SIZE-1:0]);
assign out[SIZE-1:0] = in[SIZE-1:0];
assign out[SIZE-1:0] = ~in[SIZE-1:0];
module cla(out, cout, in0, in1, cin);
assign {cout,out[SIZE-1:0]} = ({1'b0,in0[SIZE-1:0]} + {1'b0,in1[SIZE-1:0]} + {{SIZE{1'b0}},cin});
module incr(out, cout, in, cin);
assign {cout,out[SIZE-1:0]} = ({1'b0,in[SIZE-1:0]} + {{SIZE{1'b0}},cin});
module cmp(out, in0, in1);
assign out = (in0[SIZE-1:0] == in1[SIZE-1:0]);
assign out = (in[SIZE-1:0] == {SIZE{1'b0}});
assign out = ^in[SIZE-1:0];
module csa32(sum, carry, in0, in1, in2);
assign carry[SIZE-1:0] = ((in0[SIZE-1:0] & in1[SIZE-1:0] ) |
(in0[SIZE-1:0] & in2[SIZE-1:0] ) |
(in1[SIZE-1:0] & in2[SIZE-1:0]));
assign sum[SIZE-1:0] = (in0[SIZE-1:0] ^ in1[SIZE-1:0] ^ in2[SIZE-1:0]);
module csa42(sum, carry, cout, cin, in0, in1, in2, in3);
wire [SIZE-1:0] i0_xor_i1 = (in0[SIZE-1:0] ^ in1[SIZE-1:0]);
wire [SIZE-1:0] co = ((in0[SIZE-1:0] & in1[SIZE-1:0]) |
(in0[SIZE-1:0] & in2[SIZE-1:0]) |
(in1[SIZE-1:0] & in2[SIZE-1:0]));
assign cout = co[SIZE-1];
wire [SIZE:0] cint = { co[SIZE-1:0], cin };
assign cint_unused = cint[SIZE];
assign carry[SIZE-1:0] = ((~i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & in3[SIZE-1:0] & cint[SIZE-1:0]) |
(~i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & ~in3[SIZE-1:0] & cint[SIZE-1:0]) |
(~i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0] ) |
( i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & ~in3[SIZE-1:0] & cint[SIZE-1:0]) |
( i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & in3[SIZE-1:0] ) |
( i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0] & cint[SIZE-1:0]));
assign sum[SIZE-1:0] = ((~i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & ~in3[SIZE-1:0] & cint[SIZE-1:0]) |
(~i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & in3[SIZE-1:0] & ~cint[SIZE-1:0]) |
(~i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & ~in3[SIZE-1:0] & ~cint[SIZE-1:0]) |
(~i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0] & cint[SIZE-1:0]) |
( i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & ~in3[SIZE-1:0] & ~cint[SIZE-1:0]) |
( i0_xor_i1[SIZE-1:0] & ~in2[SIZE-1:0] & in3[SIZE-1:0] & cint[SIZE-1:0]) |
( i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & ~in3[SIZE-1:0] & cint[SIZE-1:0]) |
( i0_xor_i1[SIZE-1:0] & in2[SIZE-1:0] & in3[SIZE-1:0] & ~cint[SIZE-1:0]));
module andmux8(out, in7,in6,in5,in4,in3,in2,in1,in0,
en7,en6,en5,en4,en3,en2,en1,en0,
sel7,sel6,sel5,sel4,sel3,sel2,sel1,sel0);
assign out = ({SIZE{sel0}} & in0 & en0) |
({SIZE{sel1}} & in1 & en1) |
({SIZE{sel2}} & in2 & en2) |
({SIZE{sel3}} & in3 & en3) |
({SIZE{sel4}} & in4 & en4) |
({SIZE{sel5}} & in5 & en5) |
({SIZE{sel6}} & in6 & en6) |
({SIZE{sel7}} & in7 & en7);