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.

[SOLVED] reset array of record

Status
Not open for further replies.

nsgil85

Member level 4
Joined
Dec 11, 2012
Messages
73
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,833
Hi guys

What is the syntax for reset array of record?
for example:
Code:
type record_slr is record
	a     : integer range 0 to 520;
	b     : integer range 0 to 780;
	c     : std_logic_vector(8 downto 0);
	d     : std_logic_vector(31 downto 0);	
	e     : std_logic_vector(31 downto 0);	
end record record_slr ;

type array_slr  is array (0 to 37) of record_slr ;
signal slr: array_anchors ;

	process(clk,nrst)
	begin
		if nrst= '0' then 
                     -- ??
 

assuming you want to reset everything to 0:

Code:
slr <= (others => (0,0,(others => '0'), (others => '0'), (others => '0'));

- - - Updated - - -

or you could do it explicitly:

Code:
for i in slr'range loop
  slr(i).a <= 0;
  slr(i).b <= 0;
  slr(i).c <= (others => '0');
  slr(i).d <= (others => '0');
  slr(i).e <= (others => '0');
end loop;
 
You can either review aggregate syntax in your favorite VHDL book or initialize record elements individually, you can even use loops if you don't remember how to access an array at once.

The former looks someway like this

Code VHDL - [expand]
1
slr <= (others => (a => 0, b => 0, c => (others => '0), d => (others => '0), e => (others => '0)));

 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top