Implemented shifter and its test bench code fully
This commit is contained in:
3 files changed
+84
-8
No files matched your search
+8
-5
@@ -1,12 +1,15 @@
|
||||
module shifter #(width=8)(input logic op[1:0],
|
||||
input logic[width-1:0] A, input logic[width-1:0] B,
|
||||
module shifter #(width=8)(input logic [2:0] op,
|
||||
input logic[width-1:0] A, input logic[width-1:0] C, input logic[$clog2(width)-1:0] B,
|
||||
output logic[width-1:0] OUT_1);
|
||||
|
||||
always_comb begin
|
||||
case (op)
|
||||
00: OUT_1 = A << B;
|
||||
01: OUT_1 = A >> B;
|
||||
10: OUT_1 = $signed(A) >>> B;
|
||||
3'b000: OUT_1 = A << C;
|
||||
3'b001: OUT_1 = A >> C;
|
||||
3'b011: OUT_1 = $signed(A) >>> C;
|
||||
3'b100: OUT_1 = A << B;
|
||||
3'b101: OUT_1 = A >> B;
|
||||
3'b111: OUT_1 = $signed(A) >>> B;
|
||||
default:;
|
||||
endcase
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user