• 0

Help on VHDL lab for class


Question

ok, so we have our first lab to do by next weds.. no one understands it.. on top of this we have a quiz on it this coming monday... so can anyone help me understand the question... once i understand that i'll know how to start coding it... here it goes:

"You will design a logic circuit that adds two 4-bit BCD numbers and produces a 4-bit result (Sum) along w/ a Carry bit. ... Write the behavioral and structural VHDL code for a 4-bit BCD Full Adder (using the Carry as an input depends on the model of the adder circuit you are implementing)."

so, thats the jist of it... im sure it's not hard to code... and thats not what im concerned with... i basically just dont understand what we're really doing when it comes down to the circuit/gate level... help please. thanks.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Behavioural is basically a straight algorithm written like any other high level language but a structural uses ports and gates directly. What exactly is your confusion? Are you not understanding how to draw out your circuit even on paper?

Link to comment
Share on other sites

  • 0

yeah, how to even start to draw it to get a conceptual idea... would i use 1 8-bit chip that allows 2 4-bit inputs? would i use 2 4-bit chips and add them somehow? could i use 4 2-bit chips (w/ carry-in too) and daisy-chain them to produce an answer?

i guess im confused b/c all the addition we've ever done was w/ 2 or 3 bits (like a full or half adder)... this is asking for 2 4-bit numbers... i have no clue where to start.

Link to comment
Share on other sites

  • 0

First of all its BCD. So what you do is write the logic equations. Like Q1 = A1 * A2 + A3... or whatever. Then you write the code for it. with BCD you are always dealing with 4-bits numbers. SO what you try to do is write a module for adding a single bcd digit. Then learning addition techniques from grade 2 you combine the results :p

For behavioural you can write it like you would in java. With structural you're using port maps so work it out on paper first..

Coding vhdl can be actually quite hard... It's not just another language.

Link to comment
Share on other sites

  • 0

i appreciate the help... but i just cant seem to visualize whats going on in my head... am i doing something like Q1 = A1 + B1 (and carry if i need to) & A2 + B2 (carry) etc? :huh:

Link to comment
Share on other sites

  • 0

okay remember how children add:

AB

+CD

-----

{Carry}{A+C+Carry}{B+D}

What you need to do is write that. It would be easiest for the structural to write a single bcd digit adder with carry in and carry out. Tie the carry in of the LSD to 0, tie the carry out of the LSD to the carry in of the MSD.

Link to comment
Share on other sites

  • 0

Here's a One Bit Full Adder. You stack four of this up, you have yourself a 4 bit Full Adder. For example, if you have

ABCD

+EFGH

This adder will add D and H, and produce a sum and Cout, which is the carry for the addition of C and G.

Edit: I made this out of NAND gates only because it's easy for CMOS implementation. It's a whole lot easier you use various other gates.

post-47-1094947662.jpg

Edited by duke_kid
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.