aboutsummaryrefslogtreecommitdiffstats
path: root/techlibs/gowin
diff options
context:
space:
mode:
authorPepijn de Vos <pepijndevos@gmail.com>2021-08-20 21:21:06 +0200
committerGitHub <noreply@github.com>2021-08-20 21:21:06 +0200
commitc2d358484fa5188be350ef1a8496f88b60d69ef7 (patch)
tree5b9c97a5a9b03629e2f035b6dcd1f9e4843271d2 /techlibs/gowin
parentc2866780d2ee82334649237f77a89900fa0de4bc (diff)
downloadyosys-c2d358484fa5188be350ef1a8496f88b60d69ef7.tar.gz
yosys-c2d358484fa5188be350ef1a8496f88b60d69ef7.tar.bz2
yosys-c2d358484fa5188be350ef1a8496f88b60d69ef7.zip
Gowin: deal with active-low tristate (#2971)
* deal with active-low tristate * remove empty port * update sim models * add expected lut1 to tests
Diffstat (limited to 'techlibs/gowin')
-rw-r--r--techlibs/gowin/cells_map.v7
-rw-r--r--techlibs/gowin/cells_sim.v4
-rw-r--r--techlibs/gowin/synth_gowin.cc6
3 files changed, 12 insertions, 5 deletions
diff --git a/techlibs/gowin/cells_map.v b/techlibs/gowin/cells_map.v
index 851ef20b2..90eb9b5a4 100644
--- a/techlibs/gowin/cells_map.v
+++ b/techlibs/gowin/cells_map.v
@@ -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;
diff --git a/techlibs/gowin/cells_sim.v b/techlibs/gowin/cells_sim.v
index 509bf3ef2..41398409d 100644
--- a/techlibs/gowin/cells_sim.v
+++ b/techlibs/gowin/cells_sim.v
@@ -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
diff --git a/techlibs/gowin/synth_gowin.cc b/techlibs/gowin/synth_gowin.cc
index c97bd595c..087f6b8cf 100644
--- a/techlibs/gowin/synth_gowin.cc
+++ b/techlibs/gowin/synth_gowin.cc
@@ -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");
}