Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17268 Discussions

Add/Subtract Two numbers in verilog HDL

Altera_Forum
Honored Contributor II
2,956 Views

Hi I'm new in quartus II. 

 

I would just like to ask on how to implement 

2-digit Adder / Subractor 

HEX3 = +/- 

SW[7:0] = BCD 

PB[0] = + 

PB[1] = - 

PB[2] = = 

PB[3] = reset 

 

we are using a hardware called Cyclone II. 

I have tried a code but it does not finish compiling. I don't know why. 

Can someone help me?
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
2,059 Views

You must write HDL (Hardware Description Language) code, not programming code. 

What you describe in your code is supposed to be synthesized into logic gates, not to be executed by a processor. 

I think your present code is useless and it needs to be completely rewritten.  

A few hints: 

- those while loops make no sense. Remember: this is HDL, not software  

- the hex to bcd decoders could be more conveniently fitted into a reusable submodule 

- use a clock to sync the whole process 

- take a basic HDL course or read a Verilog tutorial
0 Kudos
Reply