Skip to content

Conversation

murphe67
Copy link
Collaborator

In order to remove our need for 4 different backends, we should expand the capabilities of the beta backend to encompass all of them.

This PR changes how we generate all of our arithmetic units in the VHDL beta backend, such that it now contains all features of the current VHDL backend, including the work on floating point units by @Carmine50 and @KillianMcCourt.

It also converts our floating point subtraction unit to be a direct wrapper around our adder.

@murphe67
Copy link
Collaborator Author

@Jiahui17 This is ready to merge now :)

signal dout_r : std_logic_vector(32 - 1 downto 0);
begin
--------------------- Instantiation -----------------
addf_vitis_hls_single_precision_lat_8_u : entity work.addf_vitis_hls_single_precision_lat_8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the latency fixed for Vivado floating point IPs?
If so, I want to assert generate_vivado_ip_wrapper received a valid latency as the argument

architecture = f"""
-- Architecture of mul_4_stage
architecture behav of {name} is
latency = params["latency"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, I want to add assert(latency == 4) here

Operation *op = $_op.getOperation();
if (auto attr = op->getAttrOfType<StringAttr>("internal_delay"))
return attr;
return StringAttr::get(op->getContext(), "0.0");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If internal_delay is stored in the format of "0.0", do we need to convert it into "0_0" before passing to the RTL?

Copy link
Collaborator

@shundroid shundroid Aug 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this default value is wrong, the buffering pass sets the converted format:

std::replace(delayStr.begin(), delayStr.end(), '.', '_');

So can you update this to "0_0"? (Also the comment above 'Defaults to "0.0" if not set.')

@murphe67 murphe67 marked this pull request as draft October 13, 2025 11:41
@murphe67 murphe67 marked this pull request as ready for review October 14, 2025 09:32
Comment on lines +12 to +14
# only used for flopoco
is_double = params.get("is_double", None)
internal_delay = params.get("internal_delay", None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# only used for flopoco

Why?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the backend, latency is also used in the buffer placement (there, we also care if the unit has a zero cycle latency). Should the latency interface also be used for that? Or this is just like for verifying if the op has annotated with a latency value

@Jiahui17
Copy link
Member

On a set note, I think it will be good to add some unittests on CI/CD just to test if everything is fine

@Jiahui17
Copy link
Member

@Jiahui17
Copy link
Member

I just had some questions on the interface design

@murphe67
Copy link
Collaborator Author

Thank you for reading!

On a set note, I think it will be good to add some unittests on CI/CD just to test if everything is fine

yes, i am running the normal CI/CD with this backend on the server, I want to switch the whole ci/cd to this (and remove the json for old backend) once this is merged. Andela is working on something for unit tests of individual unit generation, I think it is a next important goal also.

I just had some questions on the interface design

I should make a whole markdown file for how the backend handles units with IP cores but basically-

the backend receives a set of "IP selecting parameters" and a latency. It generates the name of the IP core based on the first set of parameters, and then adds a "valid propagation buffer" with size based on the latency.

The parameters for selecting the flopoco ip are different to selecting the vivado ip. The whole IP selection process should be improved, but the latency part is relatively final.

@murphe67
Copy link
Collaborator Author

In addition to the backend, latency is also used in the buffer placement (there, we also care if the unit has a zero cycle latency). Should the latency interface also be used for that? Or this is just like for verifying if the op has annotated with a latency value

If we dont pass the unit generators a latency, each generator must hardcode it for each pair (handshake op, IP selected), which is very fragile. Since the unit generators don't know the details of the IP, it doesn't make sense for them to know the latencies, and so they should recieve it as a parameter (how long should the valid propagation buffer be).

The interface just stores the result from the components.json file for the (handshake op, IP selected) pair- if the buffering pass reads directly from the json, it doesnt need the interface. The buffering pass is also what writes to the interface currently.

@Jiahui17
Copy link
Member

Jiahui17 commented Oct 16, 2025

The interface just stores the result from the components.json file for the (handshake op, IP selected) pair- if the buffering pass reads directly from the json, it doesnt need the interface. The buffering pass is also what writes to the interface currently.

Oh I forgot this interface is not the same as the kv pair in the hw.parameter attribute of the unit. I think this design makes a lot of sense, we could do something similar for the delay characteristic as well (also, buffer pass should just use the interface to get the latency/delay).

@murphe67 murphe67 merged commit 48666c7 into main Oct 16, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

4 participants