-
Notifications
You must be signed in to change notification settings - Fork 0
/
forwarding_unit.v
37 lines (31 loc) · 955 Bytes
/
forwarding_unit.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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/18/2021 04:03:31 PM
// Design Name:
// Module Name: forwarding_unit
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module forwarding_unit(input [4:0] ID_EX_Rs1, [4:0]ID_EX_Rs2, [4:0]MEM_WB_Rd, input MEM_WB_RegWrite, output reg forwardA, output reg forwardB);
always@(*) begin
if ( (MEM_WB_RegWrite ) && (MEM_WB_Rd != 0) && (MEM_WB_Rd == ID_EX_Rs1) )
forwardA = 1'b1;
else forwardA = 0;
if ( (MEM_WB_RegWrite ) && (MEM_WB_Rd != 0) && (MEM_WB_Rd == ID_EX_Rs2) )
forwardB = 1'b1;
else
forwardB = 0;
end
endmodule