Skip to content

Commit 0cc3ad2

Browse files
committed
加入移位運算元
遺忘地方: - 使用過往重置直接在運算地方重置
1 parent d8a91cf commit 0cc3ad2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module shift_microoperation (
2+
clock,
3+
reset,
4+
a_in,
5+
lift_serial_input,
6+
right_serial_input,
7+
selective_set,
8+
data
9+
);
10+
input clock, reset;
11+
input [3:0] a_in;
12+
input lift_serial_input;
13+
input right_serial_input;
14+
input selective_set;
15+
output [3:0] data;
16+
17+
reg [3:0] data;
18+
19+
always @ (posedge clock) begin
20+
if (reset) begin
21+
data = 0;
22+
end else begin
23+
case (selective_set)
24+
0: data = {right_serial_input, a_in[3:1]};
25+
1: data = {a_in[2:0], lift_serial_input};
26+
endcase
27+
end
28+
end
29+
30+
endmodule

0 commit comments

Comments
 (0)