forked from tanchou/Verilog
		
	- Created a new testbench file `top_ultrasonic_led_tb.vvp` to simulate the functionality of the `top_ultrasonic_led` module. - Included necessary signal definitions and event triggers for clock, reset, start, echo, and trigger signals. - Implemented a state machine to handle the ultrasonic measurement process and LED display logic. - Added simulation parameters for distance measurement and LED control. - Integrated VPI calls for waveform dumping and simulation control.
		
			
				
	
	
		
			27 lines
		
	
	
		
			645 B
		
	
	
	
		
			Verilog
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			645 B
		
	
	
	
		
			Verilog
		
	
	
	
	
	
| module top_ultrasonic_led (
 | |
|     input wire clk,
 | |
|     input wire rst,
 | |
|     input wire start,       // bouton de déclenchement
 | |
|     inout wire sig,         // broche unique pour trigger + echo
 | |
|     output wire [5:0] leds  // LEDs pour affichage distance
 | |
| );
 | |
| 
 | |
|     wire [8:0] distance;
 | |
| 
 | |
|     // Module de mesure (version bidirectionnelle du capteur)
 | |
|     ultrasonic_fpga_onewire ultrasonic_inst (
 | |
|         .clk(clk),
 | |
|         .rst(rst),
 | |
|         .start(start),
 | |
|         .sig(sig),
 | |
|         .distance(distance)
 | |
|     );
 | |
| 
 | |
|     // Module d'affichage LEDs
 | |
|     distance_display_led led_display_inst (
 | |
|         .distance(distance),
 | |
|         .leds(leds)
 | |
|     );
 | |
| 
 | |
| endmodule
 |