Questions tagged [alu]

ALU stands for Arithmetic logic unit (ALU) that performs arithmetic and logical operations for computer systems.

172 questions
20
votes
5 answers

How do I set output flags for ALU in "Nand to Tetris" course?

Although I tagged this homework, it is actually for a course which I am doing on my own for free. Anyway, the course is called "From Nand to Tetris" and I'm hoping someone here has seen or taken the course so I can get some help. I am at the stage…
MahlerFive
  • 4,689
  • 4
  • 28
  • 40
13
votes
1 answer

How are shifts implemented on the hardware level?

How are bit shifts implemented at the hardware level when the number to shift by is unknown? I can't imagine that there would be a separate circuit for each number you can shift by (that would 64 shift circuits on a 64-bit machine), nor can I…
Matt
  • 17,895
  • 16
  • 55
  • 102
8
votes
2 answers

How many ALUs are in a CPU?

I believe that there is "1" ALU per core in a CPU correct? I seem to be having a little bit of difficulty looking this up. Someone asked me in a discussion for school so I am quite curious as well.
Duffman
  • 115
  • 1
  • 2
  • 9
8
votes
1 answer

Memory Hierarchy - Why are registers expensive?

I understand that: Faster access time > More expensive Slower access time > Less expensive I also understand that registers are the top of the hierarchy, and have the fastest access time. What I am having a hard time researching is why it's so…
ajdbnabad13
  • 335
  • 3
  • 9
7
votes
5 answers

How does the CPU do subtraction?

I have some basic doubts, but every time I sit to try my hands at interview questions, these questions and my doubts pop up. Say A = 5, B = -2. Assuming that A and B are 4-bytes, how does the CPU do the A + B addition? I understand that A will have…
xyz
  • 7,885
  • 15
  • 61
  • 88
6
votes
1 answer

VPU vs FPU vs GPU vs ALU

I want to better understand the difference between Vector Processing Graphics (VPU), Floating Point Unit, Graphics Processing Unit and Arithmetic and Logic Unit. I understand that inside a CPU there's a FPU and a ALU, but is that also true for…
testin3r
  • 107
  • 1
  • 9
5
votes
2 answers

Why does AVX512-IFMA support only 52-bit ints?

From the value we can infer that it uses the same components as double-precision floating-point hardware. But double has 53 bits of significand, so why is AVX512-IFMA limited to 52 bits? Sure the mantissa has only 52 bits and one bit is hidden, but…
phuclv
  • 27,258
  • 11
  • 104
  • 360
5
votes
0 answers

How does the arithmetic logic unit actually works?

In other words, how can energy combined with metal perform logic operations? In the research I've done i'ts always assumed how the 'magic' happens but usually there's a lack of explanation on how can a physical device can 'understand' and perform…
Mikael Blomkvist
  • 145
  • 2
  • 13
4
votes
2 answers

RISCV: how the branch intstructions are calculated?

I am trying to understand how modern CPU works. I am focused on RISC-V. there are few types of branches: BEQ BNE BLT BGE BLTU BGEU I use a venus simulator to test this and also i am trying to simulate it as well and so far so good it works, but i…
Kralik_011
  • 333
  • 2
  • 9
4
votes
3 answers

How modern X86 processors actually compute multiplications?

I was watching some lecture on algorithms, and the professor used multiplication as an example of how naive algorithms can be improved... It made me realize that multiplication is not that obvious, although when I am coding I just consider it a…
speeder
  • 5,981
  • 5
  • 31
  • 48
3
votes
3 answers

Binary addition carrying from left to right

How would you efficiently implement 64 bit binary addition carrying from left to right? Like flipping the bits then adding: 0101 + 1110 = BitReverse(1010 + 0111) = BitReverse(10001) = 10001 My current solution is to reverse…
me'
  • 414
  • 2
  • 9
3
votes
2 answers

ALU in Verilog: "Unable to bind wire/reg/memory"

I am trying to make a simple 32 bit ALU with an overflow flag, and then output the inputs and results of the ALU to the screen, but I encountered some problems with connecting the elements for the test bench. I got this error: test_32bALU.v:15:…
Tina
  • 179
  • 3
  • 12
3
votes
2 answers

getting error for VHDL shift_left operation

I have been searching this for a while and have not been able to replicate any posted solutions online so I was hoping some of you wonderful people could help me out. I am creating an ALU. i have a two 32 bit inputs and one 32 bit output along…
Zannith
  • 399
  • 2
  • 19
3
votes
2 answers

Continuous assignment verilog

-This code is written in verilog using Modelsim 10.2d.The errors below indicate there is some problem with {cout,l3} assignment. module alu(a,b,bin,cin,op,cout,res); input [31:0] a,b; input [1:0] op; input bin,cin; reg [31:0] l1,l2,l3; output…
user3409814
  • 235
  • 1
  • 4
  • 11
2
votes
1 answer

ALU hdl produces wrong values

(nand2tetris course) Expected result: | x | y |zx |nx |zy |ny | f |no | out | | 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | My HDL code's result: | x | …
Sebastian Nielsen
  • 2,268
  • 2
  • 13
  • 30
1
2 3
11 12