Questions tagged [computer-arithmetic]

Computer Arithmetic is the study of arithmetic algorithms and their hardware implementation. Use this tag when you ask questions on designing or verifying digital hardware for arithmetic functions.

Filter by
Sorted by
Tagged with
1 vote
1 answer
34 views

Dissect code related to "Convergent rounding: Round half to even" written in SystemVerilog

This question is related to article on rounding found here. The "Convergent rounding: Round half to even" code is written as follows: ...
quantum231's user avatar
  • 11.9k
0 votes
1 answer
39 views

Why is this extra MUX here when shifting mantissa as part of a FP add?

My textbook (Harris and Harris, Digital Design and Computer Architecture) asks us to design a simplified (in that only positive numbers be considered, with NaN and infinities ignored) FP adder block. ...
EE18's user avatar
  • 1,131
0 votes
0 answers
83 views

Is the Dadda multiplier faster than the Wallace adder?

If I understand it correctly, the Dadda multiplier adds the partial products in a similar way compared to the Wallace multiplier, but it doesn't reduce the partial product terms as much in its tree ...
Minecraft dirt block's user avatar
3 votes
2 answers
264 views

How many bits are needed to "fully capture" the addition of two binary integers?

(This is all related to my trying to understand my question here.) Let's consider the addition of two n-bit integers, \$x = x_{n-1}...x_0\$ and \$y\$. Let their sum be \$s\$. For the addition of ...
EE18's user avatar
  • 1,131
0 votes
2 answers
265 views

How many bits are required for a quotient in binary division?

I saw somewhere that if we have A (dividend) which is 2n-bits and B (divisor) which is n-bit, we can store the quotient in n-bits with a specific condition: the (n-1)th bit of the divisor has to be 1. ...
Emad Kheyroddin's user avatar
1 vote
2 answers
249 views

Arithmetic calculation error using PIC 18F4520 [closed]

I am trying to solve an equation using a PIC 18F4520 but the result that I am getting is not matching to the accurate answer that I calculated with Matlab. The part of the equation is ...
newbie's user avatar
  • 25
-1 votes
1 answer
88 views

Is floating point IEEE754 binary digit represented using special unit/circuit for arithmetic operation?

We know that two un/signed integers arithmetic operation using special circuit called full-adder to execute arithmetic operation in Arithmetic Logic Unit (ALU). The full-adder I mean is classical ...
Muhammad Ikhwan Perwira's user avatar
1 vote
1 answer
210 views

x86 MUL operation at hardware level

I understand the x86 operation to perform integer multiplication of two numbers (e.g. on 64 bits) is MUL. My question is, how is this operation generally ...
Weier's user avatar
  • 177
3 votes
1 answer
96 views

Floating point arithmetic - unexpected results in certain test cases

I was hoping I could get some help with a floating point adder I'm designing in verilog. The test case I am having trouble with is adding the following 2 numbers: ...
NoahWecoso's user avatar
1 vote
2 answers
98 views

Problem with the smallest negative number using Signed-2's-Complement

I have a problem figuring out why the smallest negative number we can represent in 3 bits, using Signed-2's-Complement is -4. I understand that in S2C format, we can create numbers from 2x-1-1 (...
Ali A's user avatar
  • 11
1 vote
0 answers
40 views

Can BCD and binary multipliers share circuitry?

Suppose you are implementing a BCD multiplier. Google says there are reasonably efficient known circuits for this. Say 8x8 -> 16 digits, and trying for a reasonable compromise between speed and ...
rwallace's user avatar
  • 563
4 votes
2 answers
145 views

When are these adder algorithms used in digital circuit design?

Whenever I need to add two numbers, I just write a+b in VHDL. I never have to bother about what is synthesized, as long as timing and area constraint is met I think the objective is achieved. I have ...
quantum231's user avatar
  • 11.9k
4 votes
3 answers
2k views

How to do signed 16-bit arithmetic on an 8-bit processor?

For example, to add two 16-bit numbers on my 8 bit machine, I add the low bytes together, then the high bytes together, and then add the carry flag to the high byte of the output. This strategy falls ...
Max Zabarka's user avatar
1 vote
1 answer
78 views

How to understand information as energy?

Cpu or gpu making calculations and creating information (decrease in entropy) is converting 100% of energy it pulls from the wall into heat. How should we understand the created order in terms of ...
Ahmet Said AK's user avatar
1 vote
0 answers
238 views

Capturing overflow in twos complement addition

I am trying to implement 8-bit twos complement addition. I am doing this by splitting the 8 bit inputs into 4 bit parts and then implementing 4 bit complement addition. A well known diagram is where ...
a6623's user avatar
  • 111
4 votes
1 answer
2k views

Verilog: Long expression — how to split into several steps with intermediate results?

