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:
Pepijn de Vos 2021-08-20 21:21:06 +02:00 committed by GitHub
parent c2866780d2
commit c2d358484f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 7 deletions

View File

@ -122,6 +122,13 @@ module \$_DFFE_NP0P_ (input D, C, R, E, output Q);
wire _TECHMAP_REMOVEINIT_Q_ = 1;
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);
parameter WIDTH = 0;

View File

@ -573,14 +573,14 @@ endmodule
module TBUF (O, I, OEN);
input I, OEN;
output O;
assign O = OEN ? I : 1'bz;
assign O = OEN ? 1'bz : I;
endmodule
module IOBUF (O, IO, I, OEN);
input I,OEN;
output O;
inout IO;
assign IO = OEN ? I : 1'bz;
assign IO = OEN ? 1'bz : I;
assign I = IO;
endmodule

View File

@ -241,6 +241,9 @@ struct SynthGowinPass : public ScriptPass
if (retime || help_mode)
run("abc -dff -D 1", "(only if -retime)");
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"))
@ -277,9 +280,6 @@ struct SynthGowinPass : public ScriptPass
run("opt_lut_ins -tech gowin");
run("setundef -undriven -params -zero");
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("autoname");
}

View File

@ -58,7 +58,7 @@ module \$__NX_TINOUTPAD (input I, OE, output O, inout B);
endmodule
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
`ifndef NO_LUT

View File

@ -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
#Internal cell type used. Need support it.
select -assert-count 1 t:TBUF
select -assert-count 1 t:LUT1
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