mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Add a test for interfaces on modules loaded on-demand
This commit is contained in:
		
							parent
							
								
									7d50b83322
								
							
						
					
					
						commit
						1aab608cff
					
				
					 5 changed files with 48 additions and 2 deletions
				
			
		
							
								
								
									
										20
									
								
								tests/svinterfaces/load_and_derive.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tests/svinterfaces/load_and_derive.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
// This test checks that we correctly elaborate interfaces in modules, even if they are loaded on
 | 
			
		||||
// demand. The "ondemand" module is defined in ondemand.sv in this directory and will be read as
 | 
			
		||||
// part of the hierarchy pass.
 | 
			
		||||
 | 
			
		||||
interface iface;
 | 
			
		||||
  logic [7:0] x;
 | 
			
		||||
  logic [7:0] y;
 | 
			
		||||
endinterface
 | 
			
		||||
 | 
			
		||||
module dut (input logic [7:0] x, output logic [7:0] y);
 | 
			
		||||
  iface intf();
 | 
			
		||||
  assign intf.x = x;
 | 
			
		||||
  assign y = intf.y;
 | 
			
		||||
 | 
			
		||||
  ondemand u(.intf);
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
module ref (input logic [7:0] x, output logic [7:0] y);
 | 
			
		||||
  assign y = ~x;
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										6
									
								
								tests/svinterfaces/load_and_derive.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/svinterfaces/load_and_derive.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
read_verilog -sv load_and_derive.sv
 | 
			
		||||
hierarchy -libdir . -check
 | 
			
		||||
flatten
 | 
			
		||||
equiv_make ref dut equiv
 | 
			
		||||
equiv_simple
 | 
			
		||||
equiv_status -assert
 | 
			
		||||
							
								
								
									
										5
									
								
								tests/svinterfaces/ondemand.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tests/svinterfaces/ondemand.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
// This is used by the load_and_derive test.
 | 
			
		||||
 | 
			
		||||
module ondemand (iface intf);
 | 
			
		||||
  assign intf.y = ~intf.x;
 | 
			
		||||
endmodule
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
#/bin/bash -e
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
./runone.sh  svinterface1
 | 
			
		||||
./runone.sh  svinterface_at_top
 | 
			
		||||
 | 
			
		||||
./run_simple.sh load_and_derive
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								tests/svinterfaces/run_simple.sh
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										15
									
								
								tests/svinterfaces/run_simple.sh
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Run a simple test with a .ys file
 | 
			
		||||
 | 
			
		||||
if [ $# != 1 ]; then
 | 
			
		||||
    echo >&2 "Expected 1 argument"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo -n "Test: $1 ->"
 | 
			
		||||
../../yosys $1.ys >$1.log_stdout 2>$1.log_stderr || {
 | 
			
		||||
    echo "ERROR!"
 | 
			
		||||
    exit 1
 | 
			
		||||
}
 | 
			
		||||
echo "ok"
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue