Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - VHDL aggregates assignment

 
Thread Tools Search this Thread
Old 09-12-2005, 10:52 PM   #1
Default VHDL aggregates assignment


Is it possible to use aggregates to perform the inverse of this
concatenation operation:

signal d : std_logic_vector(11 downto 0);
signal a1, b1, c1 : std_logic_vector(3 downto 0);
d <= a1 & b1 & c1;

With something like this:

signal a2, b2, c2 : std_logic_vector(3 downto 0);
(a2, b2, c2) <= d;

This syntax doesn't work, as the signals are vectors, not std_logic. I
probably just don't have the syntax right. I'd like to use this method
as it is less error prone than the following, especially if lengths are
changed later:

a2 <= d(11 downto ;
b2 <= d(7 downto 4);
c2 <= d(3 downto 0);

Thanks,
Brian



bkuschak@gmail.com
  Reply With Quote
Old 09-13-2005, 12:49 AM   #2
Mike Treseler
 
Posts: n/a
Default Re: VHDL aggregates assignment
wrote:
> Is it possible to use aggregates to perform the inverse of this
> concatenation operation

....
> With something like this:
>
> signal a2, b2, c2 : std_logic_vector(3 downto 0);
> (a2, b2, c2) <= d;


Yes, but it's probably more trouble than you expect.
You have to declare some types and subtypes.
See below:
(aa,bb,cc) := twelve_bit;

-- Mike Treseler

__________________________________________________ _________

library ieee;
use ieee.std_logic_1164.all;
-- use ieee.numeric_std.all;
-- Mon Sep 12 15:27:54 2005 Mike Treseler
entity aggregate is
end entity aggregate;

architecture play of aggregate is
begin
what : process is
variable a, b, c, d : std_ulogic;
subtype u3_t is std_logic_vector(2 downto 0);
subtype u4_t is std_logic_vector(3 downto 0);
type u4x3_t is array (0 to 2) of u4_t;
variable twelve_bit : u4x3_t := ("0000","1111","1010");
variable four_bit, aa,bb,cc : u4_t;
variable three_bit : u3_t;
begin -- process what
-- assign 4 bits to aggregate
-- vector type qualification required on right.
(a, b, c, d) := std_logic_vector'("0011");
-- assign four bit vector from aggregate
four_bit := (a, b, c, d);
assert four_bit = "0011" report "not 3";
-- reverse 4 bit values using two aggregates
-- vector type qualification required on right.
(d, c, b, a) := std_logic_vector'(a, b, c, d);
-- assign reversed values to vector
four_bit := (a, b, c, d);
assert four_bit = "1100" report "not 12";
three_bit := (a, b, c);
-- assign three small vectors from type u4x3_t
(aa,bb,cc) := twelve_bit;
assert cc = "1010" report "cc error";
assert bb = "1111" report "bb error";
assert aa = "0000" report "aa error";
report("Expect no assertions above.");
wait;
end process what;
end architecture play;
-------------------------------------------------------------------------------
--# vsim -c aggregate
--# Loading /steptoe/usr1/modeltech/linux/../std.standard
--# Loading /steptoe/usr1/modeltech/linux/../ieee.std_logic_1164(body)
--# Loading /steptoe/usr1/modeltech/linux/../ieee.numeric_std(body)
--# Loading play.aggregate(play)

--VSIM 1> run 1
--# ** Note: Expect no assertions above.
--# Time: 0 ns Iteration: 0 Instance: /aggregate
--VSIM 2>


Mike Treseler
  Reply With Quote
Old 09-16-2005, 05:47 PM   #3
bkuschak@gmail.com
 
Posts: n/a
Default Re: VHDL aggregates assignment
Yeah, I figured it would require something like that.
Thanks,
Brian



bkuschak@gmail.com
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an external software from VHDL? And how to interface VHDL with JAVA? becool_nikks Software 0 03-06-2009 07:08 PM
Help on auto conversion from Matlab to vhdl on filter design hardheart Hardware 0 12-07-2007 09:19 AM
ARRAY(n DOWNTO 0) OF STD_LOGIC_VECTOR(m DOWNTO 0) - VHDL freitass Hardware 0 11-01-2007 03:44 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46