-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main_Decoder.v
23 lines (21 loc) · 1.06 KB
/
Main_Decoder.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Main_Decoder(Op,RegWrite,ImmSrc,ALUSrc,MemWrite,ResultSrc,Branch,ALUOp);
input [6:0]Op;
output RegWrite,ALUSrc,MemWrite,ResultSrc,Branch;
output [1:0]ImmSrc,ALUOp;
assign RegWrite = (Op == 7'b0000011 | Op == 7'b0110011) ? 1'b1 :
1'b0 ;
assign ImmSrc = (Op == 7'b0100011) ? 2'b01 :
(Op == 7'b1100011) ? 2'b10 :
2'b00 ;
assign ALUSrc = (Op == 7'b0000011 | Op == 7'b0100011) ? 1'b1 :
1'b0 ;
assign MemWrite = (Op == 7'b0100011) ? 1'b1 :
1'b0 ;
assign ResultSrc = (Op == 7'b0000011) ? 1'b1 :
1'b0 ;
assign Branch = (Op == 7'b1100011) ? 1'b1 :
1'b0 ;
assign ALUOp = (Op == 7'b0110011) ? 2'b10 :
(Op == 7'b1100011) ? 2'b01 :
2'b00 ;
endmodule