Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - vhdl:data memory

 
Thread Tools Search this Thread
Old 02-29-2008, 12:30 PM   #1
Default vhdl:data memory


Hi,

I'm trying to writing a code suitable for a data memory but I have
some problem with the input decoder and the multiplexer:
- the decoder receives an address as input (std_logic_vector(7 downto
0)) in order to select one of 256 rows of the storage unit,which has
the typical row-column structure. Each row is formed by a 16-bit-
register (flip-flop) I've built the storage unit with e "generate"
command.
- the mux is driven by the same adress and has to choose one of the
256 rows.

The question is:how can I write the code for a mux that can accept as
input 256 16 bit-long std_logic_vector elements?And how can I write
the code for a decoder whose input is an 8 bit-long address?A for-loop
maybe?
I really don't know.

Thanks
Bye


agnese.rosi@gmail.com
  Reply With Quote
Old 02-29-2008, 01:59 PM   #2
Tricky
 
Posts: n/a
Default Re: vhdl:data memory
On Feb 29, 12:30 pm, agnese.r...@gmail.com wrote:
> Hi,
>
> I'm trying to writing a code suitable for a data memory but I have
> some problem with the input decoder and the multiplexer:
> - the decoder receives an address as input (std_logic_vector(7 downto
> 0)) in order to select one of 256 rows of the storage unit,which has
> the typical row-column structure. Each row is formed by a 16-bit-
> register (flip-flop) I've built the storage unit with e "generate"
> command.
> - the mux is driven by the same adress and has to choose one of the
> 256 rows.
>
> The question is:how can I write the code for a mux that can accept as
> input 256 16 bit-long std_logic_vector elements?And how can I write
> the code for a decoder whose input is an 8 bit-long address?A for-loop
> maybe?
> I really don't know.
>
> Thanks
> Bye


Convert the std_logic_vector to an integer using the numeric_std
packages:

my_int := to_integer(unsigned(my_slv));

then use my_int to index into an array. You can do this for both the
mux and the memory address.
You can quite happily do the coversion to an int as a variable inside
a process:

signal addr : std_logic_vector(7 downto 0);

type my_mux_type is array(0 to 255) of std_logic_vector(15 downto 0);
signal mux_signals : my_mux_type;
...
...
...
conv_proc : process(addr)
variable addr_int : integer range mux_signals'range; --you need
to specify range to stop the synthesiser making it a 32 bit bus
begin
addr_int := to_integer(unsigned(addr));
output <= mux_signals(addr_int);
end process;


But with a mux this wide, it is likely you will need some registering
in there somewhere, otherwise you may find it struggles to meet timing
requirements.


Tricky
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
OCZ 6GB Triple-Channel 1333 MHz DDR3 Memory Kit Admin Front Page News 0 02-16-2009 01:27 PM
memory upgrade -D- A+ Certification 1 02-03-2007 01:01 AM
Re: What memory to use? me A+ Certification 0 12-14-2004 03:33 AM
Re: Memory stick question Nildram A+ Certification 1 01-14-2004 02:41 PM
Half memory: lost? Joe A+ Certification 4 09-04-2003 08:57 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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