1 / 2
文档名称:

移位寄存器66934.doc

格式:doc   页数:2页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

移位寄存器66934.doc

上传人:zbfc1172 2015/10/24 文件大小:0 KB

下载得到文件列表

移位寄存器66934.doc

相关文档

文档介绍

文档介绍:右移移位寄存器(高位补1)
module right(CLK,QB,DIN,LOAD);
input CLK,LOAD;
input [7:0] DIN;
output QB;
reg [7:0] REG8;
always @(posedge CLK)begin
if(LOAD) REG8<=DIN;
else REG8[6:0]<=REG8[7:1];end
assign QB=REG8[0] ;
endmodule
左移移位寄存器(低位补零)
module left(CLK,QB,DIN,LOAD);
input CLK,LOAD;
input [7:0] DIN;
output QB;
reg [7:0] REG8;
always @(posedge CLK)begin
if(LOAD) REG8<=DIN;
else REG8[7:1]<=REG8[6:0];end
assign QB=REG8[7] ;
endmodule
循环左移
module sleft(CLK,QB,DIN,LOAD);
input CLK,LOAD;
input [7:0] DIN;
output QB;
reg [7:0] REG8;
always @(posedge CLK)begin
if(LOAD) REG8<=DIN;
else begin REG8[0]<=REG8[7]; REG8[7:1]<=REG8[6:0];end
end
assign QB=REG8;
endmodule
循环右移
module sright(CLK,QB,DIN,LOAD);
input CLK,LOAD;
input [7:0] DIN;
output[7:0] QB;
reg [7:0] REG8;
always @(posedge CLK)begin
if(LOAD) REG8<=DIN;
else begin REG8[7]<=REG8[0]; REG8[6:0]<=REG8[7:1];end
end
assign QB=REG8;
endmodule