Solved

Question about VHDL programming

Posted on 2010-09-09
8
512 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
Independent Software Vendors: 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!

 

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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Advice in Xamarin 21 109
Not seen Link button 5 73
What is CANH and CANL voltage when CAN Trasceiver is in sleep mode ? 2 39
Output in PHP throwing alignment of data off issue 12 57
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

733 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