Commit Graph

175 Commits

Author SHA1 Message Date
YRabbit
9013b2de50 gowin: use ctx->idf() a bit
Replacing snprintf() with ctx->idf() in PLL commit, but not yet a
complete overhaul.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-11 09:19:16 +10:00
YRabbit
a84ded4793 gowin: add initial PLL support
The rPLL primitive for the simplest chip (GW1N-1) in the family is
processed. All parameters of the primitive are passed on to gowin_pack,
and general-purpose wires are used for routing outputs of the primitive.

Compatible with older versions of apicula, but in this case will refuse
to place the new primitive.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-11-10 19:14:41 +10:00
gatecat
445d32497d run clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2022-10-17 12:35:02 +02:00
Lushay Labs
a7acda95f0
support windows line endings 2022-10-09 23:47:09 +03:00
YRabbit
e0539f0ed7 gowin: BUGFIX. Really memorize the chip
When it really needed to distinguish between the chips, this
unforgivable error was discovered :)

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-08-25 11:52:29 +10:00
gatecat
c60fb94b6c refactor: Use IdString::in instead of || chains
Signed-off-by: gatecat <gatecat@ds0.me>
2022-08-10 18:58:22 +01:00
gatecat
77c82b0fbf refactor: id(stringf(...)) to new idf(...) helper
Signed-off-by: gatecat <gatecat@ds0.me>
2022-08-10 10:57:46 +01:00
YRabbit
ce2335bc00 gowin: fix compilation
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-19 20:20:26 +10:00
YRabbit
6969782a4b gowin: Remove incomprehensible names of the muxes
There is no need to multiply item names, it is a rudiment of my very
first addition to nextpnr.

Fully compatible with older versions of Apicula.

Note: the cosmetic changes in lines with RAM are not my initiative, but
the result of applying clang-format.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-19 18:51:25 +10:00
YRabbit
1ebfe67daf gowin: Remove unnecessary functions
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-05 20:02:12 +10:00
YRabbit
3364a3b674 Merge branch 'master' into clock-wip 2022-07-05 19:43:24 +10:00
YRabbit
5d915a550b gowin: fix compilation
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-04 11:23:21 +10:00
YRabbit
3172a38dae gowin: Let the placer know about global networks
Refactor in order to detect networks that will be routed in a special
mode earlier. This makes it possible to mark the source of such networks
as a global buffer, thereby removing their influence on element
placement.

In addition, timing classes are set for some cells.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-07-04 10:32:39 +10:00
Pepijn de Vos
6f56ad298c use DFF RAM mode 2022-07-02 20:44:59 +02:00
Pepijn de Vos
0641ff47d9 Merge branch 'master' into shadowram 2022-07-02 13:29:44 +02:00
YRabbit
63f2acd42a gowin: process the CLK ports of the ODDR[C] primitives
Also removed the useless references.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-24 08:20:06 +10:00
YRabbit
590b9050ff gowin: add a separate router for the clocks
A simple router that takes advantage of the fact that in each cell with
DFFs their CLK inputs can directly connect to the global clock network.

Networks with a large number of such sinks are sought and then each
network is assigned to the available independent global clock networks.

There are limited possibilities for routing mixed networks, that is,
when the sinks are not only CLKs: in this case an attempt is made to use
wires such as SN10/20 and EW10/20, that is, one short transition can be
added between the global clock network and the sink.

* At this time, networks with a source other than the I/O pin are not
  supported. This is typical for Tangnano4k and runber boards.

* Router is disabled by default, you need to specify option
  --enable-globals to activate

* No new chip bases are required. This may change in the distant future.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-23 11:42:58 +10:00
Pepijn de Vos
b7992ec772 hook up CE maybe 2022-06-16 11:38:23 +02:00
YRabbit
bd0af4052c gowin: Use local aliases
In the Gowin chips, the tiles are connected to each other by a one-hop
wire, among others. There are 4 one-hop wires, of which 2 are shared
between north/south and east/west, have three names: e.g. SN10 and N110
and S110.

