forked from oliverbunting/verilator-unisims
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBUFGMUX.v
80 lines (67 loc) · 2.01 KB
/
BUFGMUX.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/unisims/BUFGMUX.v,v 1.16 2009/08/21 23:55:43 harikr Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 10.1
// \ \ Description : Xilinx Functional Simulation Library Component
// / / Global Clock Mux Buffer with Output State 0
// /___/ /\ Filename : BUFGMUX.v
// \ \ / \ Timestamp : Thu Mar 25 16:42:14 PST 2004
// \___\/\___\
//
// Revision:
// 03/23/04 - Initial version.
// 05/23/07 - Changed timescale to 1 ps / 1 ps.
// 01/11/08 - Add CLK_SEL_TYPE attribute.
// End Revision
`timescale 1 ps / 1 ps
module BUFGMUX (O, I0, I1, S);
parameter CLK_SEL_TYPE = "SYNC";
output O;
input I0, I1, S;
reg q0, q1;
/* verilator lint_off UNOPTFLAT */
reg q0_enable, q1_enable;
/* verilator lint_on UNOPTFLAT */
wire q0_t, q1_t;
reg clk_sel_in;
wire GSR = 0;//tri0 GSR = glbl.GSR;
// bufif1 B0 (O, I0, q0_t);
// bufif1 B1 (O, I1, q1_t);
// pulldown P1 (O);
assign O = (q0_t) ? I0 : (q1_t) ? I1 : 0;
/* verilator lint_off WIDTH */
initial
clk_sel_in = (CLK_SEL_TYPE == "ASYNC") ? 1 : 0;
/* verilator lint_on WIDTH */
assign q0_t = (clk_sel_in) ? ~S : q0;
assign q1_t = (clk_sel_in) ? S : q1;
always @(GSR or I0 or S or q0_enable)
if (GSR)
q0 = 1;
else if (!I0)
q0 = !S && q0_enable;
always @(GSR or I1 or S or q1_enable)
if (GSR)
q1 = 0;
else if (!I1)
q1 = S && q1_enable;
always @(GSR or q1 or I0)
if (GSR)
q0_enable = 1;
else if (q1)
q0_enable = 0;
else if (I0)
q0_enable = !q1;
always @(GSR or q0 or I1)
if (GSR)
q1_enable = 0;
else if (q0)
q1_enable = 0;
else if (I1)
q1_enable = !q0;
endmodule