-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoad_Generator.sv
More file actions
42 lines (40 loc) · 1.22 KB
/
Load_Generator.sv
File metadata and controls
42 lines (40 loc) · 1.22 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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/12/2025 10:35:30 PM
// Design Name: Load Generator
// Module Name: Load_Generator
// Project Name: RISC-V Single Cycle Processor
// Target Devices:
// Tool Versions:
// Description: Generates load data based on the control signal
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Load_Generator(
input [31:0] data_input,
input [2:0] control,
output reg [31:0] data_output,
input resetn
);
always @ (*) begin
if (!resetn) begin
data_output <= 32'h00000000;
end else begin
case(control)
3'b000: data_output <= {{24{data_input[7]}}, data_input[7:0]};
3'b001: data_output <= {{16{data_input[15]}}, data_input[15:0]};
3'b010: data_output <= data_input[31:0];
3'b100: data_output <= {24'b0, data_input[7:0]};
3'b101: data_output <= {16'b0, data_input[15:0]};
endcase
end
end
endmodule