full adder example using fpga

A

Amit

Hello group,

Does anybody know about an online resource that I can find some
samples on how to implement a full adder using LUT? either using
Flex10k or any other classical methods?

I've started learning FPGA and have done something but need to compare
it.

Regards,
Amit
 
R

Ralf Hildebrandt

Amit said:
Does anybody know about an online resource that I can find some
samples on how to implement a full adder using LUT? either using
Flex10k or any other classical methods?

Usually you don't need to think about every single fulladder. Just use
result<=a+b; -- all signals are vectors of type signed or unsigned

For a single fulladder you could use:

signal result : unsigned(1 downto 0);
signal a,b,c_in : std_ulogic;
signal sum,c_out : std_ulogic;

result<=unsigned('0' & a) + unsigned('0' & b) + unsigned('0' & c_in);
sum<=result(0);
c_out<=result(1);


Ralf
 
A

Andy

Usually you don't need to think about every single fulladder. Just use
result<=a+b; -- all signals are vectors of type signed or unsigned

For a single fulladder you could use:

signal result : unsigned(1 downto 0);
signal a,b,c_in : std_ulogic;
signal sum,c_out : std_ulogic;

result<=unsigned('0' & a) + unsigned('0' & b) + unsigned('0' & c_in);
sum<=result(0);
c_out<=result(1);

Ralf

It's even easier with integers:

signal a,b,sum,c_in,c_out : integer range 0 to 1;

sum <= (a + b + c_in) mod 2;
c_out <= (a + b + c_in) / 2;

Andy
 
A

Amit

Easier still, if I let synthesis wire up the carries :)

-- Mike Treseler

Thanks to all,

But maybe I didn't ask the question properly or I had to post in a
different group (I'm sure doesn't exist). My concern is not regarding
VHDL sytnax but trying to understand how to tacking the flow on a
Flex10K diagram.

I apologize all for this.

However, if somebody knows this I will be more than happy to have your
help.

Regards,
Amit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top