Willem Oosthuizen said:
Is it possible to make signal declarations in an architecture conditional?
E.g.. Suppose I want to write some code for a combinatorial correlater. The
correlation length is specified as a generic.
Obviously the number of internal signals needed is dependant on the length.
One way is to define all signals needed for lengths up to a certain value.
This is a brute-force way of doing things. There must be anoher way.
There is no way in VHDL to make signal declarations conditional.
The only other choice is to declare signals inside generate
statements, and use the "if condition(generics)" generate scheme to
generate the desired logic.
From LRM 93:
generate_statement ::=
generate_label :
generation_scheme generate
[ { block_declarative_item } -- <- signal declrations
begin ]
{ concurrent_statement }
end generate [ generate_label ] ;
block_declarative_item ::=
subprogram_declaration
| subprogram_body
| type_declaration
| subtype_declaration
| constant_declaration
| signal_declaration
| shared_variable_declaration
| file_declaration
| alias_declaration
| component_declaration
| attribute_declaration
| attribute_specification
| configuration_specification
| disconnection_specification
| use_clause
| group_template_declaration
| group_declaration
----------------------------------------------------------------------------
Ben Cohen Publisher, Trainer, Consultant (310) 721-4830
http://www.vhdlcohen.com/ (e-mail address removed)
Author of following textbooks:
* Using PSL/SUGAR with Verilog and VHDL
Guide to Property Specification Language for ABV, 2003 isbn
0-9705394-4-4
* Real Chip Design and Verification Using Verilog and VHDL, 2002 isbn
0-9705394-2-8
* Component Design by Example ", 2001 isbn 0-9705394-0-1
* VHDL Coding Styles and Methodologies, 2nd Edition, 1999 isbn
0-7923-8474-1
* VHDL Answers to Frequently Asked Questions, 2nd Edition, isbn
0-7923-8115
------------------------------------------------------------------------------