In timestamped Thu, 02 Aug 2007 01:12:07 -0700, Torsten
Landschoff <
[email protected]> posted:
|----------------------------------------------------------------------|
|> Your reply was quick and informative. Now, i'm more eager to start |
|> using 1076-2006 after it's approved and implemented in a Modelsim. |
| |
|Talking about VHDL 1076-2006, will there be a way to declare something|
|like |
| |
|type signed_vector is array(integer range <>) of signed; |
| |
|? I am just doing some DSP work and just tried to implement |
| |
|function quantize(samples : real; bitwidth : positive) return |
|signed_vector; |
|function dequantize(quantized : signed_array) return real_vector; |
| |
|I can't find a way to do this with VHDL'93. Suggestions? |
| |
|Thanks, Torsten" |
|----------------------------------------------------------------------|
It is not entirely clear to me what you are trying to do here. Do you
want quantize overloaded by several functions, each of which will
return a signed_vector of a different length according to bitwidth?
VHDL2007 will include
package fixed_generic_pkg is
generic (fixed_round_style: BOOLEAN;
fixed_overflow_style: BOOLEAN;
fixed_guard_bits: NATURAL;
no_warning: BOOLEAN);
type ufixed is array (INTEGER range <>) of STD_ULOGIC;
type sfixed is array (INTEGER range <>) of STD_ULOGIC;
....
end package fixed_generic_pkg;
but this would not involve overloading because each instantiation of
fixed_generic_pkg would need a different name. VHDL2007 does not have
generic instantiations in which the parameter is a type (Ada has these
kinds of generics but I do not know whether the Ada synthesis tools
are very good nor whether this is supported by any of them, and I read
a paper by one of their developers who claimed that VHDL is better),
and these still would not allow overloading.
VHDL2007 apparently will have object orientation but I do not know
much about VHDL2007's OO.
In VHDL93, perhaps you could be satisfied with preprocessing in
another language and producing VHDL source code as output; or
inefficiently but simply using the longest array length you could need
and simply ignoring the irrelevant bits as indicated by bitwidth; or
type signed_vector is array(integer range <>) of signed;
type pointed_to_type is
record
the_array : signed_vector;
end record;
type access_type is access pointed_to_type;
function quantize(samples : real; bitwidth : positive) return
access_type;
and constrain the length of the_array in an instance of
pointed_to_type when running quantize.
Perhaps better ways exist.
Regards,
Colin Paul Gloster