Added files into modelsim folder
This commit is contained in:
14 files changed
+436
-13
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user