aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-05-04 19:12:59 +0200
committerClifford Wolf <clifford@clifford.at>2016-05-04 19:12:59 +0200
commit86add2907276ab7c9ec2c2861901a7a7adedf0fa (patch)
tree736591df308433d89433090d1ba95df63b3b20a0
parent7a74ae4c5403ce68a8245c45359d49f80d6e863a (diff)
parentdeb1eccab5bad3e5a090254e0d3a069a3c474d8b (diff)
downloadyosys-86add2907276ab7c9ec2c2861901a7a7adedf0fa.tar.gz
yosys-86add2907276ab7c9ec2c2861901a7a7adedf0fa.tar.bz2
yosys-86add2907276ab7c9ec2c2861901a7a7adedf0fa.zip
Merge pull request #157 from azonenberg/master
Added GP_ABUF cell, support for tri-state I/O buffers in GreenPak
-rw-r--r--techlibs/greenpak4/Makefile.inc1
-rw-r--r--techlibs/greenpak4/cells_extract.v15
-rw-r--r--techlibs/greenpak4/cells_map.v9
-rw-r--r--techlibs/greenpak4/cells_sim.v25
-rw-r--r--techlibs/greenpak4/synth_greenpak4.cc2
5 files changed, 52 insertions, 0 deletions
diff --git a/techlibs/greenpak4/Makefile.inc b/techlibs/greenpak4/Makefile.inc
index 969b7c80d..4e8e9415c 100644
--- a/techlibs/greenpak4/Makefile.inc
+++ b/techlibs/greenpak4/Makefile.inc
@@ -2,6 +2,7 @@
OBJS += techlibs/greenpak4/synth_greenpak4.o
OBJS += techlibs/greenpak4/greenpak4_counters.o
+$(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_extract.v))
$(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_map.v))
$(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/cells_sim.v))
$(eval $(call add_share_file,share/greenpak4,techlibs/greenpak4/gp_dff.lib))
diff --git a/techlibs/greenpak4/cells_extract.v b/techlibs/greenpak4/cells_extract.v
new file mode 100644
index 000000000..96feb7328
--- /dev/null
+++ b/techlibs/greenpak4/cells_extract.v
@@ -0,0 +1,15 @@
+//Wrapper module to patch up output of iopadmap
+module GP_IOBUF(input IN, output OUT, input OE, inout IO);
+
+ GP_IBUF ibuf(
+ .IN(IO),
+ .OUT(OUT)
+ );
+
+ $_TBUF_ tbuf(
+ .A(IN),
+ .E(OE),
+ .Y(OUT)
+ );
+
+endmodule
diff --git a/techlibs/greenpak4/cells_map.v b/techlibs/greenpak4/cells_map.v
index 1bc0bcda4..b7d750ae0 100644
--- a/techlibs/greenpak4/cells_map.v
+++ b/techlibs/greenpak4/cells_map.v
@@ -24,6 +24,15 @@ module GP_DFFR(input D, CLK, nRST, output reg Q);
);
endmodule
+module GP_OBUFT(input IN, input OE, output OUT);
+ GP_IOBUF _TECHMAP_REPLACE_ (
+ .IN(IN),
+ .OE(OE),
+ .IO(OUT),
+ .OUT()
+ );
+endmodule
+
module \$lut (A, Y);
parameter WIDTH = 0;
parameter LUT = 0;
diff --git a/techlibs/greenpak4/cells_sim.v b/techlibs/greenpak4/cells_sim.v
index b7dbe81a2..6c3ffcaa0 100644
--- a/techlibs/greenpak4/cells_sim.v
+++ b/techlibs/greenpak4/cells_sim.v
@@ -13,6 +13,14 @@ module GP_4LUT(input IN0, IN1, IN2, IN3, output OUT);
assign OUT = INIT[{IN3, IN2, IN1, IN0}];
endmodule
+module GP_ABUF(input wire IN, output wire OUT);
+
+ assign OUT = IN;
+
+ //cannot simulate mixed signal IP
+
+endmodule
+
module GP_ACMP(input wire PWREN, input wire VIN, input wire VREF, output reg OUT);
parameter BANDWIDTH = "HIGH";
@@ -126,6 +134,15 @@ module GP_DFFSR(input D, CLK, nSR, output reg Q);
end
endmodule
+module GP_IBUF(input IN, output OUT);
+ assign OUT = IN;
+endmodule
+
+module GP_IOBUF(input IN, input OE, output OUT, inout IO);
+ assign OUT = IO;
+ assign IO = OE ? IN : 1'bz;
+endmodule
+
module GP_INV(input IN, output OUT);
assign OUT = ~IN;
endmodule
@@ -153,6 +170,14 @@ module GP_LFOSC(input PWRDN, output reg CLKOUT);
endmodule
+module GP_OBUF(input IN, output OUT);
+ assign OUT = IN;
+endmodule
+
+module GP_OBUFT(input IN, input OE, output OUT);
+ assign OUT = OE ? IN : 1'bz;
+endmodule
+
module GP_PGA(input wire VIN_P, input wire VIN_N, input wire VIN_SEL, output reg VOUT);
parameter GAIN = 1;
diff --git a/techlibs/greenpak4/synth_greenpak4.cc b/techlibs/greenpak4/synth_greenpak4.cc
index 3559e0fad..55412ea2b 100644
--- a/techlibs/greenpak4/synth_greenpak4.cc
+++ b/techlibs/greenpak4/synth_greenpak4.cc
@@ -176,6 +176,8 @@ struct SynthGreenPAK4Pass : public ScriptPass
if (check_label("map_cells"))
{
run("shregmap -tech greenpak4");
+ run("iopadmap -bits -inpad GP_IBUF OUT:IN -outpad GP_OBUF IN:OUT -inoutpad GP_IBUF OUT:IN");
+ run("extract -map +/greenpak4/cells_extract.v -verbose");
run("dfflibmap -liberty +/greenpak4/gp_dff.lib");
run("techmap -map +/greenpak4/cells_map.v");
run("dffinit -ff GP_DFF Q INIT");