// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: niu_pio_macros.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 ============================================
/*****************************************************************
* File Name : niu_pio_macros.v
* Description : It contains macros.
* Copyright (c) 2020, Sun Microsystems, Inc.
* Sun Proprietary and Confidential
****************************************************************/
//*****************************
//*****************************
module pio_xREG2 (clk,reset,reset_value,load,din,qout);
input [dwidth-1:0] reset_value;
output [dwidth-1:0] qout;
/***********************************
***********************************/
module rffre (clk,reset,rst,en,d,q);
always @ (rst or en or d or q)
dffr #(1) dffr (.clk(clk),.reset(reset),.d(nx_q),.q(q));
/***********************************
* 6 bit count down counter
***********************************/
module timer_6bit (clk,reset,rst,dec,en,d,q);
always @ (rst or en or d or q or dec)
else if (~(|q)) // q == 0
dffr #(6) dffr (.clk(clk),.reset(reset),.d(nx_q),.q(q));
/***********************************
* 20 bit resolution counter
***********************************/
module rtimer_20bit (clk,reset,dec_timer,en,d,q);
dffre #(20) resolution_dffre (.clk(clk),.reset(reset),.en(en),.d(d),.q(q));
// assign nx_cnt = cnt +1;
always @ (q or cnt or timer_pls)
if ((~(|q)) | timer_pls) // q == 0
dffr #(20) cnt_dffr (.clk(clk),.reset(reset),.d(nx_cnt),.q(cnt));
assign timer_pls = (cnt == q) ;
df1 #(1) dec_timer_df1 (.clk(clk),.d(timer_pls),.q(dec_timer));
module niu_pls_gen2 (clk,sig_in,lead,trail);
wire sig_in, sig_out,lead,trail;
df1 sig_out_df1 (.clk(clk),.d(sig_in),.q(sig_out));
assign lead = sig_in & ~sig_out;
assign trail= ~sig_in & sig_out;
module mux_r64to1(din,sel,dout);
casex(sel) // synopsys parallel_case full_case
module niu_pio_mux_2to1_x144(dout, select, din1, din0);
input [143:0] din1, din0;
wire [143:0] din1, din0, dout;
// Use the following code when IBM is NOT used as founder
assign dout = select ? din1 : din0;
endmodule // niu_pio_mux_2to1_x144