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.

Computer Arithmetic, a subset of Computer Architecture, deals with methods of representing integers and real values (e.g., fixed- and floating-point numbers) in digital systems and efficient algorithms for manipulating such numbers by means of hardware circuits or software routines.

On the hardware side, various types of adders, subtractors, multipliers, dividers, square-rooters, and circuit techniques for function evaluation are considered.

Software aspects of computer arithmetic include complexity, error characteristics, stability, and certifiability of computational algorithms.

Reference and further learning:

B. Parhami / UCSB: Number Representation and Computer Arithmetic

29 questions
17
votes
4 answers

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 not considering fractional parts at all (so \$…
Rick_2047
  • 3,897
  • 5
  • 46
  • 68
4
votes
2 answers

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 recently came across these: Brent–Kung adder,…
quantum231
  • 11,218
  • 24
  • 99
  • 192
4
votes
3 answers

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 apart when dealing with twos complement signed…
4
votes
1 answer

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 away from the keyword signed, and I'm explicitly handling sign-bits where needed. At some point, I want to store the…
Cal-linux
  • 2,029
  • 2
  • 20
  • 37
4
votes
2 answers

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 understand about the propagation delay of an N-bit carry-lookahead adder. The book…
3
votes
1 answer

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: - 37 1.96533143520 Op A: 0x92fb8ffb (1 00100101…
3
votes
2 answers

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 represented by computers. Irrational numbers are numbers…
3
votes
4 answers

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 \$ Q_{14}\$. First I represent the numbers in the…
Granger Obliviate
  • 1,391
  • 10
  • 29
2
votes
1 answer

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. module Multiplier (x,y,z); input [7:0]x,y; output [15:0] z; assign z=x*y; endmodule It got compiled without any errors. But…
2
votes
2 answers

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 78) for Vivado's Vivado design synthesis guide…
David777
  • 1,548
  • 12
  • 29
2
votes
1 answer

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 is an unsigned 16-bit number passed into the…
user4574
  • 11,816
  • 17
  • 30
2
votes
2 answers

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. So the final result should be 1111 (-1 in 2's complement…
Granger Obliviate
  • 1,391
  • 10
  • 29
1
vote
2 answers

Arithmetic calculation error using PIC 18F4520

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 y = a * x^8 where a = -6.5991144677544e-09 let x = 60. When…
newbie
  • 25
  • 6
1
vote
1 answer

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 implemented at the hardware level? (for instance, on a modern Intel processor). Also, is it…
Weier
  • 111
  • 2
1
vote
2 answers

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 (Highest Positive Number) to -2x-1 (Smallest Negative…
Ali A
  • 11
  • 1
1
2