Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Vhdl question

Altera_Forum
Honored Contributor II
1,153 Views

I come on this pice of code: 

 

SIGNAL clockticks200k: INTEGER RANGE 0 TO max200k; 

 

What dose Range stand for?
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
407 Views

 

--- Quote Start ---  

I come on this pice of code: 

 

SIGNAL clockticks200k: INTEGER RANGE 0 TO max200k; 

 

What dose Range stand for? 

--- Quote End ---  

 

 

The word range is used here to constrain the signal clockticks200k to the range 0<=clockticks200k<=max200k. If the value that clockticks200k ever evaluates to something outside of this range, a simulator will assert an error telling you so. 

 

If the signal were declared: 

SIGNAL clockticks200k: INTEGER; 

no such checks would be performed. 

 

Range constraining is a good practice if you know the bounds of the values. It provides a free assertion for you in your VHDL code without having to actually code an assertion.
0 Kudos
Altera_Forum
Honored Contributor II
407 Views

Thank you.

0 Kudos
Altera_Forum
Honored Contributor II
407 Views

You're welcome. 

 

I should have also mentioned that a range constraint also guides the synthesis tool. The synthesis tool should only use as much resources as are necessary to represent the outer bounds of the integer range of the declared signal.
0 Kudos
Reply