litex-hub / litex-boards

LiteX boards files
BSD 2-Clause "Simplified" License
380 stars 289 forks source link

icebreaker board: Failed to expand region (0, 0) |_> (25, 31) of 5491 ICESTORM_LCs #454

Closed disdi closed 2 years ago

disdi commented 2 years ago

I am facing issue with building for Icebreaker board: python3 -m litex_boards.targets.icebreaker --build

icebreaker_error

I am using : Yosys version Yosys 0.22+82 (git sha1 2cdbb85da, clang 10.0.0-4ubuntu1 -fPIC -Os)

nextpnr-ice40 nextpnr-ice40 -- Next Generation Place and Route (Version nextpnr-0.4-28-gac17c36b)

disdi commented 2 years ago

Tried to build Yosys and nextpnr from source to get latest version but still getting same error as shown below :

iceb

tcal-x commented 2 years ago

Hi @disdi , the error message is a bit cryptic, but it's just saying that your mapped design uses more resources than are available. In this case, you've used 5481 ICESTORM_LCs while the target FPGA has only 5280.

The default CPU variant does not fit on the target FPGA. While you might wonder why they don't make the default to be something that fits for this board, I think the reasoning is that it would cause confusion if every board had a different default. So globally, the default cpu type is VexRiscv, and the default variant is "full".

These are some recipes that should work, using smaller CPUs:

VexRiscv, "minimal":

python3 -m litex_boards.targets.icebreaker --build --cpu-variant=minimal

or VexRiscv, "lite":

python3 -m litex_boards.targets.icebreaker --build --cpu-variant=lite

or bit-serial SERV:

python3 -m litex_boards.targets.icebreaker --build --cpu-type=serv
enjoy-digital commented 2 years ago

Thanks @tcal-x, we should maybe make sure to provide a default configuration that compiles fine on all boards. I'll think about the best way to do it.

trabucayre commented 2 years ago

@enjoy-digital maybe doing something like done for tang nano 4k: but instead of raising an exception, print a message and forcing minimal ?

enjoy-digital commented 2 years ago

@trabucayre: Yes, different approaches have probably been used, it would be good to try to do something similar for all boards (and with minimal changes). Using parser.set_defaults(cpu_variant="lite") could also be interesting and minimize the changes.

trabucayre commented 2 years ago

LGTM but in parser.py cpu's args are injected in parse_args and consequently set_default is lost. I suppose overriding set_defaults to intercept some params like this is required to reinject them just before calling argparse.ArgumentParser.parse_args

disdi commented 2 years ago

I confirm the --cpu-variant=lite and --cpu-variant=minimal both work for me. Let me know if I need to close this bug or do we expect a pull request to change the default option here ?

disdi commented 2 years ago

Closing this issue for now