-
Notifications
You must be signed in to change notification settings - Fork 178
/
Copy path109_Shift18.v
35 lines (33 loc) · 892 Bytes
/
109_Shift18.v
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
module top_module(
input clk,
input load,
input ena,
input [1:0] amount,
input [63:0] data,
output reg [63:0] q);
always @(posedge clk) begin
if(load == 1)begin
q = data;
end
else begin
if(ena == 1) begin
case(amount)
2'b00: q <= q << 1;
2'b01: q <= q << 8;
2'b10: begin
q <= q >> 1;
if(q[63] == 1) begin
q[63] <= 1;
end
end
2'b11: begin
q <= q >> 8;
if(q[63] == 1) begin
q[63:56] <= {8{1'b1}};
end
end
endcase
end
end
end
endmodule