ALU stands for Arithmetic Logic Unit, that performs arithmetic and logical operations for computer systems.
Questions tagged [alu]
188 questions
0
votes
1 answer
How would one calculate Pi using Fixed-Point Arithmetic using the leibniz series?
I am trying to use an ALU and Leibniz Series to approximate pi using only integer operations ie multiplication and shifting. Does anyone know how I could program this in C?
0
votes
0 answers
Adder and Subtractor code not working VHDL
This code works except for the add and subtract operations denoted by opcode 010 and 110 respectively. When I try to add the numbers the result looks as though a and b are being XOR'd and subtracting does A XNOR B. I have no idea why this is…
0
votes
2 answers
Multiplier via Repeated Addition
I need to create a 4 bit multiplier as a part of a 4-bit ALU in VHDL code, however the requirement is that we have to use repeated addition, meaning if A is one of the four bit number and B is the other 4 bit number, we would have to add A + A +…

MikeWazowski
- 1
- 1
0
votes
1 answer
What is the need of a temporary register for Arithmetic operations in 8085 microprocessor?
I know the two inputs of ALU are accumulator and the temporary register.I was bit curious that why we store intermediate result in a temporary register and why not the data bus is directly connected to the ALU.What is the need of that temporary…

LocalHost
- 910
- 3
- 8
- 24
0
votes
1 answer
VHDL coding error “Else clause after check for clock not supported”
The function of the code is given an opcode, it will perform a task at the rising edge of the clock. I'm a second year undergrad student, so any help/input will be appreciated
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use…

Adrian Gomez
- 3
- 2
0
votes
1 answer
ALU, double and int
Sometimes, writing a code, situations such
(double)Number1/(int)Number2 //division of a double type varible by a int one.
appears to me (and I think, to all of you more or less often) and I never knows what really happens if I rewrite…

Daniel Bandeira
- 360
- 1
- 2
- 12
0
votes
0 answers
I'm trying to code a 16 bit ALU (with structural coding)
I'm trying to code a 16 bit ALU that has the components of an Arithmetic Unit, Logic Unit, Shifter Unit, a controller.
When I try and run simulation I get these errors.
Vivado Commandslaunch_simulation
[USF-XSim-62] 'elaborate' step failed with…

Jesus
- 1
0
votes
2 answers
Converting a decimal to a 16 bit binary using unsigned char and without string
My code works if I use operand 1 and operand 2 as integers. Using unsigned char operand 1 does not work. Can you help me?
int ALU(unsigned char operand1, unsigned char operand2)
{
printf("Enter Operand 1(in decimal):…

wait what
- 3
- 4
0
votes
2 answers
why is there no overflow flag set for binary subtraction?
I have basic binary math question. For example;
reg [31:0] a = 32'hFFFF_FFFF;
reg [31:0] b = 32'hFFFF_FFFF;
reg [31:0] c = 0;
I know c = a - b will result in zero and overflow flag will not be set.
My understanding is that ALU uses 2's…

frank_crane
- 177
- 2
- 9
0
votes
0 answers
How do I represent 2's Complement overflow with subtraction in Java?
I'm currently attempting to code a processor simulator in Java; including all of the different structures usually found in a CPU, including the ALU.
I'm having some difficulty working out how I would be able to represent 2's complement overflow in…
user9253096
0
votes
3 answers
Integer arithmetic errors in modern CPUs
Do I need to plan for possible miscalculations in modern CPUs, where for example an addition of two integers 1 and 1 results in 3 once?
(How often) Do such errors in the ALU occur?
Is there any built-in protection against this nowadays?
Is there a…

Ajai
- 9
- 1
0
votes
0 answers
IJVM MIC | returning integer result greater than 9
I have written a code in IJVM which performs multiplication, addition and subtraction on 1 digit numbers.
Basically it reads the input char, then checks the arithmetic symbol (+|-|*), reads the second char and performs the corresponding code (based…

SmOg3R
- 159
- 14
0
votes
1 answer
MIC IJVM simple sum of 2 digits
just a simple question regarding calculations in IJVM as I couldn't find the solution in their documentation.
Suppose we need to perform the following calculation:
BIPUSH 0x32 // PUSH 2
BIPUSH 0x33 // PUSH 3
IADD // PUSH sum(2,3)
OUT // output:…

SmOg3R
- 159
- 14
0
votes
1 answer
Why would an ALU's ouput change asynchronously in response to input changes?
Wikipedia states "An ALU is a combinational logic circuit, meaning that its outputs will change asynchronously in response to input changes."
But, the definition of a combinational logic circuit is: "combinational logic ... where the output is a…

Vol uptan
- 5
- 1
0
votes
0 answers
Integer Addition on current generation CPUs (2017)
First of, this is a genuine question and not poking fun at anyone. I am trying to learn C++ after many years of not touching it and I found a very old article (last updated July, 96) while trying to remember how implement BCD addition. Even though…
user480184