Forum Discussion
Altera_Forum
Honored Contributor
17 years agofixed-point tips
Hi I have some experience with Quartus, but in the past have only worked on projects that implement very basic boolean expressions (like generating pulses with user defined widths and delays)....
Altera_Forum
Honored Contributor
17 years agoUsing these libraries has nothing to do with the LPM library. the LPM libraries are a separate thing altogether. Using the fixed_point libraries should give you much more reaadable and portable code, as well as making simulations much faster. The synthesisor should take the code and place multiplers/adders for you. The LPM library does not use the sfixed or ufixed types, so no you cannot input them into an LPMMULT and make it work, you have to type convert the values to std_logic_vector (which really is meant to have no meaning other than a collection of bits)
So, where before you will have had:
mult : altmult_add
generic map (
width_a => 16,
width_b => 16,
......
)
port map (
clk => clk,
dataa => a,
datab => b,
...
result => p,
);
you can replace it with:
mult_proc : process(clk)
begin
if rising_edge(clk) then
p <= a*b;
end if;
end process;
To be honest, this method has been around for years using the numeric_std package, just with the fixed package now it makes reading fixed point code that much easier.