1 Verilog描述
module shift_s2p(
input din,
input clk,
input clr,
output reg [7:0] q
);
//串入并出移位寄存器
/* 该寄存器由8个同步D触发器组成 */
[email protected](posedge clk or negedge clr)begin
if(clr == 1'b0)
q <= 8'b0000_0000;
else
//q <= {q[6:0],din}; //非阻塞赋值
begin
q[0] = din; //阻塞赋值
q = q << 1; //阻塞赋值
end
end
endmodule
2 RTL视图
3 功能仿真