But only one of them, the first, occurs as a sink for PIP, that is, you
can not get a route that would pass through the S110 for example.

This commit corrects the names to SN?0 and EW?0 at the wire creation
stage to avoid dead wires.

In addition, the SN?0 and EW?0 are among the few sinks for global clock
wires and now there is the possibility of a more optimal clock routing.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-06-09 08:20:29 +10:00
Pepijn de Vos
de1bee9352 lutram actually PnRs 2022-06-06 14:35:33 +02:00
Pepijn de Vos
490dddf636 WIP shadowram 2022-06-05 16:59:06 +02:00
YRabbit
db696af2fe gowin: Add support for long wires
Gowin chips have a highly sophisticated system of long wires that are
wired to each cell and allow the clock or logic to spread quickly.

This commit implements some of the capabilities of the long wire system
for quadrants, leaving out the fine-tuning of them for each column.

To make use of the long wire system, the specified wire is cut at the
driver and a special cell is placed between the driver and the rest of
the wire.

* VCC and GND can not use long wires because they are in every cell and
  there is no point in using a net
* Long wire numbers can be specified manually or assigned automatically.
* The route from the driver to the port of the new cell can be quite
  long, this will have to be solved somehow.
* It might make sense to add a mechanism for automatically finding
  candidates for long wires.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-05-27 22:44:21 +10:00
