Types

S

Sandeep

Does anyone know how to achieve slv(8) to mean std_logic_vector(7
downto 0) ? The idea is to make signal/port declarations concise. But
I am guessing concise-VHDL is an oxymoron anyways !

Sandeep
 
K

Kai Harrekilde-Petersen

Does anyone know how to achieve slv(8) to mean std_logic_vector(7
downto 0) ? The idea is to make signal/port declarations concise. But
I am guessing concise-VHDL is an oxymoron anyways !

Declaring slv to be a subtype of std_logic_vector will get you
halfways. But how are you going to discriminate between
std_logic_vector(7 downto 0) and std_logic_vector(8) using your
notation? Also, there are vectors which do are not 'downto', and
ranges that down have zero as the lower bound (and for good reasons
too).

I really really don't think you want to do what you write.

Regards,


Kai
 
J

Jim Lewis

Sandeep said:
Does anyone know how to achieve slv(8) to mean std_logic_vector(7
downto 0) ? The idea is to make signal/port declarations concise. But
I am guessing concise-VHDL is an oxymoron anyways !

Sandeep

That is because legal VHDL code and ambiguous are prohibited.

So at the current time, this cannot be done, however,
it is an interesting question.

Can I create an unconstrained type definition that only allows
arrays to be a single direction and requires one side of the
array to be a particular value, such as 0. In this case,
a constraint as you propose above could be made non-ambiguous
and hence legal.

The syntax probably could not be: slv(8)
Consider the following example:

signal A : slv(8) ;
signal B : slv(4) ;
signal C : slv(4) ;
signal D : sl ;

A <= B & C ; -- easy
C <= A(4) ; -- meaning 3 downto 0 -- Easy
B <= A(7 downto 4) ; -- is this still permitted?
-- If not how do I get these bits?

D <= A(5) ; -- meaning bit 5 -- or does it mean 4 downto 0?


So if it could be added to the language, I think it would
require a different (), perhaps [].


I am not sure it buys me enough to be excited about it,
however, I will inquire.

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
S

Sandeep

Thanks Jim. I havent thought about the ambiguity. For now I'll just
alias slv to std_logic_vector in an unconstrained way. So something
like ...

alias slv is std_logic_vector;
signal a : slv(3 downto 0);

Sandeep
Jim Lewis said:
Sandeep said:
Does anyone know how to achieve slv(8) to mean std_logic_vector(7
downto 0) ? The idea is to make signal/port declarations concise. But
I am guessing concise-VHDL is an oxymoron anyways !

Sandeep

That is because legal VHDL code and ambiguous are prohibited.

So at the current time, this cannot be done, however,
it is an interesting question.

Can I create an unconstrained type definition that only allows
arrays to be a single direction and requires one side of the
array to be a particular value, such as 0. In this case,
a constraint as you propose above could be made non-ambiguous
and hence legal.

The syntax probably could not be: slv(8)
Consider the following example:

signal A : slv(8) ;
signal B : slv(4) ;
signal C : slv(4) ;
signal D : sl ;

A <= B & C ; -- easy
C <= A(4) ; -- meaning 3 downto 0 -- Easy
B <= A(7 downto 4) ; -- is this still permitted?
-- If not how do I get these bits?

D <= A(5) ; -- meaning bit 5 -- or does it mean 4 downto 0?


So if it could be added to the language, I think it would
require a different (), perhaps [].


I am not sure it buys me enough to be excited about it,
however, I will inquire.

Cheers,
Jim
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,890
Members
47,423
Latest member
henerygril

Latest Threads

Top