forked from tanchou/Verilog
Refactor ultrasonic modules and testbench for improved functionality and clarity
This commit is contained in:
@@ -64,21 +64,25 @@ module top_uart_ultrason_command (
|
||||
always @(posedge clk) begin
|
||||
if (data_available) begin
|
||||
command <= rd_data[1:0];
|
||||
leds <= rd_data[7:2];
|
||||
end else begin
|
||||
command <= 0;
|
||||
end
|
||||
leds <= {~command, ~mesure_state};
|
||||
end
|
||||
|
||||
always @(posedge clk) begin // Mesure state machine
|
||||
case (mesure_state)
|
||||
IDLE: begin
|
||||
|
||||
if (command == 2'd1 && data_available) begin
|
||||
mesure_state <= ONESTART;
|
||||
rd_en <= 1;
|
||||
end else if (command == 2'd2 && data_available) begin
|
||||
mesure_state <= CONTINUOUSSTART;
|
||||
rd_en <= 1;
|
||||
end else if (command == 2'd3 && data_available) begin
|
||||
mesure_state <= IDLE;
|
||||
rd_en <= 1;
|
||||
end else begin
|
||||
mesure_state <= IDLE;
|
||||
rd_en <= 0;
|
||||
|
Reference in New Issue
Block a user