YRabbit
15413de359 gowin: Add initial syntax support for long wires
Only the recognition of the directive in the .CST file and elementary
checks are added, but not the long-wire mechanism itself.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-05-02 20:40:33 +10:00
YRabbit
85e8570a73 gowin: handle the GW1N-9 feature.
This chip has a different default state for one type of I/O buffer ---
you have to explicitly switch it to the normal state by feeding VCC/VSS
to certain inputs.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-04-03 10:05:27 +10:00
Tim Pambor
601b32948b gowin: Fix z-index of oscillator 2022-03-30 17:35:54 +02:00
Tim Pambor
12b38bab6d gowin: Add bels for oscillator 2022-03-27 22:15:12 +02:00
YRabbit
be8d3fd74d gowin: Consider the peculiarity of GW1BR-9C
The GW1NR-9C chip ODDR implementation differs from all other supported
chips by two suspicious inputs.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-26 20:56:30 +10:00
YRabbit
69b4461f55
gowin: Name the constants (#958)
Place arbitrary constants side by side to avoid conflicts.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-21 20:15:29 +00:00
Pepijn de Vos
bb923c7732
Gowin: use global VCC and VSS nets (#956)
* use global VCC and VSS nets

* derp

* remove init parameter
2022-03-19 18:44:08 +00:00
YRabbit
c898587b87 gowin: don't crash if no arguments are set
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-16 15:47:13 +10:00
gatecat
2df9d3537b
Merge pull request #943 from yrabbit/locale
gowin: support for locales other than en_US and C
2022-03-15 20:44:03 +00:00
YRabbit
53ddbbaa85 Set the locale as early as possible
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-16 05:39:55 +10:00
YRabbit
ad00f3fdeb gowin: test locale workaround
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-15 21:52:32 +10:00
YRabbit
badef293eb gowin: add support for ODDR primitive
Compatible with older versions of apicula bases.
Also small fixes and as the number of virtual Bels grows it is necessary
to assign them Z coordinate in a centralized way to avoid conflicts and
for this purpose introduced the BelZ enum.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-15 11:02:37 +10:00
YRabbit
25d7e3ae8b gowin: support for locales other than en_US and C
Specifically, those locales where the fractional part separator in
floating point numbers is not a dot.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-14 21:41:57 +10:00
YRabbit
4a2aa6deb4 gowin: Add the Global Set/Reset primitive
GSR is added automatically if it was not instantiated by the user explicitly.

Compatible with old apicula bases, the functionality does not work, but
the crash does not happen --- just a warning.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-12 23:05:42 +10:00
gatecat
2c8062bdb3
Merge pull request #931 from yrabbit/bugfix-0
gowin: BUGFIX gui crash
2022-03-04 16:06:41 +00:00
YRabbit
c93a3f35ac gowin: BUGFIX gui crash
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-03-04 16:19:16 +10:00
gatecat
86699b42f6 Switch to potentially-sparse net users array
This uses a new data structure for net.users that allows gaps, so
removing a port from a net is no longer an O(n) operation on the number
of users the net has.

Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-27 13:47:05 +00:00
YRabbit
3894a36ddb gowin: recognize partnumbers of GW1NZ-1
The model should be recognized by the partnumber, --family is needed
only if the same partnumbers belong to different models.
This is done in order to automatically generate parameters for calling
nextpnr from Gowin files without problems: there also only partnumber is
used and only in some cases the model is specified with the -name
parameter and GW1NZ-1 is not such a case.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-24 13:35:22 +10:00
YRabbit
ad49b7c78d gowin: Add support for true differential output
The new primitive appears as an amalgamation of two existing OBUF
primitives.  Compatible with older versions of apicula, although, of
course, using TLVDS_OBUF with old databases will not bring the desired
result, but no crash.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-23 15:53:04 +10:00
gatecat
4812f9707a
Merge pull request #913 from chiplet/gw1nz-1
gowin: Add GW1NZ-1 support
2022-02-20 18:27:36 +00:00
gatecat
6a32aca4ac refactor: New member functions to replace design_utils
Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-18 11:13:18 +00:00
gatecat
76683a1e3c refactor: Use constids instead of id("..")
Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-16 17:09:54 +00:00
gatecat
9ef0bc3d3a refactor: Use cell member functions to add ports
Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-16 16:45:45 +00:00
gatecat
30fd86ce69 refactor: New NetInfo and CellInfo constructors 2022-02-16 15:10:57 +00:00
gatecat
f3ee0d51a9 clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-16 13:32:53 +00:00
Verneri Hirvonen
e90f5b72f7 gowin: Add GW1NZ-1 2022-02-15 14:12:16 +02:00
Pepijn de Vos
cd97ef6536 add GW1N-9C db 2022-02-06 12:02:06 +01:00
Icenowy Zheng
230de1e68a gowin: add an option to manually specify family
In the vendor IDE, there's a device family named GW1N-9C (which seems to
mean C revision of GW1N-9), in which the model numbers are all the same
with GW1N-9.

Add an option to nextpnr-gowin to allow manually specified family for
this situation.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
2022-02-06 12:01:51 +01:00
gatecat
69625564ca
Merge pull request #906 from yrabbit/gowin-gui-noc
gowin: Speed up the GUI
2022-02-04 15:47:30 +00:00
YRabbit
0675b98437 gowin: Speed up the GUI
By mistake, an empty decal gets filled with graphical elements.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-04 14:24:22 +10:00
YRabbit
1152c9f2f8 gowin: Remove leftover debugging
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-04 09:18:08 +10:00
YRabbit
eb5d3b3197 Merge branch 'master' into diff-locations 2022-02-04 09:03:36 +10:00
gatecat
84399caebe run clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2022-02-03 15:28:46 +00:00
YRabbit
604260a0d7 gowin: Add a DS location recognition
For differential signals it is necessary to set the position of two pins
at once: P and N.
This commit adds that capability and also adds another style of location
setting --- with the pin letter in square brackets used in vendor tools.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-03 11:26:45 +10:00
YRabbit
368299d143 gowin: Rearrange the GUI constants
All internal constants for describing the graphics have been moved
to the .cc file.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-02-03 06:24:40 +10:00
YRabbit
22e4081c73 gowin: Add GUI.
* Items such as LUT, DFF, MUX, ALU, IOB are displayed;
* Local wires, 1-2-4-8 wires are displayed;
* The clock spines, taps and branches are displayed with some caveats.

For now, you can not create a project in the GUI because of possible
conflict with another PR (about GW1NR-9C support), but you can specify
the board in the command line and load .JSON and .CST in the GUI.

Although ALUs are displayed, but the CIN and COUT wires are not. This is
still an unsolved problem.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-01-29 14:45:17 +10:00
YRabbit
045ce3f148 gowin: Fix last MUX8
In fact, there is also an input/output column.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2022-01-03 17:48:31 +10:00
gatecat
fdeb86809f
Merge pull request #877 from pepijndevos/patch-3
Add support for GW1NS-4 series devices
2021-12-26 19:14:05 +00:00
YRabbit
e6b7879542 gowin: Initializing the grid dimensions
gridDimX and gridDimY are not initialized explicitly, which leads to
effects when the design is reloaded, say, from the GUI.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-12-26 12:05:35 +10:00
Pepijn de Vos
b53a921e42 Add support for GW1NS-4 series devices 2021-12-24 17:17:25 +01:00
YRabbit
5a76b3cb4d gowin: Add simplified IO cells processing
Some models have I/O cells that are IOBUFs, and other types (IBUFs and
OBUFs) are obtained by feeding 1 or 0 to the OEN input.  This is done
with general-purpose routing so it's best to do it here to avoid
conflicts.

For this purpose, in the new bases, these special cells are of type IOBS
(IOB Simplified).

The proposed changes are compatible with bases of previous versions of
Apycula and do not require changing .CST constraint files.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-12-20 15:48:38 +10:00
gatecat
ddb084e9a8 archapi: Use arbitrary rather than actual placement in predictDelay
This makes predictDelay be based on an arbitrary belpin pair rather
than a arc of a net based on cell placement. This way 'what-if'
decisions can be evaluated without actually changing placement;
potentially useful for parallel placement.

A new helper predictArcDelay behaves like the old predictDelay to
minimise the impact on existing passes; only arches need be updated.

Signed-off-by: gatecat <gatecat@ds0.me>
2021-12-19 17:15:15 +00:00
uis
9b2d6c5a67 Clean gowin modification regex 2021-12-18 22:44:08 +03:00
YRabbit
120ed0c42d gowin: Recognize models correctly
For example, clearly distinguish between
    GW1N-4
    GW1NR-4
    GW1NS-4
    GW1NSR-4
    GW1NSR-4

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-12-15 07:56:34 +10:00
YRabbit
fdf26e698f gowin: Fix spelling of messages
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-12-14 14:09:27 +10:00
gatecat
a933f82845 clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2021-12-12 18:49:37 +00:00
YRabbit
e0ab7bf6c1 gowin: BUGFIX. Place the ALU head in sliсe 0 only
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-12-11 19:10:02 +10:00
YRabbit
deb14762aa gowin: Check the chipdb version
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-11-07 09:05:34 +10:00
YRabbit
74b4f69728 gowin: Use speed from chip base.
Another simplification of the input regular expression, now
the speed is taken from the base.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-11-05 17:02:45 +10:00
YRabbit
0e8a2999bd gowin: Add partnumbers and packages to the chipdb
Instead of parsing the partnumber with a regular expression,
a simple table is used. This is done because the structure
of the partnumber changes as new features appear (e.g., ES instead of C6/I5)

This commit does not yet disable the very first regular expression check.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-11-04 18:55:00 +10:00
YRabbit
e9f3946d58 gowin: Explicitly initialize the y in the cluster
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-10-22 23:27:36 +10:00
YRabbit
f52fd6a272 gowin: Add ALU support.
- Both the mode used by yosys and all Gowin primitive modes are supported.
  - The ALU always starts with a zero slice.
  - The maximum length of the ALU chain is limited to one line of the chip.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-10-22 14:41:18 +10:00
Pepijn de Vos
603f44e947
Gowin: more clearly mark dummy pips 2021-10-10 18:11:02 +02:00
YRabbit
bfe9cd548a gowin: Replace the zero delays with reasonable values.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-10-09 20:26:18 +10:00
YRabbit
c72ea15472 gowin: add support for wide LUTs.
* A hardwired MUX within each logical cell is used.
  * The delay is equal 0.
  * No user placement constraints.
  * The output route contains dummy PIPs. They are ignored by gowin_pack, but it may be worth removing them.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-10-07 18:38:33 +10:00
YRabbit
f3899696a7 gowin: Place DFFs of different types in the slice.
Allow the registers of the same type or pairs shown below to be
placed in the same slide:

|--------|--------|
| DFFS   | DFFR   |
| DFFSE  | DFFRE  |
| DFFP   | DFFC   |
| DFFPE  | DFFCE  |
| DFFNS  | DFFNR  |
| DFFNSE | DFFNRE |
| DFFNP  | DFFNC  |
| DFFNPE | DFFNCE |

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-08-31 07:53:15 +10:00
YRabbit
23a5e91858 gowin: Add constraints on primitive placement.
Added support for the INS_LOC instruction in the constraints file
(.CST), which is used to specify object placement.
Expanded treatment of IO_LOC/IO_PORT constraints, which now can
be applied to both ports and IO buffers.
Port constraints have priority.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-08-31 07:36:11 +10:00
YRabbit
e4196f32d3 gowin: Add the IO[TRBL]style placement recognition
Specifying pin placement with this notation (e.g. IOR4B) allows
to use the same constraint file without changes for different
packages and even different families.
The vendor router also understands this notation.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-08-23 16:19:02 +10:00
YRabbit
3f959c7421 gowin: Change the constraint parser to support multiple options per line. Add support for IOBUF and TBUF I/O modes.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-08-06 17:43:20 +10:00
gatecat
86a91ccf1b clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2021-07-21 10:57:48 +01:00
Pepijn de Vos
811f5b4d18 remove generic leftover in gowin 2021-07-17 17:35:49 +02:00
Pepijn de Vos
c89c14b6bf GW1NR is not a seperate family, but GW1NS is 2021-07-11 14:12:34 +02:00
gatecat
478456e6e9
Merge pull request #755 from yrabbit/io_port
Pin modes parser
2021-07-08 17:22:10 +01:00
gatecat
6829e4c197 clangformat
Signed-off-by: gatecat <gatecat@ds0.me>
2021-07-08 15:42:36 +01:00
YRabbit
881fd97c5a Fix the boolean.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-08 07:09:30 +10:00
YRabbit
d613626ab9 Fix formating
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-07 22:53:49 +10:00
YRabbit
5d8b27710d Fix boolean value.
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-07 22:02:43 +10:00
YRabbit
5f018df4e4 Merge branch 'master' into io_port 2021-07-07 08:36:45 +10:00
YRabbit
fd7734f000 Wip parser
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-07 08:36:05 +10:00
Gwenhael Goavec-Merou
96263058c3 add support for GW1NS-2 family
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
2021-07-06 11:40:41 +02:00
YRabbit
baa68fa4c1 Parser
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-05 08:31:01 +10:00
YRabbit
5c5982c50a Fix parser. Comments and IO_PORT
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-03 08:23:25 +10:00
YRabbit
9443267717 Syntax
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-02 14:58:17 +10:00
YRabbit
a65f0e57b9 Add IO_PORT parsing
Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
2021-07-02 14:00:20 +10:00
gatecat
2ffb081442 Fixing old emails and names in copyrights
Signed-off-by: gatecat <gatecat@ds0.me>
2021-06-12 13:22:38 +01:00
gatecat
eca1a4cee4 Use hashlib in most remaining code
Signed-off-by: gatecat <gatecat@ds0.me>
2021-06-02 15:05:20 +01:00
gatecat
ecc19c2c08 Using hashlib in arches
Signed-off-by: gatecat <gatecat@ds0.me>
2021-06-02 15:05:19 +01:00
gatecat
579b98c596 Use hashlib for core netlist structures
Signed-off-by: gatecat <gatecat@ds0.me>
2021-06-02 14:27:56 +01:00