forked from uwsampl/verilator-unisims
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LUT2.v
33 lines (24 loc) · 735 Bytes
/
LUT2.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
`timescale 1 ps / 1 ps
module LUT2 (O, I0, I1);
parameter INIT = 4'h0;
input I0, I1;
output O;
reg O;
wire [1:0] s;
assign s = {I1, I0};
always @(s)
if ((s[1]^s[0] ==1) || (s[1]^s[0] ==0))
O = INIT[s];
else if ((INIT[0] == INIT[1]) && (INIT[2] == INIT[3]) && (INIT[0] == INIT[2]))
O = INIT[0];
else if ((s[1] == 0) && (INIT[0] == INIT[1]))
O = INIT[0];
else if ((s[1] == 1) && (INIT[2] == INIT[3]))
O = INIT[2];
else if ((s[0] == 0) && (INIT[0] == INIT[2]))
O = INIT[0];
else if ((s[0] == 1) && (INIT[1] == INIT[3]))
O = INIT[1];
else
O = 1'bx;
endmodule