?
Solved

Question about VHDL programming

Posted on 2010-09-09
8
Medium Priority
?
517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 800 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:errang
ID: 33643290
Ah.. kk, thanks, I'll try that out when I get to the lab.
0
 
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 1200 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 1200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Simple Linear Regression
Suggested Courses

801 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