HDLBits网址:https://hdlbits.01xz.net/wiki/Main_Page
1、逻辑移位寄存器
题目
Build a 4-bit shift register (right shift), with asynchronous reset, synchronous load, and enable.
-
areset: Resets shift register to zero.
-
load: Loads shift register with data[3:0] instead of shifting.
-
ena: Shift right (q[3] becomes zero, q[0] is shifted out and disappears).
-
q: The contents of the shift register.
If both the load and ena inputs are asserted (1), the load input has higher priority.
我的设计
移位其实就是做乘法除法,左移为乘法,右移为除法,其他也没有什么好注意的地方了,直接贴代码
module top_module(
input clk,
input areset, // async active-high reset to zero
input load,
input ena,