-
Notifications
You must be signed in to change notification settings - Fork 71
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
GW1NR-9 vs GW1N-9 bit-stream #206
Comments
What quickly came to my mind without having to duplicate databases with and without R or store multiple ids in the database (which would require adding multiple IDE runs to get different ids at the fuzzing stage) was to add the --device-id parameter to gowin_pack. |
The new --device-id option would indeed be a lightweight approach for developers, yet a flexible one for users. However, we must note that your current classification is misaligned with Gowin's (https://www.gowinsemi.com/en/product/detail/46), hence confusing. It'd be more straightforward if you allowed specifying --family GW1NR-9C. Such family could be virtual, essentially an alias to GW1N-9C in everything by the --device-id. In that way, if the (ordinary) user does not explicitly specify the device-id, you can internally look it up based on --family and --device. Should the (power) user specify device-id, you take it as-is, without trying to derive from the other passed options. |
I wrote this small script:
and it outputs (when run in the docker container used in the CI):
So this should allow mapping any family back to the "true" family for nextpnr. However, I'm not quite sure where the bitstream ID gets set yet. Also, it appears that nextpnr itself might need to have some changes, as it has some bits hardcoded: https://github.com/YosysHQ/nextpnr/blob/5bfe0dd1b137e43d8ed85485552e126a6b7ee978/gowin/main.cc#L80 |
I can assume that since the image is formed in gowun_pack, then from there you can start searching, which may end in some fuzzer, where the vendor IDE is launched to obtain a “clean” image. |
Would @bl0x be the right developer to pull in for this? |
(I will PR once I get this working, just adding the info here as a work log) An updated script to also extract IDCODEs for families is below, I also inverted the dictionary format which is written to the JSON file: https://gist.github.com/jeremyherbert/d8863a6893f54f000af78024c8c7e0db I just need to work on the bitstream IDCODE override now. |
Also just for a bit of fun, the IDCODEs in this document have some which are wrong: https://cdn.gowinsemi.com.cn/TN653E.pdf ;) |
Which ones are incorrect? How about bringing it to Gowin's attention? Have you followed up with them? |
Well at least GW1NR-9 and 9C are swapped relative to what the IDE has in the programmer file, as confirmed by reading the IDCODE with JTAG/openFPGAloader out of a tang 9k. After I saw that just took the whole table as untrustworthy and moved on. Have a look in the gist at the IDCODEs and see how they are different for those two parts. I don’t have any contacts at Gowin and I assume like most other semiconductor companies they don’t care about anyone not buying high volume. So I haven’t contacted them, but feel free to do so if you have a contact point. |
@chili-chips-ba I know it's a lot to build, but you should be able to get this working now - please give it a go if you have time. I tested on both the tang nano 20k and tang nano 9k and they both worked fine with openFPGALoader (which rejects the flash if the IDCODE is wrong). |
Thank you! @Juninho99 from our team shall provide feedback. |
Gowin tech support has responded to our enquiry. Here is what they said:
|
The only difference between these two devices is in the package add-ons. FPGA die is the same for both. While N package includes only FPGA die, the NR is a SIP with SDRAM, PSRAM, or double PSRAM packaging options along with FPGA die.
Since those are essentially "external components", by supporting the N, Apicula is also supporting the NR. So far, all is nice and dandy.
But, the problem is that current Apicula doesn't allow specifying NR for --family. Without it, the NR bit-stream is built with N ID. When we then try to download Apicula-generated bit-stream using Gowin programmer, it complains about incorrect target. It does not seem it would take much to allow building the NR bitstream with the proper NR ID, thus opening the path for mixing and matching Apicula with Gowin proprietary tools.
The text was updated successfully, but these errors were encountered: