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

Macro parameter mapping #41

Closed
gatecat opened this issue Apr 22, 2021 · 13 comments
Closed

Macro parameter mapping #41

gatecat opened this issue Apr 22, 2021 · 13 comments

Comments

@gatecat
Copy link
Collaborator

gatecat commented Apr 22, 2021

Consider the following design with initialized LUTRAM, for the xc7:

module top(
    input clk, we,
    input [6:0] wa, ra,
    input wd,
    output [1:0] rd
);
    RAM128X1D #(
        .INIT(128'hFFEEDDCCBBAA99887766554433221100)
    ) ram_i (
        .WCLK(clk), .WE(we),
        .A(wa), .DPRA(ra),
        .D(wd),
        .SPO(rd[0]), .DPO(rd[1])
    );
endmodule

Opening the implemented design in Vivado and running:

get_property INIT [get_cells ram_i/DP.LOW]
64'h7766554433221100
get_property INIT [get_cells ram_i/DP.HIGH]
64'hFFEEDDCCBBAA9988

you can see that the INIT parameter of the RAM128XD macro has been split into two for the constituent cells.

Currently the schema appears to have no way to describe a parameter mapping like this, which will need to be fixed to support initialised LUTRAM and some other macros like LUT6_2.

cc @clavin-xlnx as I don't think RapidWright currently provides this kind of data either?

@gatecat
Copy link
Collaborator Author

gatecat commented Apr 22, 2021

Parameter transforms we would probably want to support:

GitHub
nextpnr portable FPGA place and route tool. Contribute to YosysHQ/nextpnr development by creating an account on GitHub.

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

@gatecat - I don't /think/ we want to support these types of transforms in the interchange format. Instead I think we want to make the synthesis tool do the work?

@gatecat
Copy link
Collaborator Author

gatecat commented Apr 22, 2021

Macro transforms are currently part of the interchange format, and discussions with litghost concluded that they were in scope, because of the potential complex interactions between macro expansions and placement (and for example, how macro expansions only affect the physical and not logical netlist) mean they will be something that nextpnr-interchange supports.

See SymbiFlow/nextpnr#264 for some more discussion (I might be able to dig out some IRC logs about this too).

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

@gatecat - Just confirming, #264 is converting a single block into multiple blocks, right?

@gatecat
Copy link
Collaborator Author

gatecat commented Apr 22, 2021

Yes, but importantly only from a physical netlist point of view and not from a logical netlist point of view.

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

Some parameters attached to cell instances may be relevant for the place and route problem. A common example is LUT equation sharing, which can happen on fracturable LUTs. See the schema for details.

@gatecat
Copy link
Collaborator Author

gatecat commented Apr 22, 2021

This looks to be the relevant section?

Nope, that's totally different. That's describing how physical cells map onto bels.

Macro expansions are about creating a hierarchy of multiple physical cells out of a single logical cell (which then follow those rules to map onto bels, for example a RAMD64E onto a LUT6 bel); as used for LUTRAM, complex IO, etc.

Some parameters attached to cell instances may be relevant for the place and route problem. A common example is LUT equation sharing, which can happen on fracturable LUTs. See the schema for details.

This affects more than just the place and route problem, it also affects FASM generation for example.

There isn't, imo, a great philosophical debate to be had here, just a relatively simple omission from the macro expansion rules (which are otherwise well documented in #264).

@gatecat
Copy link
Collaborator Author

gatecat commented Apr 22, 2021

I think the two ways of solving this would be:

@mithro
Copy link
Contributor

mithro commented Apr 22, 2021

@gatecat - I think either approach could work, do you want to try both and see which works better? @clavin-xlnx - Do you have an opinion?

@clavin-xlnx
Copy link
Contributor

Yes, deriving parameter values on the primitives as a function of the parent's value makes sense to me. Given the two options, I would probably prefer the latter (augmenting PrimToMacroExpansion) just to keep the scope of the solution tight.

@gatecat
Copy link
Collaborator Author

gatecat commented May 22, 2021

Fixed by #42

@gatecat gatecat closed this as completed May 22, 2021
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

3 participants