Created
October 12, 2017 09:27
-
-
Save buttercutter/2d5d42b0d36e25b63849579fd78f9b2e 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
module detect_start_bit(clk, serial_in, start_detected); // just a falling edge detector | |
input clk, serial_in; | |
output reg start_detected = 0; | |
reg previously_idle = 1; | |
always @(posedge clk) | |
begin | |
if((!serial_in) && (previously_idle) && (!start_detected)) | |
start_detected <= 1; | |
else | |
start_detected <= 0; | |
end | |
always @(posedge clk) | |
begin | |
if(serial_in) | |
previously_idle <= 1; | |
else | |
previously_idle <= 0; | |
end | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment