Showing
1 changed file
with
29 additions
and
0 deletions
Project/SingleCycle/Mux.v
0 → 100644
1 | +module Mux5bit(input1, input2, signal, output1); | ||
2 | + | ||
3 | +input[4:0] input1, input2; | ||
4 | +input signal; | ||
5 | +output reg[4:0] output1; | ||
6 | + | ||
7 | +always @(*) begin | ||
8 | + case(signal) | ||
9 | + 1'b0: output1 = input1; | ||
10 | + 1'b1: output1 = input2; | ||
11 | + endcase | ||
12 | +end | ||
13 | + | ||
14 | +endmodule | ||
15 | + | ||
16 | +module Mux32bit(input1, input2, signal, output1); | ||
17 | + | ||
18 | +input[31:0] input1, input2; | ||
19 | +input signal; | ||
20 | +output reg[31:0] output1; | ||
21 | + | ||
22 | +always @(*) begin | ||
23 | + case(signal) | ||
24 | + 1'b0: output1 = input1; | ||
25 | + 1'b1: output1 = input2; | ||
26 | + endcase | ||
27 | +end | ||
28 | + | ||
29 | +endmodule |
-
Please register or login to post a comment