mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	verilog: fix sizing of ports with int types in module headers
Declaring the ports as standard module items already worked as expected. This adds a missing usage of `checkRange()` so that headers such as `module m(output integer x);` now work correctly.
This commit is contained in:
		
							parent
							
								
									1ec5994100
								
							
						
					
					
						commit
						10a6bc9b81
					
				
					 3 changed files with 64 additions and 2 deletions
				
			
		
							
								
								
									
										50
									
								
								tests/verilog/port_int_types.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								tests/verilog/port_int_types.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
`define INITS \
 | 
			
		||||
    assign a = -1; \
 | 
			
		||||
    assign b = -2; \
 | 
			
		||||
    assign c = -3; \
 | 
			
		||||
    assign d = -4; \
 | 
			
		||||
    assign a_ext = a; \
 | 
			
		||||
    assign b_ext = b; \
 | 
			
		||||
    assign c_ext = c; \
 | 
			
		||||
    assign d_ext = d;
 | 
			
		||||
 | 
			
		||||
module gate_a(
 | 
			
		||||
    output byte a,
 | 
			
		||||
    output byte unsigned b,
 | 
			
		||||
    output shortint c,
 | 
			
		||||
    output shortint unsigned d,
 | 
			
		||||
    output [31:0] a_ext,
 | 
			
		||||
    output [31:0] b_ext,
 | 
			
		||||
    output [31:0] c_ext,
 | 
			
		||||
    output [31:0] d_ext
 | 
			
		||||
);
 | 
			
		||||
    `INITS
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
module gate_b(
 | 
			
		||||
    a, b, c, d,
 | 
			
		||||
    a_ext, b_ext, c_ext, d_ext
 | 
			
		||||
);
 | 
			
		||||
    output byte a;
 | 
			
		||||
    output byte unsigned b;
 | 
			
		||||
    output shortint c;
 | 
			
		||||
    output shortint unsigned d;
 | 
			
		||||
    output [31:0] a_ext;
 | 
			
		||||
    output [31:0] b_ext;
 | 
			
		||||
    output [31:0] c_ext;
 | 
			
		||||
    output [31:0] d_ext;
 | 
			
		||||
    `INITS
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
module gold(
 | 
			
		||||
    output signed [7:0] a,
 | 
			
		||||
    output unsigned [7:0] b,
 | 
			
		||||
    output signed [15:0] c,
 | 
			
		||||
    output unsigned [15:0] d,
 | 
			
		||||
    output [31:0] a_ext,
 | 
			
		||||
    output [31:0] b_ext,
 | 
			
		||||
    output [31:0] c_ext,
 | 
			
		||||
    output [31:0] d_ext
 | 
			
		||||
);
 | 
			
		||||
    `INITS
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										11
									
								
								tests/verilog/port_int_types.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								tests/verilog/port_int_types.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
read_verilog -sv port_int_types.sv
 | 
			
		||||
equiv_make gold gate_a equiv
 | 
			
		||||
equiv_simple
 | 
			
		||||
equiv_status -assert
 | 
			
		||||
 | 
			
		||||
design -reset
 | 
			
		||||
 | 
			
		||||
read_verilog -sv port_int_types.sv
 | 
			
		||||
equiv_make gold gate_b equiv
 | 
			
		||||
equiv_simple
 | 
			
		||||
equiv_status -assert
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue