串列輸入並列輸出移位暫存器(SIPO)
//RESET --> KEY[0]
//Serial_IN Data ==> SW[0]
//Enable ==>SW[17]
//Clock ==>KEY[1]
//Output LED[7:0]
module _8bit_Sin_Pout(SW,KEY,LEDR,CLOCK_50);
input [17:0]SW;
input [3:0]KEY;
input CLOCK_50;
output [17:0]LEDR;
EN_SIN_POUT_SHIFT ( .RESET_B(KEY[0]),
.IN(SW[0]),
.CLK(KEY[1]),
.EN(SW[17]),
.Q(LEDR[7:0]) );
endmodule
/* EN_SIN_POUT_SHIFT */
module EN_SIN_POUT_SHIFT ( RESET_B, IN, CLK, EN, Q );
input RESET_B, CLK, IN, EN;
output [7:0] Q;
reg [7:0] Q;
always @( negedge CLK or negedge RESET_B )
if ( !RESET_B )
Q <= 0;
else if ( EN )
Q <= {Q,IN};
endmodule
沒有留言:
張貼留言