Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Tim10
Beginner
151 Views

Is it possible to use time units of ms and ns in a BDF Symbol Property?

I attempted to use time units of ms and ns in a symbol property, but Quartus ignored them.

 

Snapshot from BDF schematic:

Snapshot of BDF Schematic Parameters.png

 

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:

Snapshot of RTL Schematic Counter.png

 

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))

 

EDIT:

 

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.

Quartus Prime Problem Report.png

 

What's going on?

0 Kudos
4 Replies
sstrell
Honored Contributor II
69 Views

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?

 

#iwork4intel

Tim10
Beginner
69 Views

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.

SyafieqS_Intel
Moderator
69 Views

Hi Mathias,

 

Six unit time definition available in Quartus and ms and ns are included. You can refer to link below for more.

https://www.intel.com/content/www/us/en/programmable/quartushelp/13.0/mergedProjects/reference/gloss...

 

Thank,

Regards

Tim10
Beginner
69 Views

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?

Reply