-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDecoder.v
More file actions
55 lines (51 loc) · 1.27 KB
/
Copy pathDecoder.v
File metadata and controls
55 lines (51 loc) · 1.27 KB
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
// 2016 Ryan Leonard
// Decoder Module
//
// R-type
// opcode rs rt rd shamt alu_function
// ______ ______ ______ ______ ______ ______
// |______|______|______|______|______|______|
// 6bit 5bit 5bit 5bit 5bit 6bit
//
//
// I-type
// opcode rs rt immediate
// ______ ______ ______ ____________________
// |______|______|______|____________________|
// 6bit 5bit 5bit 16bit
//
// J-type
// opcode jump_target
// ______ __________________________________
// |______|__________________________________|
// 6bit 26bit
//
module decoder_32(
instruction,
opcode,
rs,
rt,
rd,
shamt,
funct,
immediate,
jump_target
);
input wire [31:0] instruction;
output wire [5:0] opcode;
output wire [4:0] rs;
output wire [4:0] rt;
output wire [4:0] rd;
output wire [4:0] shamt;
output wire [5:0] funct;
output wire [15:0] immediate;
output wire [25:0] jump_target;
assign opcode = instruction[31:26];
assign rs = instruction[25:21];
assign rt = instruction[20:16];
assign rd = instruction[15:11];
assign shamt = instruction[10:06];
assign funct = instruction[05:00];
assign immediate = instruction[15:00];
assign jump_target = instruction[25:00];
endmodule