Professional Documents
Culture Documents
Architecture of Computers Lab1
Architecture of Computers Lab1
Vistula University
Lab 1
Data representation in computer systems
So now we have instruction memory, PC, and adder datapath elements. Now, we can
talk about the general steps taken to execute a program.
• Instruction fetching: use the address in the PC to fetch the current instruction from
instruction memory.
The data memory element implements the functionality for reading and
writing data to/from memory.
There are two inputs. One for the address of
the memory location to access, the other
for the data to be written to memory if
applicable.
The output is the data read from the
memory location accessed, if
applicable.
Reads and writes are signaled by MemRead
and MemWrite, respectively, which must be
asserted for the corresponding action to take
place.
Logic Gates - Building an ALU
Registers usage conventions in computer architecture, especially in RISC (Reduced Instruction Set
Computer) architectures like MIPS, are standardized guidelines for how registers should be used
in a program. These conventions ensure consistency and compatibility between different parts of
a program (e.g., functions or procedures) and between different software components (e.g.,
libraries or system calls). Common conventions for MIPS architecture include
Registers usage conventions
1. Registers are like Temporary Storage: Think of registers as small, fast, and temporary
storage spaces inside a computer's processor.
2. Naming Registers: Registers have names like $t0, $s0, etc. Each has a purpose:
3. Temporary Registers: Use $t0-$t9 for calculations inside a function. They can change freely,
but you should save their original values if needed.
4. Saved Registers: Use $s0-$s7 to hold important data that must be preserved across function
calls. Save and restore their values if you modify them in a function.
5. Argument Registers: $a0-$a3 are for passing arguments to functions. They can change
during a function call, so save them if necessary.
Registers usage conventions
• Result Registers: $v0-$v1 are used to return results from functions. Typically, use $v0 for
returning values.
• Stack Pointer: $sp points to a stack in memory, useful for managing function call information
and local variables.
• Frame Pointer: $fp helps access local variables and function parameters within a function's
stack frame.
• Simple Instruction Set: RISC processors have a small and straightforward set of instructions.
These instructions typically perform basic operations like load, store, arithmetic, and logic
operations. Complex operations are broken down into multiple simple instructions.
• Fixed-Length Instructions: Instructions in RISC architectures are typically of fixed length. This
simplifies the instruction fetch and decode stages of the pipeline, making them more predictable
and efficient.
• Load/Store Architecture: RISC architectures often follow a load/store model. This means that
data must be loaded from memory into registers before it can be operated on, and the results
must be stored back into memory if necessary. Only load and store instructions access memory
directly.
• Register-Centric: RISC architectures heavily rely on registers for data manipulation. They have a
large number of registers available (e.g., MIPS has 32 registers), and most operations involve
data transfers between these registers.
RISC architecture features
• Single-Cycle Execution: RISC instructions are typically designed to execute in a single clock cycle.
This makes the processor's behavior more predictable and simplifies pipeline design.
• Hardwired Control Unit: RISC processors often use a hardwired control unit, which means that
the control signals for executing instructions are directly generated by the processor's hardware
logic. This contributes to faster instruction execution.
• Pipelining: RISC architectures are well-suited for pipelining, a technique that divides the
instruction execution process into stages. Each stage can work on a different instruction at the
same time, increasing throughput.
• Reduced Addressing Modes: RISC architectures typically have a limited number of addressing
modes, simplifying instruction decoding and execution. Common addressing modes include
immediate (constants), register direct, and indexed addressing.
• Efficient Compiler Support: RISC architectures work well with optimizing compilers. The
simplicity and regularity of the instruction set make it easier for compilers to generate efficient
machine code.
RISC architecture features
• Favor Performance over Code Size: RISC architectures prioritize instruction execution speed
over the size of the code. This is based on the assumption that memory is becoming cheaper and
larger, making code size less critical.
• No Microcoding: RISC processors usually do not employ microcode, which is used in CISC
processors for complex instruction decoding. This simplifies the processor design but may
require more complex compiler support.
• Fewer Instruction Formats: RISC architectures often have a limited number of instruction
formats, which simplifies decoding and execution. MIPS, for example, has just three instruction
formats.
MIPS Assembler and Runtime Simulator
https://circuitverse.org/users/199531/projects/circuits-by-dr-tariq
End of Lecture