博客首页 | 排行榜 |

freewind的博客

个人档案
博文分类
移位寄存器verilog  2009-03-16 08:34
//-----------------------------------------------------------------------------------
// DESCRIPTION   :  Shift register
//                  Type : univ
//                  Width : 4
//                  Shift direction: right/left (right active high)
//
//                  CLK active : high
//                  CLR active : high
//                  CLR type : synchronous
//                  SET active : high
//                  SET type : synchronous
//                  LOAD active : high
//                  CE active : high
//                  SERIAL input : SI
//
// Download from :  http://www.pld.com.cn
//-----------------------------------------------------------------------------------


module shft_reg (CLR , SET , DIR , CE , LOAD , DATA , SI , data_out , CLK );
input CLR , SET , CE , LOAD , DIR , SI , CLK ;
input [3:0] DATA ;
output [3:0] data_out ;



reg [3:0] TEMP;

always @(posedge CLK )
begin
if (CE == 1'b1)
if (CLR == 1'b1)
TEMP = {4{1'b0}};
else if (SET == 1'b1)
TEMP = {4{1'b1}};
else if (LOAD == 1'b1)
TEMP = DATA ;
else if (DIR == 1'b1)
TEMP = {SI , TEMP [3:1]};
else
TEMP = {TEMP [2:0], SI };
end

assign data_out = TEMP;
endmodule
我的毕业设计的题目是基于设计,但是我一点头绪的还没有那不知道从何做起,有点老虎吃天无处下口的感觉,o(∩_∩)o...有点郁闷呀。
有这方面的高手希望给点建议。
|
上一篇:简单状态机&&多路选择器 | 下一篇:新年要快乐,为什么我总也高兴不起来?
以下网友评论只代表其个人观点,不代表本网站的观点或立场