how to write the below verilog code in vhdl

Status
Not open for further replies.

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
340
Helped
26
Reputation
52
Reaction score
8
Trophy points
1,298
Location
China
Activity points
4,162
how to write aggregate in vhdl

b=a{1'b1};
a is a constant defined with 'define
b is std_logic_vector
for example
a=4
then
b=1111
 

I think this would work if a is a constant predefined in a package or something

signal b : std_logic_vector (a-1 downto 0);

for i in 0 to a-1 loop
b(i)<='1';
end loop;


hope it would help;-)
 

As mentioned above, you should use the constant a in the definition of b:

signal b : std_logic_vector (a-1 downto 0);

Then there is no need anymore to use a, you can just write:

b <= (others=>'1');

Look for "aggregate" in any good VHDL tutorial.
 

or simply

signal b : std_logic_vector(a-1 downto 0) := (others =>'1');
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…