Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > new to VHDL, question about arrays

Reply
Thread Tools

new to VHDL, question about arrays

 
 
Joe26 Joe26 is offline
Junior Member
Join Date: Jan 2008
Posts: 1
 
      01-23-2008
HI

i'm trying to do the following thing:

Signal arr: std_logic_vector(1 downto 0);
Signal BitPos: integer:=0;

process(CLK)
begin

arr(BitPos) <= Din; --Din is std_logic type
BitPos <= BitPos + 1;

end process;

I'm trying to run a TestBench in which Din is set to '0' initialy and to '1' after 10ns. Now I understand how the process works and that BitPos is actually set to 1 before Din is inserted to arr, which means Din is inserted to arr(1) insted of arr(0). All i want to do is instering the first Din into arr(0) and the second Din into arr(1).
I hope you understand my problem with the indexing, maybe you have a solution for this.

Thx,
Joe.
 

Last edited by Joe26; 01-23-2008 at 10:28 AM..
Reply With Quote
 
 
 
 
gloin gloin is offline
Junior Member
Join Date: Jan 2008
Posts: 2
 
      02-01-2008
Quote:
Originally Posted by Joe26
HI

i'm trying to do the following thing:

Signal arr: std_logic_vector(1 downto 0);
Signal BitPos: integer:=0;

process(CLK)
begin

arr(BitPos) <= Din; --Din is std_logic type
BitPos <= BitPos + 1;

end process;

I'm trying to run a TestBench in which Din is set to '0' initialy and to '1' after 10ns. Now I understand how the process works and that BitPos is actually set to 1 before Din is inserted to arr, which means Din is inserted to arr(1) insted of arr(0). All i want to do is instering the first Din into arr(0) and the second Din into arr(1).
I hope you understand my problem with the indexing, maybe you have a solution for this.

Thx,
Joe.
you wrote your code without a process,you know this code will run concurrently. So if you want sequential run you should write it in a process.

process(clk)
begin
if clk'event and clk = '1' then
arr(BitPos) <= Din; --Din is std_logic type
BitPos <= BitPos + 1;
.
.
.
.
end if;
end process;

hope it helps..

regards,
Gloin
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multidimensional arrays and arrays of arrays Philipp Java 21 01-20-2009 08:33 AM
char arrays and integer arrays... why the difference? Bill Reyn C++ 3 06-22-2004 12:01 PM
Arrays.asList() returning java.util.Arrays$ArrayList Alexandra Stehman Java 5 06-17-2004 06:04 PM
Arrays and Pointers to Arrays kelvSYC C Programming 2 09-26-2003 06:52 AM
initializing arrays of arrays Mantorok Redgormor C Programming 4 09-11-2003 02:08 AM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57