4位移位寄存器-HDLbits

4位移位寄存器,右移,异步复位,置数,使能;

置数比使能优先级高;

module top_module(
input clk,
input areset, // async active-high reset to zero
input load,
input ena,
input [3:0] data,
output reg [3:0] q);
always @(posedge clk,posedge areset)
if(areset)
q<=4'd0;
else if(load)
q<=data;
else if(ena)
q<={1'b0,q[3:1]};
else
q<=q;
endmodule

 

posted on 2025-12-09 09:41  yf.x  阅读(4)  评论(0)    收藏  举报

导航