Solved

Question about VHDL programming

Posted on 2010-09-09
8
506 Views
Last Modified: 2012-05-10
Hey,

        I had a question about programming in VHDL.  I need to write a program that will multiply two (two bit) numbers without using the * (multiplication operator).

 I have figured out how to do this, we could do a bit shift to the left if we were multiplying by 2, and we could do the same and add the first number to the result if the number is being multiplied by 3.

I took a shot at writing the code, but it doesn't quite work...

Appreciate any help on this.
0
Comment
Question by:errang
  • 3
  • 3
  • 2
8 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 200 total points
ID: 33643201
It's been a while since I've used VHDL, but I think this will work...

When multiplying 2 2-bit numbers, the result will be 4 bits.  If you write out a truth table, you can use that to generate a formula for each of the result bits.
0
 

Author Comment

by:errang
ID: 33643212
Yea, I thought about that, I'll have to check if that's Ok.

But... I was also wondering how we'd get the bits to make the LEDs light up.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 33643274
Like I said... it's been a long time.

I think if you write the formulas for each of the output bits, the voltage on the pins will change as the input voltages change.  If you have LEDs connected, they will light up.
0
 

Author Comment

by:errang
ID: 33643290
Ah.. kk, thanks, I'll try that out when I get to the lab.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 39

Expert Comment

by:Adam314
ID: 33643478
Depending on the current capabilities of your chip, you may need to condition the signal before connecting it to the LEDs.
0
 
LVL 12

Assisted Solution

by:HappyCactus
HappyCactus earned 300 total points
ID: 33644593
You can also use a lookup table, other than the truth table (by using the boolean algebra).
To connect the LED, simply connect the results bit to a pin on your device. If you are using a dev board, you maybe already have the LED and necessary electronics to drive it. Otherwise, check the fanout capability of your device, and put a transistor driver if necessary.


 
0
 

Author Comment

by:errang
ID: 33647400
I am using a standard Spartan 3E FPGA board, and it does  have LEDs.  And I do realize I need to send a 1 to the LEDs to make them light up.

My main question is, if I'm using a 4 bit std_logic_vector out1 for the output, do I simply connect out1(0) to LED0, and go about it that way?

And do I have to assign the value to out1 bit by bit?  Like out1(0) <= '1';  ?
0
 
LVL 12

Assisted Solution

by:HappyCactus
HappyCactus earned 300 total points
ID: 33647469
You connect each bit to each pin.
Then you can assign values to each bit or to the entire vector, as possible with vhdl (out1 <= "1001").
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is about my first experience with programming Arduino.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now