Added files into modelsim folder

This commit is contained in:
TroubleElectrical committed 2026-10-16 10:10:37 +11:00
1 parent 8ed06d38e1
commit dca673b039
14 files changed
+436 -13

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
`ifndef SIGN_EXTENDER_H
`define SIGN_EXTENDER_H
module sign_extender #(in_width=4, out_width=5)(
input logic [0:0] op,
input logic [2**in_width-1:0] val,
output logic [2**out_width-1:0] ext_val
);
always_comb begin
if (op) begin
ext_val = { {(2**(out_width-in_width)){val[2**in_width-1]}}, val};
end else begin
ext_val = ({{(2**(out_width-in_width)){1'b0}}, val});
end
end
endmodule
`endif