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

Reply

VHDL - Re: Repetitive code (Newbie)

 
Thread Tools Search this Thread
Old 08-06-2003, 11:22 PM   #1
Default Re: Repetitive code (Newbie)


"smu" <> wrote in message news:<3f2fd735$0$16171$>...
> I try to find a elegant way to code a component in order to employ it with
> different value of a constant.
> ....

You will have to use generics and for..generate.
Since you are using attributes to specify single rom16x1 component
contents, the solution is not the nicest one:
--------start---------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity c_nibble is
generic ( busmax : integer := 3;
inits : string := "926C4B5A99CC552A" );
port ( input : in std_logic_vector(3 downto 0);
output : out std_logic_vector(busmax downto 0));
end c_nibble;

architecture c_nibble_a of c_nibble is
component rom16x1
port( a3, a2, a1, a0 : in std_logic;
o : out std_logic);
end component;
attribute init : string;
begin
rom: for i in busmax downto 0 generate
attribute init of blk : label is
inits((busmax-i)*4+1 to (busmax-i)*4+4 );
begin
blk: rom16x1 port map ( a3 => input(3), a2 => input(2), a1 => input(1),
a0 => input(0), o => output(i));
end generate rom;
end c_nibble_a;
-----------stop------------

VHDL 93 compliant compiler is required to handle this code.

Good luck!

Jerry


Jerry
  Reply With Quote
Old 08-07-2003, 06:06 AM   #2
smu
 
Posts: n/a
Default Re: Repetitive code (Newbie)
Which would be the nicest solution to initialize the ROM blocks ?

smu

"Jerry" <> a écrit dans le message de news:
...
> "smu" <> wrote in message

news:<3f2fd735$0$16171$>...
> > I try to find a elegant way to code a component in order to employ it

with
> > different value of a constant.
> > ....

> You will have to use generics and for..generate.
> Since you are using attributes to specify single rom16x1 component
> contents, the solution is not the nicest one:
> --------start---------
> library IEEE;
> use IEEE.STD_LOGIC_1164.ALL;
>
> entity c_nibble is
> generic ( busmax : integer := 3;
> inits : string := "926C4B5A99CC552A" );
> port ( input : in std_logic_vector(3 downto 0);
> output : out std_logic_vector(busmax downto 0));
> end c_nibble;
>
> architecture c_nibble_a of c_nibble is
> component rom16x1
> port( a3, a2, a1, a0 : in std_logic;
> o : out std_logic);
> end component;
> attribute init : string;
> begin
> rom: for i in busmax downto 0 generate
> attribute init of blk : label is
> inits((busmax-i)*4+1 to (busmax-i)*4+4 );
> begin
> blk: rom16x1 port map ( a3 => input(3), a2 => input(2), a1 =>

input(1),
> a0 => input(0), o => output(i));
> end generate rom;
> end c_nibble_a;
> -----------stop------------
>
> VHDL 93 compliant compiler is required to handle this code.
>
> Good luck!
>
> Jerry





smu
  Reply With Quote
Old 08-07-2003, 04:28 PM   #3
Mike Treseler
 
Posts: n/a
Default Re: Repetitive code (Newbie)
smu wrote:
> Which would be the nicest solution to initialize the ROM blocks ?
>


This rom has been nice to me:

http://groups.google.com/groups?q=this_rom

-- Mike Treseler



Mike Treseler
  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
How To Access HTML elements in code behind??? nedums_b Software 1 02-07-2008 07:15 PM
Circumvent Region Code hufaunder@yahoo.com DVD Video 11 01-29-2007 09:51 PM
Probelm For Runing This Code farhad13841384 Software 0 08-03-2006 07:32 AM
.avi files giving region code error Craig Cameron DVD Video 2 03-07-2006 02:49 PM
Change region code and PAL to NTSC? Aloke Prasad DVD Video 0 02-26-2004 01:54 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