Stack-Based ISA (No Explicit Register) : Structure Operation Example Instruction Sequence Result Storage
Stack-Based ISA (No Explicit Register) : Structure Operation Example Instruction Sequence Result Storage
Structure: Uses a stack to perform operations, with no explicit registers for general storage.
Operation: Operands are pushed onto the stack, and operations (like addition or multiplication) use the
top elements.
Example Instruction Sequence for Z = X * Y + W * U:
o PUSH X, PUSH Y, MULT, PUSH W, PUSH U, MULT, ADD, PUSH Z.
Result Storage: Results are implicitly stored at the top of the stack.
In a stack-based ISA, the stack acts as both the source of data (where values for operations come from) and the place
where results are stored by default. You don’t need to specify the location for storing the result because it
automatically goes back on top of the stack. This is what we mean by the stack being "implicit" — the processor knows
to use the stack without needing extra instructions for data placement.
2. Accumulator-based ISA
Structure: Uses a single accumulator (An accumulator register is a special register in a CPU that temporarily holds data for arithmetic and
logic operations, storing results for quick access.) register for all operations.
Operation: Instructions assume one operand is in the accumulator; the result is also stored in the accumulator.
Example:
o LOAD X (loads X into ACC),
o ADD Y (adds Y to ACC),
o STORE Z (stores ACC to Z).
Advantages: Simplifies instruction format but limits flexibility to a single register.
Structure: Utilizes multiple general-purpose registers in the CPU, where any register can hold operands
or store results.
Operation: Only LOAD and STORE instructions access memory; all other operations occur between
registers.
Restriction: Memory cannot be directly referenced; operands and result locations must be explicitly
defined in registers.
Example: LOAD R1, X; LOAD R2, Y; ADD R3, R1, R2; STORE Z, R3.
Advantage: Increases efficiency in data processing by minimizing memory access.
4. Register-Memory Architecture
Structure: Supports operations between a register and a memory location, allowing one operand to be
directly in memory.
Operation: Reduces the need for multiple LOAD instructions by accessing memory directly.
Compatibility: Can support Register-Register architecture, but the reverse is not possible.
Example: LOAD R2, X; ADD R2, Y; STORE Z, R2.
Advantage: Fewer instructions needed for accessing memory, though frequent memory access may
slow performance.
How a computer works in 8 specific steps, with a simple example to illustrate each step. Let’s assume the
example is to "Add two numbers stored in memory locations 200H and 201H and store the result in a register."
1. Load the Address of the First Instruction in the Program Counter (PC) (from a predefined
starting location in memory or sometimes from firmware instructions.)
The CPU starts by setting the Program Counter (PC) to the address of the first instruction in memory, so
it knows where to begin.
Example: The PC is set to the memory location holding the instruction to load the number at address
200H.
2. Load the Address from PC into the Memory Address Register (MAR)
The address in the PC is then copied to the Memory Address Register (MAR), which will hold the
memory address of the current instruction.
Example: The address for the "load number from 200H" instruction is moved to the MAR.
3. Place Address on the Address Bus and Select the Memory Location
The address in the MAR is placed onto the Address Bus (a pathway for sending addresses) and sent to
memory, selecting the memory location for the instruction.
Example: The MAR places the "load from 200H" instruction's address on the Address Bus, selecting the
location in memory.
In Summary
The computer goes through this cycle—fetching, decoding, and executing instructions—to process tasks
step-by-step. For our example, it completes loading numbers, adding them, and storing the result.