Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the flags --size, --type, --pack? #468

Closed
zapta opened this issue Nov 19, 2024 · 12 comments
Closed

How to use the flags --size, --type, --pack? #468

zapta opened this issue Nov 19, 2024 · 12 comments

Comments

@zapta
Copy link
Collaborator

zapta commented Nov 19, 2024

@Obijuan, @cavearr,

if I type apio build --size 32k I get the error Error: Missing FPGA, and If I add the --fpga flag I get the error Error: contradictory arguments: ('8k', '32k'). It's the same for apio prog (0.9.5) and the latest apio dev.

What am I missing?

The relevant code is here

if config[FPGA] not in resources.fpgas:

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

Hi @zapta ! i'm out of home now, but check if you are using the right arguments for the new nextpnr or yosys. In nexpnr now you need to pass por example --package hx8k , check if this is correct or we are using old toolchain arguments.

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

Reviewing the code, could be the FPGA board selected in the config is not set? as soon as i arrive i'll check it.

@zapta
Copy link
Collaborator Author

zapta commented Nov 19, 2024

The error happens long before yosys or nextpnr, in the apio process itself, before scons.

The parsing is done in these steps

  1. The arguments (e.g. 'size') are populated in the config dictionary.
  2. The code asserts that the argument 'fpga' is in the dictionary
  3. The code tries to populate the 'size' value from the fpga definition (originated at fpgas.json) and complains if a different 'size' value is ready in the dictionary.

I don't see how the flags --size --type --pack flags can be used, and I presume that icestudio doesn't use them.

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

i think the --size is used for example for boards that could have different FPGA chips, for example the same board with ice40 fpga but could exists with size 4k or 8k but not exists ice40 of 32k.

If you build for a board with an ice40 fpga configured and specify 32k appears the error "contradictory".

In the same way you can't specify size without specify fpga model.

And pack is needed for nexpnr (i don't deep in apio but i understood that apio needs to specify the packaging of the fpga chip to nextpnr)

@zapta
Copy link
Collaborator Author

zapta commented Nov 19, 2024

@cavearr, can you give an example of a useful apio build command with --size, --type or --pack?

EDIT: These options are deprecated anyway since the new apio release will support custom fpgas.json in the product dir. I was waiting for icestudio to remove dependency on these flags but since they don't work anyway, I guess it's safe to delete them now.

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

At Icestudio i don't use it, the only use is "--package" that i don't know if is the same as "--pack" for exapmple: nextpnr-ice40 --hx8k --package tq144:4k --json hardware.json --asc hardware.asc --report hardware.pnr --pcf main.pcf -q

Are you sure we could delete this commands? there are a lot of boards and i don't know if there are neccesary for some of theme.

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

I'm reviewing apio code and view that in test/commands/test_build.py there are some examples:

One of theme: apio build --fpga iCE40-HX1K-TQ144 --pack tq144 --size 1k

'pack' is the same as nexpnr 'package' as i suppose it, this is important param, the same as size, i don't know if we have now this kind of situation but we need to support --fpga param and with the semane name different flavours identified by "size"

@zapta
Copy link
Collaborator Author

zapta commented Nov 19, 2024

FPGA iCE40-HX1K-TQ144 already has its pack = tq144 in fpgas.json and therefore the --pack tq144 doesn't do anything. Same for --size 1k.

fpgas.json

  "iCE40-HX1K-TQ144": {
    "arch": "ice40",
    "type": "hx",
    "size": "1k",
    "pack": "tq144"
  },

In other words, these two commands are identical:

apio build --fpga iCE40-HX1K-TQ144 --pack tq144 --size 1k

apio build --fpga iCE40-HX1K-TQ144

Here is a test that demonstrates that the two commands result with the same nextpnr command

/Users/user/projects/apio_dev/repo/test-examples/Alhambra-II/02-jumping-LED $ mv apio.ini apio.ini.keep

/Users/user/projects/apio_dev/repo/test-examples/Alhambra-II/02-jumping-LED $ rm hardware.*

/Users/user/projects/apio_dev/repo/test-examples/Alhambra-II/02-jumping-LED $ apio build --fpga iCE40-HX1K-TQ144 --pack tq144 --size 1k
Info: No apio.ini file
[Tue Nov 19 13:11:57 2024] Processing custom board
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
yosys -p "synth_ice40 -top main -json hardware.json" -q main.v
Warning: wire '\q' is assigned in a block at main.v:3171.14-3171.21.
Warning: wire '\q' is assigned in a block at main.v:3175.6-3175.12.
nextpnr-ice40 --hx1k --package tq144 --json hardware.json --asc hardware.asc --pcf main.pcf -q
icepack hardware.asc hardware.bin
=============================================================================== [SUCCESS] Took 1.75 seconds ===============================================================================


/Users/user/projects/apio_dev/repo/test-examples/Alhambra-II/02-jumping-LED $ rm hardware.*
/Users/user/projects/apio_dev/repo/test-examples/Alhambra-II/02-jumping-LED $ apio build --fpga iCE40-HX1K-TQ144 
Info: No apio.ini file
[Tue Nov 19 13:12:08 2024] Processing custom board
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
yosys -p "synth_ice40 -top main -json hardware.json" -q main.v
Warning: wire '\q' is assigned in a block at main.v:3171.14-3171.21.
Warning: wire '\q' is assigned in a block at main.v:3175.6-3175.12.
nextpnr-ice40 --hx1k --package tq144 --json hardware.json --asc hardware.asc --pcf main.pcf -q
icepack hardware.asc hardware.bin
=============================================================================== [SUCCESS] Took 1.75 seconds ===============================================================================

I still can't see how these three flags are useful, considering that we don't allow them to override values in fpgas.json.

Regarding the deletion, these flags where planned to deletion anyway since the new apio allows users to use a custom fpgas.json in their project directory (an idea borrowed from platformio) in case they want to use a new fpga or to override arch, size, type, or pack.

Does this make sense?

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

@zapta Sorry! I didn't understand you! I thought you were talking about arguments or configurations as a concept, not just the argument.

If this is present in celery.ini and the new policy is to remove it from the argument list... I'm all for removing it!

@zapta
Copy link
Collaborator Author

zapta commented Nov 19, 2024 via email

@cavearr
Copy link
Member

cavearr commented Nov 19, 2024

I am migrating icestudio to the new system, I have little left, it will take about a week to have it up and running.

@zapta
Copy link
Collaborator Author

zapta commented Nov 19, 2024 via email

@zapta zapta closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants