I attempted to use time units of ms and ns in a symbol property, but Quartus ignored them.
Snapshot from BDF schematic:
Code snippet from VHD file:
generic ( CLOCK_PERIOD : time := 20 ns; DEBOUNCE_PERIOD: time := 125 ms ); ... constant MAX_COUNT: natural := DEBOUNCE_PERIOD / CLOCK_PERIOD - 1; signal counter: natural range 0 to MAX_COUNT := 0;
Code snippet from BDF file:
(parameter "CLOCK_PERIOD" "P\"20 ns\"" "" (type "PARAMETER_UNKNOWN") ) (parameter "DEBOUNCE_PERIOD" "P\"125 ms\"" "" (type "PARAMETER_UNKNOWN") )
Snapshot of RTL schematic:
This produces a counter of only 3 bits, i.e. ceil(log2(125 / 20)), which means that Quartus ignored the units.
It should be 23 bits, i.e. ceil(log2(125x10^-3 / 20x10^-9))
I conducted an experiment to see if Quartus would accept the SI Units if I removed the space between the numerical value and the SI Unit, i.e. "20ns" and "125ms". When I compiled the design, Quartus crashed.
What's going on?
I'm not sure what you're trying to do here. Timing information is not part of a symbol. It's selected by the Fitter based on timing constraints specified in the .sdc file. What's your goal here?
I've updated my VHDL code snippet to show the generic parameters which are of type time. These parameters are editable from the BDF schematic.
When the symbol file for the entity is created and added to the BDF, Quartus puts the default values of "20000000 fs" and "125000000000000 fs" into the symbol parameters. This means that Quartus correctly read the default values of the generic parameters in the VHDL source file and converted them to femtoseconds (fs).
I changed them back to "20 ns" and "125 ms" to make them more readable.
That's when I discovered that Quartus completely ignores the units when reading back the parameters from the BDF file to compile the design. I found that you can use units like "20 us" and "125 ps" and it will still compute 125 / 20 = 6.25 giving a 3-bit counter.
I also found that you can't use bogus units like "20 Mickey" and "125 Mouse" because the compiler complains:
Error (10482): VHDL error at file.vhd(#): object "Mickey" is used but not declared
Error (10482): VHDL error at file.vhd(#): object "Mouse" is used but not declared
This means that the Quartus compiler knows what ms, us, ns and fs mean, but it doesn't actually take them into account when compiling the design.
I also found that you can use unit-less values, e.g. "2" and "12500000" and it will compute a 23-bit counter.
Six unit time definition available in Quartus and ms and ns are included. You can refer to link below for more.
Thank you for your reply.
I've read through your link.
How does this explain the incorrect calculation of 125 ms / 20 ns = 6.25 by the Quartus compiler? It should be 6250000.
And fs is not listed, so why does Quartus convert ms and ns in VHDL generic parameters to fs for BDF symbol properties?