-
Notifications
You must be signed in to change notification settings - Fork 0
/
Execute.sv
58 lines (51 loc) · 1.83 KB
/
Execute.sv
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
/**
***********************************************
Instituto Tecnologico de Costa Rica
Ingenieria en Electronica
Etapa Execute
Autores: Esteban Aguero Perez
Michael Gonzalez Rivera
Daniela Hernandez Alvarado
Lenguaje: SystemVerilog
Version: 1.0
Ultima Modificacion: 26/09/2018
Entradas:- Señales de control
- Operandos Ra y Rb
- Direccion de Rd
Restricciones:
- Verificar las señales de control
Salidas: - Señales de control
- Resultado de la exe
Arquitectura de Computadores I 2018
Prof. Ronald Garcia
***********************************************
**/
module Execute #(parameter N=32)
(input logic MemPWrite, RegWrite, MemWrite, BranchInst, ALUSrc, FlagWrite, PAUOp, IOFlag, ResultSrc, clk,
input logic [1:0] MemToReg,
input logic [3:0] ALUControl,
input logic [2:0] CondFlag,
input logic [31:0] Ra, Rb, ExtIm,
input logic [3:0] Rd,
output logic PCSrc, RegWriteOut, MemWriteOut, MemPWriteOut, IOFlagOut,
output logic [1:0] MemToRegOut,
output logic [N-1:0] ALUResult, WriteData,
output logic [3:0] RdOut);
logic z, v, n, enable2, condi;
logic [31:0] ALUOut, APUout, RbMux;
assign MemPWriteOut = MemPWrite;
//assign RegWriteOut = RegWrite;
assign MemToRegOut = MemToReg;
assign MemWriteOut = MemWrite;
assign IOFlagOut = IOFlag;
assign RdOut = Rd;
assign WriteData = Rb;
assign enable2 = BranchInst | RegWrite; //new
assign RegWriteOut = condi & RegWrite; //new
assign PCSrc = condi & BranchInst; //new
ConditionalUnit UniCondicion (z, v, n, FlagWrite, enable2, clk, CondFlag, condi);
ALU #(32) ALUnit (Ra, RbMux, ALUControl, z, n, v, ALUOut);
PAU #(32) PAUnit (Ra, Rb,PAUOp, APUout);
assign RbMux = (ALUSrc) ? ExtIm : Rb;
assign ALUResult = (ResultSrc) ? APUout : ALUOut;
endmodule