-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoadstore.v
More file actions
41 lines (36 loc) · 1007 Bytes
/
Copy pathLoadstore.v
File metadata and controls
41 lines (36 loc) · 1007 Bytes
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13.09.2024 12:36:47
// Design Name:
// Module Name: MAC
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Loadstore(
input en, s,
input [2:0] funct3, // funct3
input [11:0] imm, // immediate
input [31:0] op1, op2, // Operand-0 and Operand-1 from register file
output reg [31:0] mem_address, store_data //Address and data
);
always @ (posedge en) begin
case(funct3[1:0])
0: store_data = op2[7:0];
1: store_data = op2[15:0];
default: store_data = op2;
endcase
if(s) mem_address = op1 + {{(20){imm[11]}}, imm};
end
endmodule