forked from TimRudy/ice-chips-verilog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path74153.v
32 lines (27 loc) · 744 Bytes
/
74153.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
// Dual 4-input multiplexer
module ttl_74153 #(parameter BLOCKS = 2, WIDTH_IN = 4, WIDTH_SELECT = $clog2(WIDTH_IN),
DELAY_RISE = 0, DELAY_FALL = 0)
(
input [BLOCKS-1:0] Enable_bar,
input [WIDTH_SELECT-1:0] Select,
input [WIDTH_IN*BLOCKS-1:0] A_2D,
output [BLOCKS-1:0] Y
);
//------------------------------------------------//
wire [WIDTH_IN-1:0] A [0:BLOCKS-1];
reg [BLOCKS-1:0] computed;
integer i;
always @(*)
begin
for (i = 0; i < BLOCKS; i++)
begin
if (!Enable_bar[i])
computed[i] = A[i][Select];
else
computed[i] = 1'b0;
end
end
//------------------------------------------------//
`ASSIGN_UNPACK(WIDTH_IN, BLOCKS, A, A_2D)
assign #(DELAY_RISE, DELAY_FALL) Y = computed;
endmodule