Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

giving value to a constant

Status
Not open for further replies.

qwerty_asdf

Member level 4
Joined
Mar 26, 2012
Messages
73
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,781
I have this:
Code:
constant offset_A: std_logic_vector(address_length+1 downto 0) :="01"&(others=>'0');
constant offset_B: std_logic_vector(address_length+1 downto 0) := "10"&(others=>'0');
but of course is not acceptable by compiler.

Can you suggest me an alternative way?

address_length is a generic so it can be used if you wish. What I want is obvious, give a value to the first 2 bits and the rest of them be '0'.

The error I get is:
Code:
 OTHERS aggregate cannot be operand of operator with unconstrained array formal.
 

constant offset_A : std_logic_vector(address_length+1 downto 0) := (address_length+1 downto address_length => "01", others => '0' );
 

constant offset_A : std_logic_vector(address_length+1 downto 0) := (address_length+1 downto address_length => "01", others => '0' );
I get this error:
Code:
Error: C:/Modeltech_pe_edu_10.1a/examples/landmark_1.vhd(97): String literal found where non-array type ieee.std_logic_1164.STD_LOGIC was expected.
** Warning: C:/Modeltech_pe_edu_10.1a/examples/landmark_1.vhd(97): (vcom-1073) Non-locally static choice (association #1, choice #1) is allowed only if it is the only choice of the only association.
 

try this:

constant offset_A : std_logic_vector(address_length+1 downto 0) := (address_length => '1', others => '0' );
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top