Processor Architecture Study Notes
Processor Architecture
Introduction to Processor Architecture
An overview of the processor architecture is presented, focusing on RISC V instruction set implementations. The discussion begins with the encoding of instructions, which are signals instructing the data path's operations. The importance of standard encoding and decoders is emphasized, as they adjust signal values for various data paths that can implement the same instruction set architecture.
Example Program: Integer Array Manipulation
Overview of the Example Program
The example program utilizes integer data, specifically manipulating an array by adding a value to its elements. The example features a loop iterating through an array, coded as follows:
Structure: A loop cycles through elements of an integer array.
Data Fetching: The program fetches the value at index
i, adds it toi, and stores the result back into the array.Arithmetic Operations: The example is designed to add (omitting multiplication due to the basic RISC V architecture constraints).
Encoding RISC V Instructions
The instructions are encoded with references to registers:
Registers:
- RISC V architecture includes 32 general-purpose registers (e.g.,x0tox31).
- Specific register names includeA5(referencingx10),A3(for loop iteration), and others.Memory Access: Data is loaded from registers, with the instructions clearly defining how to manipulate this data within the loops.
Register Operations
The program manipulates registers such as A5 for the loop index and A0 for the data pointer. Additional operations discussed include:
Incrementing Registers: For example,
A5is incremented by one per loop iteration.Pointer Arithmetic: The data pointer, held in
A0, is incremented appropriately based on the architecture's specifications (with a 32-bit integer being 4 bytes).Comparison Check: The program checks if the loop counter equals the array length to determine if it should continue looping.
Instruction Execution Overview
Fetching Instructions
Explains the instruction fetch process:
Instructions are stored in a separate instruction memory and data memory.
Instructions can be fetched sequentially based on memory addressing, with descriptions of a 1,024-word memory configuration leading to a total of 4 kilobytes.
Memory Addressing Strategies
An overview of memory addressing practices is discussed:
Addressing Modes:
- Possible options for memory addressing include byte or word addressing.
- The choice of addressing impacts the program counter's bit structure.
FPGA Implementation of Memory and DRAM
Distributed memory and DRAM types on FPGAs are explored:
Block RAM vs. Distributed Memory: Block RAM consists of large chunks of RAM, while distributed memory uses small lookup tables.
Register Outputs and Latency: Various latency issues and synchronous RAM functionalities are described, emphasizing consultations with clock edges.
Initialization Files for DRAM: FPGAs allow initialization files to preload memory at startup. The structure of these files (e.g., coefficient files in hexadecimal form) provides specific instructions that are loaded into memory upon initialization.
Instruction Decode Phase
Functionality
In this phase, the architecture decodes the instruction and proceeds to read from the register file:
Register File Design:
- Defined with 32 words of 32 bits each, requiring dual-port RAM usage.
- The architecture needs to decode instruction bits correctly to access the appropriate registers.Control Signals: Through multiplexing and control signals, the architecture dynamically adjusts paths dependent on the instruction classification (like branching).
Operations during Decode
The decode component facilitates multiple operational capabilities, ensuring that immediate values are properly sign-extended, and necessary signals for upcoming stages are prepared.
- Immediate handling varies based on opcode positions in the instruction set architecture.
Execution Stage Overview
ALU and Comparator Usage
Describes how the ALU processes arithmetic operations:
Input Selection for ALU Operations: Input selections are dynamically controlled based on prior fetched instructions.
Concurrent Processing: Use of the comparator in branch operations allows the determination of next program context during the same clock cycle.
Effective Memory Address Computation
ALU operations relate directly to data memory operations, with details on how effective addresses are calculated, leading to memory data reads.
Merged Memory Access and Write-Back Operations
To optimize the execution phases, the architecture merges memory read with the write-back stage:
DRAM Configuration: The memory access phase is tackled using correctly structured DRAM interfaces that provide expected outputs within clock cycles.
Latency Handling Techniques: Techniques are suggested to reduce potential delays while interacting with memory.
Control State Machine Functions
The control state machine tracks active phases and instructs which component operations should be enabled:
Its design ensures a seamless transition between fetching, decoding, executing, and writing.
Considerations for Output Registering
Additionally, the outputs often need registration to maintain state throughout the execution cycles, considering overall performance and latency requirements throughout instruction handling.
Conclusion
The architecture outlined in this elaboration draws upon a standard RISC V foundation, implementing efficient processing, instruction handling, data flow management, and fundamental arithmetic operations through a well-defined control structure.