No video

FPGA Math - Add, Subtract, Multiply, Divide - Signed vs. Unsigned

  Рет қаралды 39,683

nandland

nandland

Күн бұрын

Пікірлер: 51
@jefftheusch3071
@jefftheusch3071 6 жыл бұрын
To divide by a number other than 2, you can multiply by its reciprocal to an arbitrary precision. For example, to divide by 3, you can multiply by 21845, then shift the result right by 16 bits, which divides by 65536. 21845/65536 is about 1/3. For a more precise result, use more bits!
@Nandland
@Nandland 6 жыл бұрын
Jeff, excellent point! I did neglect to talk about this trick. Darnit!
@jefftheusch3071
@jefftheusch3071 6 жыл бұрын
nandland no worries! Hope it's helpful to someone. Thanks for the videos!
@jefftheusch3071
@jefftheusch3071 3 жыл бұрын
@gautha pandith A binary multiply can be represented as a series of shifts and additions. Take for example 6 * 10, which in unsigned binary is 110b * 1010b. The multiplicand (6) is shifted based on the position of each 1 bit in the multiplier (10), and all of the shifted values are added together to get the result... (6
@TatharNuar
@TatharNuar Жыл бұрын
I need to do this to apply a low-pass filter on an image, and Vivado is complaining about a DSP not being pipelined. I don't know what that means.
@Ganjin88
@Ganjin88 5 жыл бұрын
Appreciate the elaboration. When I took a digital design course in college, my professor didn't explain the SIgned and Unsigned stuff properly. Then again, I wasn't aware of FPGAs until my last semester in college. smh.
@Anikung17
@Anikung17 4 жыл бұрын
In the beginning, isn't what was explained as the two's compliment of 1 actually -1. This is going by another simple way to explain 2's compliment, which is to say that every bit is the weight of a power of 2, except for the most significant bit, which has a weight of the NEGATIVE of its respective power of 2.
@Factory400
@Factory400 6 жыл бұрын
You learn to add in 1st grade....many start in Kindergarten. I just ordered the Go Board - look forward to the lessons. Already watched most of the videos!
@Nandland
@Nandland 6 жыл бұрын
Thanks for ordering! Glad you found the information useful!
@MilanKarakas
@MilanKarakas 5 жыл бұрын
Excellent explanation. I just wondered how to divide with anything that 2,4,8 and so on. You gave me the coolest answer I ever heard - complicated. That is so true. Thanks. EDIT: Typo: should be ...anything than 2,4,8... that makes sentence different.
@vk2ig
@vk2ig 5 жыл бұрын
In general: ÷M = shift right by N bits, where M = 2^N. E.g. ÷4 = shift right by 2 bits, ÷8 = shift right by 3 bits, etc. To multiply by the same factors, just shift left by the required number of bits instead.
@MilanKarakas
@MilanKarakas 5 жыл бұрын
@@vk2ig Thanks. Okay, I made typo in my question. Should be: How to divide with anything than 2, 4, 8 and so on. This means dividing by 3, 5, 7 ...
@vk2ig
@vk2ig 5 жыл бұрын
@@MilanKarakas OK, understood. I have used the "shift left and subtract" algorithm to divide by non-integer powers of 2, but not on FPGAs.
@MilanKarakas
@MilanKarakas 5 жыл бұрын
@@vk2ig Thanks. I will figure out something. Just having pollen allergy... unable to do anything smart.
@sythrusrl1736
@sythrusrl1736 3 жыл бұрын
Awesome video! Definitely learned a lot from this, thank you.
@siyavashadib9067
@siyavashadib9067 6 жыл бұрын
Hey Dear Russel , I'm one of the many people who used your tutorials on the GoBoard to learn a few things and take the first steps into the FPGA world . First I wanted to thank u for all the great help and guidance that actually helped me get my first Job related to FPGA development . I've been working on a more complex development board for myself with some more components like HDMI , MicroController and . . . But I can't figure out how to make a programmer on board using the FTDI chip like u did on the GoBoard in a way i can use it both for Serial interface and Programming the FPGA . I Would really appreciate it if u could give me a hand on this since I have almost no idea how to make one . Best Regards
@Nandland
@Nandland 6 жыл бұрын
Some FPGA boards just work with the FTDI chip, some don't. It depends on the FPGA. I'm not sure which ones do or do not work. The Go Board schematic is on this page: www.nandland.com/goboard/index.html Hope that helps. Good luck!
@siyavashadib9067
@siyavashadib9067 6 жыл бұрын
Thanks a lot , I've been searching about the FTDI's FT2232 and how to use it for this purpose but i can't figure out how to configure the EEPROM for the FTDI to enter the JTAG HS2 mode to program the FPGA . I Saw some Xilinx FPGA boards using this as well . Can u share the code of the EEPROM for the FTDI on the GoBoard ?
@Nandland
@Nandland 6 жыл бұрын
For the Go Board I didn't have to do anything to the EEPROM. The Lattice toolchain is able to make it work. Sorry.
@siyavashadib9067
@siyavashadib9067 6 жыл бұрын
Ah , alright . Thanks a lot for ur response . if u happened to know anything about how to make the FTDI chip to act as a JTAG HS2 let me know please . Best Regards
@ikefir
@ikefir 7 жыл бұрын
Thanks for your work, man! Keep it up! Really keeps me motivated to spend my free time tinkering with FPGAs. By the way do you plan on covering fixed point arithmetic on an FPGA?
@Nandland
@Nandland 7 жыл бұрын
Yes. Originally I planned to do it in this video, but it was already too long.
@ikefir
@ikefir 7 жыл бұрын
nandland great! Will be waiting for that one. Also I would be happy to see a video on how to _properly_ organize a device configuration (i2c sensor for example, a common case with dev boards) without any kind of system on chip.
@Nandland
@Nandland 7 жыл бұрын
Thanks for the suggestion, I'll add it to the list!
@alinparcalab7269
@alinparcalab7269 6 жыл бұрын
Hello, awesome video honestly, can you make a video with Time to digital convertor explained and ring oscillator explained
@chrishadjipetris6059
@chrishadjipetris6059 Жыл бұрын
I'd like to know what happens when you assign an output as X in a case for don't care values
@riddhipadariya7517
@riddhipadariya7517 6 жыл бұрын
Very well explained! Thanks alot.
@mateuszkaleta6669
@mateuszkaleta6669 6 жыл бұрын
Great video, helped me a lot!
@PersonalXZ
@PersonalXZ 4 жыл бұрын
Division is simple. division is subtraction with right shift divisor: 135/10=13 (%=5) -->> 135-("0"*'160')-("1"*'80')-("1"*'40')-("0"*'20')-("1"*'10') -->> Result="01101b"=13 Remainder=5
@TEAbouda
@TEAbouda 3 жыл бұрын
Can you explain that more please?
@PersonalXZ
@PersonalXZ 3 жыл бұрын
@@TEAbouda if 135>=(10 x 2e4) then multiplier is 1 else multiplier is 0 2e4 = 16 10 x 16 = 160 is not 135>=160 then multiplier is 0 (multiplier x 160) = (0 x 160) = 0 135 - (0 x 160) = 135 2e3 = 8 10 x 8 = 80 is 135>=80 then multiplier is 1 135 - (1 x 80) = 55 2e2 = 4 10 x 4 = 40 is 55>=40 then multiplier is 1 55 - (1 x 40) = 15 2e1 = 2 10 x 2 = 20 is not 15>=20 then multiplier is 0 (multiplier x 20) = (0 x 20) = 0 15 - (0 x 20) = 15 2e0 = 1 10 x 1 = 10 is 15>=10 then multiplier is 1 15 - (1 x 10) = 5 = remainder binary number 01101 is decimal 13
@balamurugans780
@balamurugans780 3 жыл бұрын
How to perform fixed-point addition in verilog?
@keyboard_toucher
@keyboard_toucher 5 жыл бұрын
Speaking of integer division, it is slow on CPUs as well. When the divisor is known at design time, what compilers tend to do instead of dividing is a trick involving shifting, multiplying by some constant and then shifting again. The constant and shift amounts can be chosen in such a way as to get the same result as if division had been performed. Does anyone do this on FPGAs?
@tomzhu8719
@tomzhu8719 4 жыл бұрын
Veeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrry nice video for VHDL,thanks ,man。
@bennguyen1313
@bennguyen1313 4 жыл бұрын
Regarding how one should use the verilog 'signed' and 'unsigned' keyword whenever comparing or doing math operations for synthesis (not simulation).. does the sign get extended automatically or does one need to do it manually? For example, would : reg signed [7:0] var; var
@bennguyen1313
@bennguyen1313 4 жыл бұрын
Any idea why the last comparison fails? www.edaplayground.com/x/5g99
@shivsrikakolum2100
@shivsrikakolum2100 2 жыл бұрын
after addding 1 how did it go to 1010?
@nivethasukumar384
@nivethasukumar384 6 жыл бұрын
Hi! Thanks for your work! How to implement multiplication on FPGA when there is an arbitrary number of inputs? Is there a way to do so?
@scottwindham9824
@scottwindham9824 6 жыл бұрын
Is your Go Board still available for purchase? I am unable to reach the sales page.. Thanks!
@Thjr13enGhost
@Thjr13enGhost 7 жыл бұрын
I have a question: typically when multiplying, the result will have a width equals to the total sum of the width of both factors. However i think that in signed multiplication it always end up with 1 extra bit which is the extended sign bit. Can we trunkcate this so the result could get better resource utilization?
@Nandland
@Nandland 7 жыл бұрын
Sure if you really need the extra space. I usually don't bother.
@NoahFect
@NoahFect 6 жыл бұрын
You'll need to keep the "second sign bit" of the product only if you need to support multiplication of the largest negative value with the largest negative value. E.g., for 16-bit values, try to keep your data in the range [-32767,32767] instead of the maximum available range [-32768,32767]. The resource savings can be substantial.
@lekharane5344
@lekharane5344 3 жыл бұрын
Is there is way to solve polynomial functions using Verilog on a FPGA?
@NoSpeechForTheDumb
@NoSpeechForTheDumb Жыл бұрын
Not in a symbolic way, and not with an arbitrary accuracy. An FPGA can do fast parallel integer operations at some user-defined accuracy, so you could just sweep the whole number area in a for loop and check if the current number is an approximate solution, but that's not an appropriate task for an FPGA.
@magnuswootton6181
@magnuswootton6181 3 жыл бұрын
u dont have to use 2s complement, but i probably will. do it however u wish.
@David_94
@David_94 5 жыл бұрын
But all that is like high level VHDL, what happents in real life? Behind the plus sign vhdl creates all the full adders or what?
@Nandland
@Nandland 5 жыл бұрын
Are you asking how the synthesis tool works? I'm sure you could read about different approaches to adding, multiplying etc in research papers and stuff. The actual implementation of the math is less important to me.
@kedharguhan
@kedharguhan 2 жыл бұрын
I dont think I have ever seen such a small whiteboard lol
@russianultraviolet4441
@russianultraviolet4441 Жыл бұрын
Hi, I've had a signed number problem alot lately. Sometimes either the compiler or (?) flips my number assignment, that is, for example, I declare a number as a signed number, but it treats it as an unsigned number, and vise versa. This problem comes and goes, so it's some sort of instability, but I can't seem to put a finger on it, and don't know how to fix it. Any encounter this before? Any help would be appreciated!
@Nicknamelikeyours
@Nicknamelikeyours 6 жыл бұрын
Why do you depend to continue making videos on the sales number of your board? Don't you have fun doing these videos in your free time to educate your viewers?
What is a Clock in an FPGA?
18:58
nandland
Рет қаралды 53 М.
Boolean Algebra And LUTs in FPGA
21:27
nandland
Рет қаралды 108 М.
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 54 МЛН
ROLLING DOWN
00:20
Natan por Aí
Рет қаралды 11 МЛН
Can This Bubble Save My Life? 😱
00:55
Topper Guild
Рет қаралды 86 МЛН
КАКУЮ ДВЕРЬ ВЫБРАТЬ? 😂 #Shorts
00:45
НУБАСТЕР
Рет қаралды 3,5 МЛН
How to Choose an FPGA for your design
22:02
nandland
Рет қаралды 20 М.
How AI Discovered a Faster Matrix Multiplication Algorithm
13:00
Quanta Magazine
Рет қаралды 1,4 МЛН
Implementing Memory Cache in FPGA
9:06
Some Assembly required
Рет қаралды 1 М.
TREE vs Graham's Number - Numberphile
23:50
Numberphile
Рет қаралды 1,2 МЛН
Crossing Clock Domains in an FPGA
16:38
nandland
Рет қаралды 67 М.
What is a Flip-Flop?  How are they used in FPGAs?
24:13
nandland
Рет қаралды 159 М.
هذه الحلوى قد تقتلني 😱🍬
00:22
Cool Tool SHORTS Arabic
Рет қаралды 54 МЛН