-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathALUdecode.v
59 lines (57 loc) · 1.22 KB
/
ALUdecode.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
`timescale 1ns / 1ps
module ALUdecode(
input [31:0]B,IMM,
input [5:0]opcode,
output [2:0]func,
output [31:0]opB
);
reg [2:0]y;
reg [31:0]i;
always@(*)
begin
case(opcode)
6'b000001,6'b000010,6'b000011 : begin
y=3'b001;
i=B;
end
6'b000100 : begin
y=3'b010;
i=B;
end
6'b000101 : begin
y=3'b011;
i=B;
end
6'b000110 : begin
y=3'b100;
i=B;
end
6'b000111 : begin
y=3'b101;
i=B;
end
6'b001000 : begin
y=3'b110;
i=B;
end
6'b001001 : begin
y=3'b001;
i=IMM;
end
6'b001010 : begin
y=3'b010;
i=IMM;
end
6'b001011 : begin
y=3'b110;
i=IMM;
end
default : begin
y=3'bxxx;
i=1'bx;
end
endcase
end
assign func=y;
assign opB=i;
endmodule