FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-14-2004, 09:24 PM
Gary Thorpe
Guest
 
Posts: n/a
Default Using aggregates for assignments

Hi,

I am having a problem using aggregates to assign signal values. My code is:

(in entity port declaration)
SELECTED: out std_ulogic_vector(7 downto 0);
UDQM, LDQM: out std_ulogic

(in architecture of entity)
variable set_value: std_ulogic_vector(9 downto 0);

(in body of architecture)
--(SELECTED, UDQM, LDQM) <= set_value; -- this gives trouble
-- these are fine
SELECTED <= set_value(9 downto 2);
UDQM <= set_value(1);
LDQM <= set_value(0);

Is there a way to assign the signals as a group or is it just not valid VHDL code
(I can do the equivalent in Verilog by doing {SELECT, UDQM, LDQM} = set_value)?

The errors I get when I try to use the aggregate are:

(SELECTED, UDQM, LDQM) <= set_value;
^
Warning: vhdlan,734 file.vhd(62):
Discrete range is not consistent with corresponding index subtype (too few
elements).
(SELECTED, UDQM, LDQM) <= set_value;
^
**Error: vhdlan,720 file.vhd(62):
Name is not of the required type; STD_ULOGIC expected.

This is using the 'vhdlan' tool in Synopsys.
Reply With Quote
  #2 (permalink)  
Old 06-14-2004, 10:05 PM
[email protected]
Guest
 
Posts: n/a
Default Re: Using aggregates for assignments

Gary Thorpe <[email protected]> writes:

> I am having a problem using aggregates to assign signal values. My code is:
> ...
> The errors I get when I try to use the aggregate are:
>
> (SELECTED, UDQM, LDQM) <= set_value;


The VHDL type system is getting in your way; try this:

(SELECTED(7), SELECTED(6), SELECTED(5), SELECTED(4),
SELECTED(3), SELECTED(2), SELECTED(1), SELECTED(0),
UDQM, LDQM) <= set_value;

Personally, I would use your other choice:

SELECTED <= set_value(9 downto 2);
UDQM <= set_value(1);
LDQM <= set_value(0);

--
Brian Ogilvie
brian dot ogilvie at mathworks dot com
Reply With Quote
  #3 (permalink)  
Old 06-14-2004, 11:34 PM
Mike Treseler
Guest
 
Posts: n/a
Default Re: Using aggregates for assignments

Gary Thorpe <[email protected]> wrote in message news:<caku20$g86$[email protected]>...

> I am having a problem using aggregates to assign signal values. My code is:


> (in body of architecture)
> --(SELECTED, UDQM, LDQM) <= set_value; -- this gives trouble



http://groups.google.com/groups?q=vhdl+aggregate+hetzer

-- Mike Treseler
Reply With Quote
  #4 (permalink)  
Old 06-14-2004, 11:36 PM
Gary Thorpe
Guest
 
Posts: n/a
Default Re: Using aggregates for assignments

[email protected] wrote:
> Gary Thorpe <[email protected]> writes:


>> I am having a problem using aggregates to assign signal values. My code is:
>> ...
>> The errors I get when I try to use the aggregate are:
>>
>> (SELECTED, UDQM, LDQM) <= set_value;


> The VHDL type system is getting in your way; try this:


> (SELECTED(7), SELECTED(6), SELECTED(5), SELECTED(4),
> SELECTED(3), SELECTED(2), SELECTED(1), SELECTED(0),
> UDQM, LDQM) <= set_value;


So aggregates must be composed of items with the same type?

> Personally, I would use your other choice:


> SELECTED <= set_value(9 downto 2);
> UDQM <= set_value(1);
> LDQM <= set_value(0);


I am also having trouble with this:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

port(
CS, RAS, CAS, WE: out std_logic;
..
..
..
(CS, RAS, CAS, WE) <= to_stdlogicvector("0010");
..
..
..
(CS, RAS, CAS, WE) <= "0001";

I try two different ways but both fail:

to_stdlogicvector("0010");
^
**Error: vhdlan,501 file.vhd(302):
Expression is ambiguous.
(CS, RAS, CAS, WE) <= "0001";
^
**Error: vhdlan,1021 file.vhd(315):
Can not determine type of right and left hand sides.

What am I doing wrong in this case? I would like to assign values to a group of
signals because together they define a logical operation (the four signals
define an SDRAM command for example). How do I do this properly?

> --
> Brian Ogilvie
> brian dot ogilvie at mathworks dot com


Thanks for the quick reply.
Reply With Quote
  #5 (permalink)  
Old 06-15-2004, 05:33 PM
[email protected]
Guest
 
Posts: n/a
Default Re: Using aggregates for assignments

Gary Thorpe <[email protected]> writes:
>
> So aggregates must be composed of items with the same type?


Or you have to use declarations or type qualifications which reduce the
attractiveness of left-hand side aggregates.

> (CS, RAS, CAS, WE) <= to_stdlogicvector("0010");


Try this:

(CS, RAS, CAS, WE) <= to_stdlogicvector("0010")(3 DOWNTO 0);
or
(CS, RAS, CAS, WE) <= unsigned'("0010");

For this one, I would likely use:

CS <= '0'; RAS <= '0'; CAS <= '1'; WE <= '0';

which is pretty compact and easily understood.


--
Brian Ogilvie
brian dot ogilvie at mathworks dot com
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Demote assignments ALuPin FPGA 2 11-15-2004 09:19 AM
ISE 6.1 with synplify : pin assignments Dave FPGA 1 11-17-2003 03:28 AM
Using Aggregates in Case Expressions Anand P Paralkar VHDL 6 10-28-2003 04:27 PM
Question - aggregates.. Kot VHDL 4 09-16-2003 01:26 PM


All times are GMT +1. The time now is 02:23 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved