Created
September 16, 2013 14:08
-
-
Save coldcue/6581144 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`timescale 1ns / 1ps | |
module knightrider( | |
input rst, | |
input clk, | |
input ce, | |
output [7:0] out | |
); | |
parameter START = 8'b00001110; | |
parameter END = 8'b01110000; | |
reg dir; | |
reg ld; | |
shiftreg_8 shr ( | |
.din(1'b0), | |
.dload(START), | |
.data(out), | |
.rst(rst), | |
.ce(ce), | |
.clk(clk), | |
.dir(dir), | |
.ld(ld) | |
); | |
always @ (posedge clk) begin | |
case(out) | |
8'b0: begin | |
dir <= 0; | |
ld <= 1; | |
end | |
START: begin | |
ld <= 0; | |
dir <= 0; | |
end | |
END: begin | |
ld <= 0; | |
dir <= 1; | |
end | |
endcase | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment