Skip to content

Latest commit

 

History

History

ISA_and_RTL

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

RTL Schematic Discussion

Register Transfer Level(RTL) Logic, is how you define a IC in its initial stage

  • In RTL you define registers, memories, signals and busses, etc of the IC
  • In RTL major functionality logic is provided for a IC
  • RTL is mostly written in Verilog or VHDL Language

Programming a ASIC/ Communication withh computers

Software to Hardware Interaction This section explains the interaction between software and hardware, detailing the flow from high-level application software down to the hardware level.

  1. Application Software Application software consists of programs that users interact with directly.

  2. System Software System software consists of the operating system (OS) and other utilities that manage the computer's hardware and resources. It handles key functions, including:

  • Managing I/O operations.
  • Allocating memory.
  • Running low-level system processes.

The system software converts high-level code written in programming languages like C, C++, Java, or Visual Basic into machine-executable instructions through two main steps:

  • Compilation: High-level code is compiled into machine-level instructions (e.g., Instr1, Instr2). Assembly: The machine instructions are converted into binary (e.g., 101000110101), which can be understood by the hardware.
  1. Hardware The hardware executes the binary code that comes from the system software. This step involves processing the instructions at the hardware level, controlling various outputs (like Dout1, Dout2, and Clk Out), and managing system components.
  • Each block interacts based on the instructions sent by the system software, processing them to handle operations in the physical system. Pc_communication

Instruction Set Architecture

Instruction Set Architecture, is a fundamental aspect of computing systems that defines how software communicates with the underlying hardware

  • Instruction formats: The structure and size of instructions.
  • Data types: Supported data formats, such as integers, floating points, or characters.
  • Registers: A set of small, fast storage locations within the processor.
  • Memory addressing modes: How the processor accesses data stored in memory.
  • Instruction types: Categories of operations, such as arithmetic, logic, control flow, and I/O operations.

Types of ISAs Different processors may use different ISAs, each suited for specific applications. Some examples include:

  • x86: Commonly used in desktop and server processors.
  • ARM: Widely used in mobile devices and embedded systems.
  • RISC-V: An open-source ISA gaining popularity for research and commercial use.

The ISA plays a critical role in processor design and influences the performance, power efficiency, and overall functionality of a system.

RIISC-V based Picorv32a_ankit RTL logic:-

pcorv32a.v is the verilog logic file used for buildinng this project.

The PicoRV32A is a compact, RISC-V-based, open-source processor core written in Verilog.

Let’s break down its structure into sections and explain each part in brief:

1. Module Declaration

This section defines the inputs, outputs, and basic configurations for the PicoRV32A core.

Example:

module picorv32a_ankit (
    input wire clk,   // Clock input
    input wire resetn, // Active-low reset
    output wire trap,  // Trap output for exception handling
    ...
);

Explanation: This section defines the module’s interface. The clock signal (clk) drives the timing of the circuit, while resetn resets the state of the processor. Signals like trap are used for exception or error reporting.

2. Parameters and Constants

Here, various parameterized values and constants are declared, which define configuration options or preset values like word size, register count, or memory size.

Example:

parameter integer ENABLE_MUL = 1;
localparam integer REG_BITS = 32;

Explanation: Parameters like ENABLE_MUL control optional features such as hardware multiplication. Constants like REG_BITS define architectural traits, such as the number of bits in the registers.

3.Register Declarations

Internal state elements like registers are declared here. These registers store values such as program counters, instruction fetches, and data values.

Example:

reg [31:0] pc;      // Program Counter
reg [31:0] regfile [31:0];  // Register File (32 registers)

Explanation: The Program Counter (pc) holds the address of the next instruction to be executed. The regfile is the core's register file, consisting of 32 registers, each 32-bits wide.

4. Combinational Logic

This section contains logic that computes outputs based on inputs and internal state, without relying on clocking. It is used to implement immediate operations, arithmetic operations, or simple control logic.

Example:

assign alu_result = (alu_op == ADD) ? reg_a + reg_b : reg_a - reg_b;

Explanation: This shows a simple arithmetic logic unit (ALU) operation. The result depends on the alu_op signal, which controls whether addition or subtraction is performed between register values reg_a and reg_b.

5. Sequential Logic (Always Blocks)

This section typically contains clocked logic, where internal registers and state machines update their values on each clock edge.

Example:

always @(posedge clk or negedge resetn) begin
    if (!resetn)
        pc <= 0;
    else
        pc <= pc + 4;  // Increment Program Counter
end

Explanation: This example illustrates sequential logic controlling the program counter (pc). On every clock cycle, the program counter is incremented by 4 (to fetch the next instruction). When resetn is low, the program counter is reset.

6. ALU (Arithmetic Logic Unit)

The ALU handles all arithmetic and logical operations (e.g., addition, subtraction, AND, OR). The ALU's outputs are determined by control signals generated elsewhere in the core.

Example:

always @(*) begin
    case (alu_op)
        ADD: alu_out = reg_a + reg_b;
        SUB: alu_out = reg_a - reg_b;
        AND: alu_out = reg_a & reg_b;
        ...
    endcase
end

Explanation: The ALU executes arithmetic and bitwise operations based on the control signal alu_op. It operates on the inputs reg_a and reg_b and stores the result in alu_out.

7. Control Unit

This section generates control signals that manage the flow of data through the processor. It controls instruction decoding, branching, memory accesses, and more.

Example:

always @(*) begin
    case (opcode)
        LUI: control_signals = LOAD_UPPER_IMM;
        JAL: control_signals = JUMP_AND_LINK;
        ...
    endcase
end

Explanation: Based on the current instruction's opcode, the control unit generates appropriate control signals to drive the rest of the processor (e.g., ALU operations, memory accesses).

8. Instruction Decoder

This section decodes the fetched instruction and identifies its type (R-type, I-type, etc.), opcode, operands, and immediate values.

Example:

assign opcode = instruction[6:0];
assign rs1 = instruction[19:15];
assign rs2 = instruction[24:20];
assign rd = instruction[11:7];

Explanation: The decoder extracts different fields of the instruction word, such as the opcode and the source (rs1, rs2) and destination (rd) registers. The extracted information is used to control various parts of the processor.

9. Memory Interface

This section manages memory accesses for both data and instructions. The core reads instructions from memory and writes results to memory as necessary.

Example:

always @(posedge clk) begin
    if (mem_write)
        mem[mem_addr] <= mem_data_in;  // Write to memory
    if (mem_read)
        mem_data_out <= mem[mem_addr];  // Read from memory
end

Explanation: Memory read and write operations are synchronized with the clock. If a mem_write signal is active, data is written to memory. If a mem_read signal is active, data is retrieved from memory.

10. Debug Interface (Optional)

Some designs include optional debugging features, such as an interface to trace program execution or detect exceptions.

Example:

assign trap = (current_state == EXCEPTION);

Explanation: This optional interface helps in debugging by indicating when the processor has encountered an exception or error. The trap signal can be used for external monitoring or debugging tools.

Next step is to carry out synthesis

yoou can find Synthesis discussion here