Brian Drummond
Guest
Thu Aug 12, 2010 10:54 pm
On Fri, 13 Aug 2010 02:44:52 +1000, Mark McDougall <markm_at_vl.com.au> wrote:
Quote:
constant All_acbds: arr_t_abcd :=
( some_value_for_type_a, another_value_for_type_a,
yet_another_value_for_type_a...and_finally_another_for_type_a),
( true, true, false...true),
( a_value_of_c, another_value_of_c, yet_another_value_of_c...
and_a_last_value_for_c_which_has_a_long_name),
It may be useful to alias short names (for the array) onto the long names you
need elsewhere for clarity.
- Brian
KJ
Guest
Fri Aug 13, 2010 3:34 pm
On Aug 12, 12:44 pm, Mark McDougall <ma...@vl.com.au> wrote:
Quote:
KJ wrote:
And now a constant array of the universe of those choices...
constant All_abcds: arr_t_abcd :> > (x"0", x"1"..., x"3"),
(x"3", x"4"..., x"6");
KJ note: There was a set of () missing above. Should have been
constant All_abcds: arr_t_abcd

-- Twas missing this
(x"0", x"1"..., x"3"),
(x"3", x"4"..., x"6")); -- Twas missing the outer )
Quote:
This I like, except for one thing. It groups values for each constant
together in the source, which wouldn't be a problem except I need to be
able to see the relationship between some of the constants for a given
"configuration". In the example above, you can easily see 0 goes with 3, 1
goes with 4 etc, but when you have different types and longer names, it
makes it quite difficult... :(
constant All_acbds: arr_t_abcd :> ( some_value_for_type_a, another_value_for_type_a,
yet_another_value_for_type_a...and_finally_another_for_type_a),
( true, true, false...true),
( a_value_of_c, another_value_of_c, yet_another_value_of_c...
and_a_last_value_for_c_which_has_a_long_name),
etc...
As I mentioned above, I had a bit of a typo and probably should have
used name associations when showing the final constant, and I think
you may be misinterpreting the groupings. Just to clear this up,
using your now longer named things, and trying to be a bit more
explicit, the constant would be declared as
constant All_acbds: arr_t_abcd(1 to 4)
1 =>
(
A => some_value_for_type_a,
B => true,
C => a_value_of_c,
D => some_value_for_type_d
),
2 =>
(
A => another_value_for_type_a,
B => true,
C => another_value_of_c,
D => another_value_for_type_d
),
3 =>
(
A => yet_another_value_for_type_a
B => false,
C => yet_another_value_of_c,
D => yet_another_value_for_type_d
),
4=>
(
A => and_finally_another_for_type_a,
B => true,
C => and_a_last_value_for_c_which_has_a_long_name
D => and_a_last_value_for_type_d
)
);
There are two sets of aggregates (now explicitly named, rather than
implicit as before). The 'outer' set is the array of the record
types, the inner set of aggregates defines the elements of each
record.
The set of constants for a given configuration are clearly all
together. If for some of the constants you really would like to see
all of the 'b' for the different configurations together in the source
like this...
constant The_b_types: arr_boolean(1 to 4) := (true, true, false,
true);
Then either use that new constant in the bigger constant like this...
constant All_acbds: arr_t_abcd
1 =>
(A => some_value_for_type_a,
B => The_b_types(1),
C => a_value_of_c,
D => some_value_for_type_d),
....
Or simply remove the 'b' element from the record and use this new 'b'
array since ultimately you want to select a particular set to use and
there is no particular advantage (other than to thosse who are picky
about consistency) to either of these two forms
All_acbds(Sel).B
The_b_types(Sel)
Kevin Jennings
Thomas Stanka
Guest
Tue Aug 17, 2010 9:45 am
On 12 Aug., 18:57, Mark McDougall <ma...@vl.com.au> wrote:
Quote:
Thomas Stanka wrote:
Is there a reason why you don't want to solve this with generics or
configurations?
Generics won't solve my problem. Just move it.
Some tools like Modelsim or Synplify accept Generics as tool input. So
you avoid commenting of code by passing Generics from the tools.
Quote:
Configurations - I've never been able to get them to solve this problem.
You can use Generics and set them in the configuration. Each build
would use a different top level configuration setting the Generics,
while the complete other code is identical for the design.
Unfortunately not every tool supports Configurations on top level
properly although it is pure and legal vhdl.
bye Thomas