The context is: I have 16-bit registers v1 and v2. These contain signed (2's complement) 16-bit values, but I decided to stay ...
Cal-linux's user avatar
  • 2,123
1 vote
3 answers
1k views

Is there a standard way to convert from a fixed point notation to a floating point notation?

Fixed point numbers can be in many different forms depending on the number of bits before and after the decimal expressed as Qm.n. Floating point numbers can be in many forms depending on the number ...
quantum231's user avatar
  • 11.9k
-1 votes
1 answer
47 views

Problem while implementing a n-bit substractor circuit in python

I'm trying to implement the following substractor circuit in python: And below is my code for it: ...
theCursedPirate's user avatar
0 votes
0 answers
72 views

Computer arithmetic algorithm: what might I be doing wrong?

So I'm working with the following differences equation: $$y_n=\alpha y_{n-1}+(1-\alpha)x_n$$ I know this works with 16-fixed point arithmetic, and given some samples I'm trying to figure out how the ...
Granger Obliviate's user avatar
2 votes
1 answer
732 views

Where did I code my multiplier wrong?

I've wrote a verilog code for Multiplier (8bit). I'm not getting the right result. Kindly tell me where i went wrong. ...
Kuchi Yashwanth's user avatar
3 votes
2 answers
746 views

How are irrational numbers best represented and processed by computers?

My question is closely related to this one: How do computers understand decimal numbers? However, that question deals with rational numbers only. I was wondering if irrational numbers can be ...
Shashank V M's user avatar
  • 2,321
3 votes
4 answers
2k views

Multiplication of two binary numbers in fixed point arithmetic

I'm performing some operations with fractional numbers in a 16-bit FIXED-POINT processor. I have to multiply the numbers \$ x=-6.35 \$, represented in \$ Q_{11} \$, and \$ y=-0.1 \$, represented in \$...
Granger Obliviate's user avatar
0 votes
0 answers
1k views

Is it possible to build a binary divider with this design?

So I am working on this ALU, and I have made this 8-bit multiplier based on this design: . Is it possible to adapt this design into a binary divider by using Subtractors instead of Adders, and maybe ...
Jamie Engel's user avatar
0 votes
2 answers
207 views

Is it possible to create a reusable full subtractor in SystemVerilog?

I am trying to design a full subtractor in SystemVerilog. I searched on Wikipedia and I found this https://en.wikibooks.org/w/index.php?title=Microprocessor_Design/Add_and_Subtract_Blocks ...
Shashank V M's user avatar
  • 2,321
0 votes
1 answer
682 views

Binary division restoring method

Hi i need help in understanding the binary division restoring method From -2, we stored the value to 5 by adding the divisor which is 7 After adding 7 to get 5, why does it automatically jump to 10? ...
Yogi Bear's user avatar
0 votes
0 answers
376 views

FPGA multiplication using DSP hardware, signed vs. unsigned

I'm using the DSP unit (just a fancy name for the multiplier/accumulator unit) of the Gowin GW1N devices to do some fairly simple math. These units accept two 18 bit inputs for the multiplier adding ...
gnuarm's user avatar
  • 197
2 votes
2 answers
1k views

Signed number multiplication on FPGA

I am trying to multiply signed numbers on a Nexys A7-100T FPGA development board with VHDL. See Reference manual webpage link for the FPGA board hardware information. Also see this link (begins page ...
David777's user avatar
  • 1,480
2 votes
1 answer
374 views

What is the fastest (in clock cycles) 16-bit x 16-bit unsigned integer division algorithm that will run on an ATMEGA1284?

What is the fastest (in clock cycles) division algorithm that will run on an ATMEGA1284? The dividend is an unsigned 16-bit number passed into the algorithm in a pair of 8-bit registers. The divisor ...
user4574's user avatar
  • 12.2k
2 votes
2 answers
442 views

Arithmetic right shift: a paradox?

So I was asked to perform the simple task of doing a 3-bit arithmetic shift of the number 1101 (-3 in 2's complement notation). Now this is easy and it goes as 1101 -> 1110 -> 1111 -> 1111. ...
Granger Obliviate's user avatar
0 votes
1 answer
63 views

How many logic gates does it take to implement base-100 addition?

I'm curious about the trade-offs that have been made in implementing different kinds of arithmetic in different models of computers, to which I'm trying to understand what the costs of various options ...
rwallace's user avatar
  • 563
1 vote
1 answer
180 views

Why is overflow error in two's complement addition represented by XOR-ing the last two carries?

The first chapter of my textbook on microcontroller theory has the following paragraph. Here is one of the examples provided. The book shows three such examples, but provides no explanation for why ...
elile's user avatar
  • 305
0 votes
2 answers
527 views

12-bit pipelined adder

I have been given the task of designing a 12-bit pipelined adder: There are 4-bit adders connected by latches. Why are latches used between the 4-bit adders? Is it for synchronization?
Ashlesha Sunil Agate's user avatar
4 votes
2 answers
13k views

Carry Look Ahead adder propagation delay calculation

I'm studying Digital Design and Computer Architecture book, I'm stuck in the section of the carry-lookahead adder because there's something that I don't fully ...
Tortellini Teusday's user avatar
17 votes
4 answers
16k views

Calculating the square root of 8-bit binary number

I was looking for a way to calculate the square root of a given 8-bit number using only digital combination or sequential logic. Is this possible? One way may be to just use a look-up table since I'm ...
Rick_2047's user avatar
  • 3,917