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

Reply

VHDL - for generate

 
Thread Tools Search this Thread
Old 02-25-2009, 09:23 AM   #1
Default for generate


can anyone tell me a simple example which use "FOR GENERATE" in vhdl?
thanks!!!


maniac89
maniac89 is offline   Reply With Quote
Old 02-25-2009, 08:25 PM   #2
joris
Member
 
Join Date: Jan 2009
Posts: 31
Default
This is a (silly) example:
Code:
architecture structural of ADD4 is component FA is port(X, Y, Z : in std_logic; S, C : out std_logic); end component; signal C : std_logic_vector(4 downto 0); begin C(0) <= C0; gen: for i in 0 to 3 generate ADD: FA port map(A(i),B(i),C(i),S(i),C(i + 1)); end generate gen; C4 <= C(4); end structural;

It gives a synthesizable 4-bit adder, given the correct FA (full-adder) component;
This isn't very serious code: You're likely to get better code using just the '+' operator.


joris
joris is offline   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




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