1 /********************************************************************************* 2 * Company : 3 * Engineer : 空气微凉 4 * 5 * Create Date : 00:00:00 22/03/2013 6 * Design Name : 7 * Module Name : 8 * Project Name : 9 * Target Devices : 10 * Tool versions : 11 * Description : 12 * http://www.cnblogs.com/kongqiweiliang/ 13 * Dependencies : 14 * 15 * Revision : 16 * Revision : 0.01 - File Created 17 * Additional Comments : 基础实验_10_移位寄存器 :常见普通移位寄存器 18 ********************************************************************************/ 19 `timescale 1ns/1ps 20 `define UD #1 21 /*******************************************************************************/ 22 module SHIFT_REG 23 ( 24 //system interface 25 input iCLK_50 ,//50MHz 26 input iRESET ,//system interface 27 //Interface package 28 input iDAT_EN ,// 29 input iDAT ,// 30 output oDAT // 31 ); 32 //------------------------------------------------------------------------------- 33 reg [7:0] SHIFT_REG; 34 reg [7:0] SHIFT_REG_N; 35 always@(posedge iCLK_50 or negedge iRESET)begin 36 if(!iRESET) 37 SHIFT_REG <= 8'h0; 38 else 39 SHIFT_REG <= SHIFT_REG_N; 40 end 41 always@(*)begin 42 if(iDAT_EN == 1'h1) 43 SHIFT_REG_N = {SHIFT_REG[7:1],iDAT}; 44 else 45 SHIFT_REG_N = SHIFT_REG; 46 end 47 48 assign oDAT = SHIFT_REG[7]; 49 //------------------------------------------------------------------------------- 50 endmodule