Commit Graph

136 Commits

Author SHA1 Message Date
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
gatecat
0d6be6f474 Add stub cluster API impl for remaining arches
Signed-off-by: gatecat <gatecat@ds0.me>
2021-05-06 13:12:52 +01:00
gatecat
6a3eacddd6 Add default base implementation of cluster API
Signed-off-by: gatecat <gatecat@ds0.me>
2021-05-06 11:47:06 +01:00
Keith Rothman
fe4608386e Split nextpnr.h to allow for linear inclusion.
"nextpnr.h" is no longer the god header.  Important improvements:

 - Functions in log.h can be used without including
   BaseCtx/Arch/Context. This means that log_X functions can be called
   without included "nextpnr.h"

 - NPNR_ASSERT can be used without including "nextpnr.h" by including
   "nextpnr_assertions.h".  This allows NPNR_ASSERT to be used safely in
   any header file.

 - Types defined in "archdefs.h" are now available without including
   BaseCtx/Arch/Context.  This means that utility classes that will be
   used inside of BaseCtx/Arch/Context can be defined safely in a
   self-contained header.

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-03-15 09:05:23 -07:00
Pepijn de Vos
354d497a57 only one type of dff per slice 2021-02-28 17:48:05 +01:00
gatecat
23413a4d12 Fix compiler warnings introduced by -Wextra
Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-25 15:15:25 +00:00
Keith Rothman
423a10bc31 Change CellInfo in getBelPinsForCellPin to be const.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-23 14:08:54 -08:00
gatecat
7922b3bfc4 Replace DelayInfo with DelayPair/DelayQuad
This replaces the arch-specific DelayInfo structure with new DelayPair
(min/max only) and DelayQuad (min/max for both rise and fall) structures
that form part of common code.

This further reduces the amount of arch-specific code; and also provides
useful data structures for timing analysis which will need to delay
with pairs/quads of delays as it is improved.

While there may be a small performance cost to arches that didn't
separate the rise/fall cases (arches that aren't currently separating
the min/max cases just need to be fixed...) in DelayInfo, my expectation
is that inlining will mean this doesn't make much difference.

Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-19 11:31:33 +00:00
gatecat
a8c55728e2 gowin: Fix archcheck errors and add to CI
Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-17 16:03:03 +00:00
gatecat
18113ff43d gowin: Use base bel bucket/cell type methods
Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-17 15:58:00 +00:00
gatecat
09535a95ca gowin: Fix IdStrings being overwritten by wireToGlobal
Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-17 15:57:31 +00:00
gatecat
c7c13cd95f Remove isValidBelForCell
This Arch API dates from when we were first working out how to
implement placement validity checking, and in practice is little used by
the core parts of placer1/HeAP and the Arch implementation involves a
lot of duplication with isBelLocationValid.

In the short term; placement validity checking is better served by the
combination of checkBelAvail and isValidBelForCellType before placement;
followed by isBelLocationValid after placement (potentially after
moving/swapping multiple cells).

Longer term, removing this API makes things a bit cleaner for a new
validity checking API.

Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-16 13:31:36 +00:00
gatecat
85bb108ba4 Add getBelPinsForCellPin to Arch API
This is a basic implementation, without considering "M of N"
arrangements (e.g. for LUT permuation where you only want to route to 1
out of 4/6 sinks) or using a type other than IdString to identify bel
pins.

But this is also enough to start working out where in nextpnr will break
due to removing the 1:1 cell:bel pin cardinality, as a next step.

Signed-off-by: gatecat <gatecat@ds0.me>
2021-02-10 11:54:54 +00:00
D. Shah
efca63862c Use 'T' postfix to disambiguate LHS and RHS of using
Arches might otherwise have range types named ambigiously with the entry
in ArchRanges.

Signed-off-by: D. Shah <dave@ds0.me>
2021-02-08 10:29:50 +00:00
D. Shah
3e631fe2f4 Add archArgs and archArgsToId to Arch API
Signed-off-by: D. Shah <dave@ds0.me>
2021-02-05 19:19:17 +00:00
D. Shah
6575bfac3e gowin: Switch to BaseArch
Signed-off-by: D. Shah <dave@ds0.me>
2021-02-05 19:19:17 +00:00
Keith Rothman
c99fbde0eb Mark IdString and IdStringList single argument constructors explicit.
Single argument constructors will silently convert to that type.  This
is typically not the right thing to do.  For example, the nexus and
ice40 arch_pybindings.h files were incorrectly parsing bel name strings,
etc.

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-04 16:38:07 -08:00
D. Shah
2a9584ea31 gowin: Stub implementation of IdStringList
Signed-off-by: D. Shah <dave@ds0.me>
2021-02-02 17:00:33 +00:00
D. Shah
ff92d19fed arch: Add getNameDelimiter API for string lists
Signed-off-by: D. Shah <dave@ds0.me>
2021-02-02 16:59:40 +00:00
Keith Rothman
da74a425d2 Run "make clangformat".
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-02 07:44:49 -08:00
Keith Rothman
9fe546f279 Rename Partition -> BelBucket.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-02 07:34:56 -08:00
Keith Rothman
0338368afa Add Partition APIs to ice40, nexus, gowin archs.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-02 07:34:56 -08:00
Keith Rothman
2285c8dbbd Initial refactoring of placer API.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
2021-02-02 07:34:56 -08:00
Pepijn de Vos
2700687c00 Gowin: Add GW1N-4 support 2021-01-03 19:45:00 +01:00
David Shah
818faa78aa clangformat
Signed-off-by: David Shah <dave@ds0.me>
2020-12-30 16:49:55 +00:00
Pepijn de Vos
3611f54902
Gowin target (#542)
* load wires

* add slice bels

* add IOB

* add aliases

* local aliases

* broken packing stuff

* working packer

* add constraints

* pnr runs1111

* add timing info

* constraints

* more constraint stuff

* add copyright

* remove generic reference

* remove parameters

* remove generic python api

* add newline to end of file

* some small refactoring

* warn on invalid constraints

* don't error on missing cell

* comment out debugging print

* typo

* avoid copy

* faster empty idstring

* remove intermediate variable

* no more deadnames

* fix cst warnings

* increase ripup and epsilon a bit

* take single device parameter

* add info to readme

* gui stubs

* Revert 4d03b681a8

* assign ff_used in assignArchInfo

* decrease beta for better routability

* try to fix CI
2020-12-30 14:59:55 +00:00