mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Gowin: deal with active-low tristate (#2971)
* deal with active-low tristate * remove empty port * update sim models * add expected lut1 to tests
This commit is contained in:
		
							parent
							
								
									c2866780d2
								
							
						
					
					
						commit
						c2d358484f
					
				
					 5 changed files with 15 additions and 7 deletions
				
			
		| 
						 | 
					@ -122,6 +122,13 @@ module	\$_DFFE_NP0P_ (input D, C, R, E, output Q);
 | 
				
			||||||
	wire _TECHMAP_REMOVEINIT_Q_ = 1;
 | 
						wire _TECHMAP_REMOVEINIT_Q_ = 1;
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module \$__GW_IOBUF (input I, OE, output O, inout IO);
 | 
				
			||||||
 | 
						IOBUF _TECHMAP_REPLACE_ (.I(I), .O(O), .OEN(~OE), .IO(IO));
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module \$__GW_TBUF (input I, OE, output O);
 | 
				
			||||||
 | 
						TBUF _TECHMAP_REPLACE_ (.I(I), .OEN(~OE), .O(O));
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module \$lut (A, Y);
 | 
					module \$lut (A, Y);
 | 
				
			||||||
	parameter WIDTH = 0;
 | 
						parameter WIDTH = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -573,14 +573,14 @@ endmodule
 | 
				
			||||||
module TBUF (O, I, OEN);
 | 
					module TBUF (O, I, OEN);
 | 
				
			||||||
  input I, OEN;
 | 
					  input I, OEN;
 | 
				
			||||||
  output O;
 | 
					  output O;
 | 
				
			||||||
  assign O = OEN ? I : 1'bz;
 | 
					  assign O = OEN ? 1'bz : I;
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module IOBUF (O, IO, I, OEN);
 | 
					module IOBUF (O, IO, I, OEN);
 | 
				
			||||||
  input I,OEN;
 | 
					  input I,OEN;
 | 
				
			||||||
  output O;
 | 
					  output O;
 | 
				
			||||||
  inout IO;
 | 
					  inout IO;
 | 
				
			||||||
  assign IO = OEN ? I : 1'bz;
 | 
					  assign IO = OEN ? 1'bz : I;
 | 
				
			||||||
  assign I = IO;
 | 
					  assign I = IO;
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -241,6 +241,9 @@ struct SynthGowinPass : public ScriptPass
 | 
				
			||||||
			if (retime || help_mode)
 | 
								if (retime || help_mode)
 | 
				
			||||||
				run("abc -dff -D 1", "(only if -retime)");
 | 
									run("abc -dff -D 1", "(only if -retime)");
 | 
				
			||||||
			run("splitnets");
 | 
								run("splitnets");
 | 
				
			||||||
 | 
								if (!noiopads || help_mode)
 | 
				
			||||||
 | 
									run("iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O "
 | 
				
			||||||
 | 
										"-toutpad $__GW_TBUF OE:I:O -tinoutpad $__GW_IOBUF OE:O:I:IO", "(unless -noiopads)");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (check_label("map_ffs"))
 | 
							if (check_label("map_ffs"))
 | 
				
			||||||
| 
						 | 
					@ -277,9 +280,6 @@ struct SynthGowinPass : public ScriptPass
 | 
				
			||||||
			run("opt_lut_ins -tech gowin");
 | 
								run("opt_lut_ins -tech gowin");
 | 
				
			||||||
			run("setundef -undriven -params -zero");
 | 
								run("setundef -undriven -params -zero");
 | 
				
			||||||
			run("hilomap -singleton -hicell VCC V -locell GND G");
 | 
								run("hilomap -singleton -hicell VCC V -locell GND G");
 | 
				
			||||||
			if (!noiopads || help_mode)
 | 
					 | 
				
			||||||
				run("iopadmap -bits -inpad IBUF O:I -outpad OBUF I:O "
 | 
					 | 
				
			||||||
					"-toutpad TBUF OEN:I:O -tinoutpad IOBUF OEN:O:I:IO", "(unless -noiopads)");
 | 
					 | 
				
			||||||
			run("clean");
 | 
								run("clean");
 | 
				
			||||||
			run("autoname");
 | 
								run("autoname");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ module \$__NX_TINOUTPAD (input I, OE, output O, inout B);
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module \$__NX_TOUTPAD (input I, OE, output O);
 | 
					module \$__NX_TOUTPAD (input I, OE, output O);
 | 
				
			||||||
	OBZ _TECHMAP_REPLACE_ (.I(I), .O(), .T(~OE), .O(O));
 | 
						OBZ _TECHMAP_REPLACE_ (.I(I), .T(~OE), .O(O));
 | 
				
			||||||
endmodule
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`ifndef NO_LUT
 | 
					`ifndef NO_LUT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,5 +9,6 @@ design -load postopt # load the post-opt design (otherwise equiv_opt loads the p
 | 
				
			||||||
cd tristate # Constrain all select calls below inside the top module
 | 
					cd tristate # Constrain all select calls below inside the top module
 | 
				
			||||||
#Internal cell type used. Need support it.
 | 
					#Internal cell type used. Need support it.
 | 
				
			||||||
select -assert-count 1 t:TBUF
 | 
					select -assert-count 1 t:TBUF
 | 
				
			||||||
 | 
					select -assert-count 1 t:LUT1
 | 
				
			||||||
select -assert-count 2 t:IBUF
 | 
					select -assert-count 2 t:IBUF
 | 
				
			||||||
select -assert-none t:TBUF t:IBUF %% t:* %D
 | 
					select -assert-none t:TBUF t:IBUF t:LUT1 %% t:* %D
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue