forked from tanchou/Verilog
Add testbench for top_ultrasonic_led module
- 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.
This commit is contained in:
28
Semaine 1/Capteur_recule/top_ultrasonic_led.v
Normal file
28
Semaine 1/Capteur_recule/top_ultrasonic_led.v
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
Reference in New Issue
Block a user