-
Notifications
You must be signed in to change notification settings - Fork 102
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
Shrinking Microwatt #294
Comments
I assume you have set HAS_FPU to false and LOG_LENGTH to 0? There probably are quite a few things that could be done to reduce the resource usage, though getting it down to 25k LUTs would be quite a challenge. Have you looked at Bill Flynn's A2P cpu? |
Aside: a number of config options at the tip of HEAD don't exist in the version of the core I'm using ce0205b. Are the TLB and FPU enabled by default in that version of the core (and not configurable). Going to assume "no" on both cases.
It's even worse in this case, since the core would need to be under 25k LUTs to support peripherals :D! I have a few FPGAs on hand that could fit MicroWatt, but I still wanted to try this specific board b/c its form factor makes it convenient to keep around on the workbench.
I've never heard of it, so I can't say that I have :). Can you give me more information on it? |
Just looking at LUT4 usage, the biggest items are:
|
Hrm, I'm assuming |
yeah, and then some. powerpc has lots of rotate and mask/clear instructions We could do a multi-cycle version that would take less LUT4s but be slower. |
@mikey It's worth a shot to me, tbh. I don't need the MMU or dcache either. This particular board only has enough LUTs to run Microwatt as a 64-bit microcontroller. Linux on LiteX for Microwatt would be nice, but I can accept that my board is too small for that :P. I don't know what "A2P" is that @paulusmack is referencing... is it another, smaller OpenPOWER core? |
A2P is probably not really ready for the real world yet. I'd just ignore that comment for now. Sorry. Removing the MMU and dcache is certainly an option. It might be something we could add as an generic option for microcontroller only configurations. Do you need external DRAM? |
Would be "nice to have" but certainly not a requirement for a microcontroller-only config. E.g. Micropython will work just fine using BRAM resources. Idk how practical it is to have Microwatt, a DRAM controller, and peripherals on OrangeCrab :D! |
The rotator shouldn't be anything like that large. Maybe yosys is synthesizing it badly. The main 64-bit barrel shifter is done as 3 layers of 4-input 64-bit wide multiplexers. It should be possible to do a 4-input multiplexer using 3 LUT4s, meaning a total of 576 LUT4s for the rotator. There are also the mask generator, an input multiplexer (2 wide) and an output multiplexer (4 wide), but they shouldn't amount to anything like 3000 LUT4s. The mask generators should be about 72 LUT4s each, the input mux (2 inputs x 32 bits) should be 32 LUT4s, and the output mux should be 192 LUT4s. That should all come to less than 1000 LUT4s. |
@paulusmack a quick check of just the rotator confirms it's this big. I run this:
which runs in less than a min and gives:
|
@cr1901 excuse me if this is obvious, but I interpreted that you are not aware of it. Did you see https://github.com/antonblanchard/microwatt/blob/master/.github/workflows/test.yml#L67 ? So, there is a make target for generating a bitstream for the OrangeCrab, which is executed in CI. Since a month ago, it seems to be reaching the limit, so implementation fails depending on the seed (https://github.com/antonblanchard/microwatt/actions). Sometimes it fits: https://github.com/antonblanchard/microwatt/runs/3082247675?check_suite_focus=true.
However, it seems that the Makefiles in this repo are using device @antonblanchard is the OrangeCrab you got from @gregdavill different from the "regular" one that people can buy? The cable in https://twitter.com/antonblanchard/status/1219448773333487616 hides that FPGA 😢 I think it would be desirable to have nextpnr arguments and https://github.com/antonblanchard/microwatt/blob/master/constraints/orange-crab.lpf match what "typical" OrangeCrab users will get (https://github.com/gregdavill/OrangeCrab-examples/tree/main/verilog). If not possible, might be good to use OrangeCrab-r0.0 or some other name here, which makes it explicit.
@mikey, I'm aware of a2i but not A2P. Do you mind providing a reference, even if it's not ready for the real world yet?
@mikey, you might try the following for getting a diagram representation: # yosys -m ghdl -p 'ghdl --std=08 --no-formal decode_types.vhdl utils.vhdl common.vhdl rotator.vhdl -e rotator; prep; write_json rotator.json'
# netlistsvg rotator.json -o rotator.svg
# convert rotator.svg rotator.png |
Yes, that OrangeCrab specifically has a 5G-85F installed. I built that one for him before our initial group-buy ran. |
@gregdavill Am I reading the data sheet right on the 85K OrangeCrab as having 512MB of RAM? 25K version only has 128MB of RAM? |
Yes, on the released orangecrab-85F we also increase the DDR3 capacity, over the 25F version. |
To be 100% clear, I wanted Microwatt to fit into the 12/25F part :D! |
Understood. I know your board is a 25F. I was just confirming that the existing/proven examples of this running on the ECP5, did use larger devices. |
Yep I understand and getting down to that size is a goal. That being said, I've been looking for a while for a bigger ECP5 + RAM + SPI + SD card board so we can run microwatt + Linux on it. I didn't realise you could get the orange crabb still. |
It looks like the icache RAM not being inferred as block RAMs by yosys, and this is creatng a huge bloat. I've reduced the size of the icache with a workaround #303, which gets us from 95% usage down to 76%. This should keep us going until we can fix the RAM inferencing issue. |
@mikey does the icache use byte enables or global enables? We found issues in NEORV32 too when trying to infer BRAMs: ghdl/ghdl#1781, ghdl/ghdl#1782, ghdl/ghdl#1780. |
@umarcor For the icache, we only write a cacheline at a time which is 64 bytes wide. |
The icache inference may have been a problem, but the core still didn't fit into OrangeCrab even when I essentially disabled the caches :P. |
I'd like to experiment using Microwatt as a 64-bit microcontroller on an ECP5 LFE5U-25F. Unfortunately, even with the following patch, I can't seem to get Microwatt and SoC peripherals to fit:
Command Line:
Resource Usage (
nextpnr
):I'd like to discuss whether core variants would be possible (
standard
,lite
,minimal
) based on the FPGA size someone has on hand. However, I first would like to actually get Microwatt to fit at all :). Do I have any recourse, or is Microwatt (plus peripherals) considered "inherently too big" to be practical for a 25k LUT FPGA?The text was updated successfully, but these errors were encountered: