-
Notifications
You must be signed in to change notification settings - Fork 36
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
Include first/last row in bitstream generation and ConfigFSM #311
base: FABulous2.0-development
Are you sure you want to change the base?
Include first/last row in bitstream generation and ConfigFSM #311
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes logically make sense to me. But I have no knowledge in the configuration side.
Thanks for taking a look. I would like to add that I have successfully configured and simulated a fabric with I/Os in the top row and other tiles requiring config bits in the bottom row. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! See my comment for why I marked this as "changes requested". The rest looks fine so if this is resolved we can merge this.
As a sidenote, I don't like our current handling of "NumberOfRows". In fabric_gen.py
the value for the generated eFPGA_top.v
is set to the actual number of rows - 2. Probably this is a leftover from the previous special treatment of the top and bottom row? We should maybe think about setting this value to the actual number of rows and change all calculations done with this variable (or parameter on the Verilog/VHDL side).
FABulous/fabric_files/FABulous_project_template_verilog/Fabric/ConfigFSM.v
Show resolved
Hide resolved
FABulous/fabric_files/FABulous_project_template_vhdl/Fabric/ConfigFSM.vhdl
Outdated
Show resolved
Hide resolved
If this works, then it's probably fine, but I would rather have this double checked since this is touching core parts of the config logic :) |
@IAmMarcelJung Sorry for the confusion, with this comment I was mainly referring to the changes in Thus the changes to |
I think making the config bits mandatory is not a good idea. The reason why we haven't foreseen config bits by default is that in "just eFPGA" mode, we will likely not need the top and bottom columns for something "fancy" and just do a loopback (as done, for instance, by most Xilinx FPGAs). Connections to a fabric should not be just applied arbitrary but following the bottom to top vectorization scheme in mind. Anyway, a clean approach is scanning through the fabric row-by-row and count the number of configuration bits needed (after we generated all tiles) and then decide for each row it it needs configuration bits. We could do that with thresholds for, let's say 8, 16, 32 FrameData bits. |
@dirk-koch Thank you for your reply. I understand your points, but I do not fully agree with them:
There is an easy way to still be able to generate bitstreams for older FABulous fabrics: by simply adding a "legacy" mode to I can add that change to this PR right away.
That workaround wasn't directly obvious to me and probably to other users of FABulous either. Aside from not being pretty, as you mentioned, it wouldn't work well with my automatic stitching approach as the row of NULL-tiles would add empty space to the fabric macro.
Yes, I understand that in some situations you don't need configuration bits in the top and bottom row. But what if you need them, as in my case?
True, but in my fabric I am already pretty tile-space limited and I just would like to add some simple ADC or DAC tiles at the bottom. I know, it might not be best practice, but nextpnr can succesfully route my user design and that's good enough for me. I understand why FABulous introduced the exception for the top and bottom row, but I strongly believe that it creates more issues than it solves. The current exception is not a generalised solution (one could even call it a hack). It already cost me a lot of time to work around a lot of issues caused by it. It needlessly complicates many of the subsystems in FABulous such as the fabric description, fabric generation, bitstream generation and even the configuration FSM. Exceptions have to be made everywhere just because these two rows must not have configuration bits. That's why I worked on removing these exceptions everywhere, making sure the fabric is still generated correctly, and in turn making the code easier to read and therefore making it easier for people to contribute to FABulous. With these changes users have the choice of whether they want any config bits in those rows or not. If they don't use any config bits in those rows, that's fine too. Just implement a loopback and the physical macros can be very small. Hopefully soon can be a long time, and there are issues caused by the current implementation right now, so I urge you too reconsider these changes that improve the current situation. If you like, we can have a short call where I can show you my current fabric and explain in detail why these changes are important to me and for the FABulous project. |
358b51b
to
b71e9a8
Compare
As discussed with @dirk-koch, we proceed by adding a note to the CLI startup message regarding the legacy mode:
To generate a bitstream in legacy mode, simply invoke:
This will additionally output the following info during bitstream generation:
@KelvinChung2000 @IAmMarcelJung I would appreciate if you could re-review the changes and if everything is ok we can merge them :) |
Hey @mole99, Just wanted to mention, that we also should add a note to the README about the legacy mode and also some documentation about it. We might also need to update the docs regarding these changes, but this does not need to happen in this PR. |
@EverythingElseWasAlreadyTaken thanks, I appreciate it! I've added a note about legacy bitstream generation to the README (and removed an outdated mention of |
Thanks for your changes! :) I will try to look after them this evening, but can't promise anything right now. |
So I looked and it and tried it out and everything looks good :) Except for that one thing I mentioned in the comment, which still needs to be resolved or acknowledged. |
5d894b9
to
dbc49b6
Compare
dbc49b6
to
92f43fe
Compare
Hi @IAmMarcelJung, sorry for my delayed reply! I had a closer look at the top-level integration and found an issue with the current implementation: I didn't realize that the top-level only generates Regarding your question whether the always @ (*) begin
if(WriteStrobe) begin // if writing active
RowSelect = FrameShiftState; // we write the frame
end else begin
RowSelect = {RowSelectWidth{1'b1}}; //otherwise, we write an invalid frame
end
end You could prevent All in all, I think the whole configuration logic needs a major overhaul at some point in time, as it's hard to read and hard to debug, but that's beyond the scope of this PR... :) |
I agree. I happen to be working on it now, and it is unclear how they all work together. Creating a standard specification for frame-based configuration bitstream might be a good idea. Like AXI, it tells you how it should behave but not how it should be implemented. |
Hi @mole99, thanks, I did just briefly read what you wrote and it makes sense to me, but I will still try to take a closer look with your explanations this week :) Hope this is fine or do you need this merged asap? |
@IAmMarcelJung No hurry, this or next week sounds fine :) |
Hi @mole99, so I took a closer look into how the configuration works and as far as my understanding goes it is indeed fine to have the However I couldn't fully follow your explanation. You wrote
This is a bit contradictory to me, since a WriteStrobe should signalize that new WriteData is available or did I get this wrong? So if both WriteStrobe is 1 and FrameShiftReg is Anyway, this one occurence of WriteData == I hope my explanations make a bit sense and are somewhat understandable, although it was a bit hard to describe what I actually mean. Feel free to ask if anything is unclear :) But the tl;dr is that I'm now also convinced that your changes will not cause issues, if my understanding is correct! |
Hi @IAmMarcelJung, let me try to clarify!
That is almost correct. If we take a look at the module Frame_Data_Reg (FrameData_I, FrameData_O, RowSelect, CLK);
parameter FrameBitsPerRow = 32;
parameter RowSelectWidth = 5;
parameter Row = 1;
input [FrameBitsPerRow-1:0] FrameData_I;
output reg [FrameBitsPerRow-1:0] FrameData_O;
input [RowSelectWidth-1:0] RowSelect;
input CLK;
always @ (posedge CLK) begin
if (RowSelect==Row)
FrameData_O <= FrameData_I;
end//CLK
endmodule If
Absolutely, resetting I wouldn't change the current implementation too much until a proper rewrite. I think it would make more sense for each I'm currently working on an alternative config controller for my fabric, you can check it out once it's ready :) |
Hi @mole99, thanks again for your clarifications!
I know and my doubt was never that wrong data is written by matching to
Yes you're right, we shouldn't change too much here. @dirk-koch also has plans to change the config logic, maybe he already told you that. So from my side everything looks fine now and I will unblock this :) However, I leave it up to @KelvinChung2000 to decide when this will be merged since he did the whole rebasing and I don't want to cross his plans with the release. Thanks you so much for your contribution and the constructive discussion! |
@IAmMarcelJung I don't know the specifics on what Dirk wants to change. Perhaps the bitstream format could be overhauled too, it feels a bit awkward. At the moment the header looks as follows:
The column select is the width of But that's for another time ;) It would be great if these changes could be included in the next release since my fabric builds on them. Or do you mean we simply merge this after #324? That's fine for me, just let me know if I need to rebase this PR. Thanks a lot for your extensive code reviews! |
Once we make the current master stable and relaese, we will move the development to the main. It will not call a release, but it will be on master, at least. Did #325 state all the current limitations of the bitstream format? I think we can move the conversation about the new bitstream requirement there. |
@KelvinChung2000 Alright, that sounds fine! Btw. could you rename the development branch to just I've added a few comments to #325 👍 |
Now that #306 has been merged, we need to actually make use of the first and last row of the fabric.
Therefore this PR:
bit_gen.py
to dump the config bits for the first and last rowConfigFSM
to write that information to the FrameData's of the first and last rowConfigFSM
, the VHDL version is untested but should behave the sameAs a bonus, I finally added a desync frame to
bit_gen.py
. This means after configuration has finished,ConfigFSM
will actually go back into the idle state and it is possible to upload a different bitstream without resetting the circuit.This is shown here working: