Questions tagged [alu]

ALU stands for Arithmetic Logic Unit, that performs arithmetic and logical operations for computer systems.

188 questions
1
vote
1 answer

Why is the ALU Opcode for lw and sw 00?

I'm trying to wrap my head around data paths and how it works in MIPS programming. A part of understating it, is understanding the ALU Opcodes that essentially tell the ALU which operations to carry out. For example, if we implement the basic AND,…
Ski Mask
  • 351
  • 1
  • 2
  • 14
1
vote
1 answer

Are bigger numbers harder to divide than smaller ones?

I for one, find it more difficult dividing bigger numbers than smaller ones. I was wondering if this would be the same for the CPU. Is there any hardware which allows smaller numbers to be divided faster than larger numbers. e.g 100 / (uint8_t)…
Some Dinosaur
  • 154
  • 1
  • 14
1
vote
0 answers

Assembly - Carry Flag when negative minus negative

If the CPU treats the subtraction as add like this question. Then (-1) - (-2) should be FF...FF + 00...02, and the CARRY FLAG should be set. I wrote c code to test (-1) - (-2) on linux, but found the CARRY FLAG was not set. How CPU deal with this…
mingw xu
  • 11
  • 2
1
vote
1 answer

The components of a 1-bit ALU diagram

I know that a component in VHDL is: A reusable VHDL module which can be declared with in another digital logic circuit using Component declaration of the VHDL Code. This helps to implement hierarchical design at ease. But can someone…
Anya Chan
  • 104
  • 1
  • 6
1
vote
1 answer

Does ALU know about postfix notation?

As we all know, the ALU perform Arithmetic operation, but does the computer understand post-fix notation or not?
Kashif Malik
  • 109
  • 10
1
vote
2 answers

When is Overflow flag set?

Can anybody explain why the overflow flag is set here? I learned that it is set if you add to positives and get a negative or subtract to negatives and get a positive! LDR r0,=0X80000000 LDR r1,=0X40000000 SUBS r7,r10,r0
mangokitty
  • 1,759
  • 3
  • 12
  • 17
1
vote
1 answer

Creating a 16-bit ALU from 16 1-bit ALUs (Structural code)

i have created the structural and the behavioral code for a 1-bit ALU,as well as a control circuit .The control circuit decides the operation that will be conducted between two variables : a,b . Here is my behavioral part of the code : library…
SteliosA
  • 23
  • 1
  • 6
1
vote
1 answer

ALU design error

I want to design an 8 bit alu in VHDL but I get this errors, I think it has something to do with the fact that my inputs are declared as bit_vectors. Is that true? ** Error: C:/Programs/Modeltech_pe_edu_10.4a/examples/alu.vhdl(19): No feasible…
blaa
  • 801
  • 3
  • 16
  • 32
1
vote
1 answer

Digital Comparator with Carry - How to fill the table correctly?

We got a comparator which compares 4 bit binary numbers (A_3, A_2, A_1, A_0 and B_3, B_2, B_1, B_0). The result is the output signal C_i which has the value 1 if A > B. The arithmetic-circuit is supposed to be made up by connecting 4 identical 1 bit…
rpbudd
  • 77
  • 9
1
vote
2 answers

Simple Verilog ALU implementation, No output

I am using Xilinx IDE. My ALU module is as follows: module ALU(in1,in2,operation,clk,out ); input [15:0] in1; input [15:0] in2; input [3:0] operation; input clk; output[15:0] out; reg [15:0] out; always@(posedge…
AAI
  • 290
  • 1
  • 3
  • 20
1
vote
3 answers

how to set auxiliary flag for 16bits binary addition

I know that when performing an 8-bit binary addition, the auxiliary flag is set to 1 if there is a carry from 3rd bit to 4th bit; but what about the addition of 2 16-bit numbers? i can't see any clear answer on the web. I'm studying intel 8086…
Xsmael
  • 3,624
  • 7
  • 44
  • 60
1
vote
1 answer

8 bit to 16 bit ALU conversion

I am currently studying an electrical engineering degree and have designed a 4 bit ALU as part of an assignment. I have been asked how I could easily convert it to an 8 bit ALU. My answer currently stands that I would alter all of the modules (add,…
B.Realey
  • 19
  • 2
1
vote
1 answer

Verilog 32-bit ALU with Overflow, Sign, and Zero Flags

I have an assignment asking for creation of a module as described in the title. I need to add, subtract, AND, and XOR two inputs and set the necessary flags. The assignment wasn't 100% clear, but I'm assuming that the overflow flag will render…
Anthony
  • 65
  • 1
  • 4
  • 11
1
vote
1 answer

Implementing one-bit flags in a 32Bit ALU using Verilog

I am working on an assignment and am a little lost and don't really know how to get started. I need to implement the following flags in a 32Bit ALU: • Z ("Zero"): Set to 1 ("True") if the result of the operation is zero • N ("Negative"): Set to 1…
1
vote
0 answers

What's cheaper in java: setting or comparing?

So many times I have come across the question of How do I implement this conditional setting?. I know this might sound really confusing, so let me explain what I mean using code. Essentially, I want to know which of the following would allow for the…
TheBrenny
  • 528
  • 3
  • 19