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.

doubts regarding vhdl coding

Status
Not open for further replies.

M.Shobana

Member level 1
Joined
Sep 13, 2011
Messages
35
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,505
hi........

what is the use of generic declaration in vhdl? is there any possibility of using memory lesser than the allocated memory?
for example : if iam declaring as q:eek:ut std_logic_vector(3 downto 0) can i use 2 bits instead of it without modifying the coding?iam doing project work so send me the solution as soon as possible
 

HI,

Generics are used in order for u to be able to declare constants in
the design in a generic way
e.g. -

entity adder is
generic (bus_width : integer := 8 ;
Port ( a: in std_logic_vecor (bus_width-1 downto 0);
b: in std_logic(bus_width-1 downto 0);
res : out std_logic(bus_width downto 0));
end adder ;
 
generics can also be used to completly change designs and architectures. But like prakashvenugopal said, they are constant and so do not change while the code is running.
 
thank u sir........
my another question is: in my program no of bits in output is undetermined becuse output depends on the i/p and calculation it may vary based on number of inputs while v r giving n simulation .in tis situation how cn i declare output size
 

Hi,

What is your maximum value for the Input and output.? I will declare the Max. value for both inputs and outputs.
 

you always size the input and output based on the worst case. The size of the ip and output cannot change.
 

case state is
when s1=>
if(x(1)==0) then
nextstate<=s2;
q1<="001";
else
nextstate<=sin;
q1<={q0,"000"};
end if;
in this program we may have the size of q as either 3 0r 6 bits. finally we have to concatenate all the 15 values of q1,q2,.......q15 in z; then how we can initiallize the size of q and z?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top