forked from tanchou/Verilog
- Created a new testbench file `top_ultrasonic_led_tb.vvp` to simulate the `top_ultrasonic_led` module. - Defined the necessary signals and events for testing the ultrasonic sensor functionality. - Implemented the main test sequence including triggering the ultrasonic sensor and monitoring the output LEDs based on distance measurements. - Included timing and state management for accurate simulation of the ultrasonic sensor behavior.
28 lines
658 B
Verilog
28 lines
658 B
Verilog
module top_ultrasonic_led (
|
|
input wire clk,
|
|
input wire rst,
|
|
input wire start, // bouton ou signal de départ
|
|
input wire echo, // signal du capteur
|
|
output wire trig, // vers le capteur
|
|
output wire [5:0] leds // sorties LED
|
|
);
|
|
|
|
wire [8:0] distance;
|
|
|
|
// Module de mesure de distance
|
|
ultrasonic_fpga ultrasonic_inst (
|
|
.clk(clk),
|
|
.rst(rst),
|
|
.start(start),
|
|
.echo(echo),
|
|
.trig_out(trig),
|
|
.distance(distance)
|
|
);
|
|
|
|
// Module d'affichage leds
|
|
distance_display_led led_display_inst (
|
|
.distance(distance),
|
|
.leds(leds)
|
|
);
|
|
|
|
endmodule |