๐ Lecture 10 โ The FALCON-E and ISA Comparison
๐ Overview: This lecture introduces the FALCON-E processor, a simple yet instructive general-purpose register machine designed for learning computer organization. It then provides a comprehensive comparison of the instruction set architectures (ISAs) of the EAGLE, FALCON-A, FALCON-E, and SRC processors, examining key design parameters that affect performance and code density.
๐๏ธ Topics Covered
The lecture begins with the introduction of the FALCON-E processor, covering its programmerโs view (registers and memory), notation, features, instruction formats (types A, B, C, D), and the complete instruction set including data transfer and ALU instructions. The second half presents a detailed comparison of ISAs across the EAGLE, FALCON-A, FALCON-E, and SRC processors, analyzing instruction length, number of operands, register files, memory specifications, addressing modes, control flow instructions, and common/unique instructions, concluding with a code density problem.
๐ Lecture Summary
The FALCON-E
Introduction
FALCON stands for First Architecture for Learning Computer Organization and Networks. The FALCON-E is a General-Purpose Register machine characterized by eight 32-bit General Purpose Registers (GPRs: R0-R7), two special registers (BP and SP), the Program Counter (PC) and Instruction Register (IR). Memory is organized as 2ยณยฒ bytes of 1-byte cells, accessed in 32-bit words using little-endian byte storage.
๐ Definition โ Little Endian: The least significant byte is stored first (at the lowest memory address). ๐ Format: M[8]<31โฆ0> := M[11]ยฉM[10]ยฉM[9]ยฉM[8] โ The memory word at address 8 is formed by concatenating bytes at addresses 11, 10, 9, and 8. ๐ก Why this matters: Understanding endianness is critical for data interpretation across different systems.
FALCON-E Features: Fixed 32-bit instruction size (1 word), all ALU instructions have three operands, and memory access is only through load and store instructions with limited addressing modes.
FALCON-E Instruction Formats: Four formats are supported.
- Type A: 5-bit op-code, remaining bits unused or specify a displacement. Used for
nop,ret,iret,near jmp. - Type B: 5-bit op-code, a register operand (ra), and an immediate/displacement field. Used for
push,pop,ld,st. - Type C: 5-bit op-code, two 3-bit operand registers (rb=source, ra=destination), a 17-bit immediate/displacement, and a 3-bit function field. Used for
lds,sts,in,out,addi,andi,ori. - Type D: 5-bit op-code, three 3-bit operand registers (ra, rb, rc), 14 unused bits, and a 3-bit function field. Used for
add,sub,and,or.
Encoding for GPRs: Each register field is 3 bits (2ยณ = 8 registers). R0=000, R1=001, R2=010, R3=011, R4=100, R5=101, R6=110, R7=111. SP and BP are encoded separately for use in load/store instructions (SP=010, BP=011).
Instructions, Instruction Formats: Detailed review of instructions by format.
- Type A Instructions:
nop(op-code 0, do nothing),ret(op-code 15, return from procedure/interrupt),iret(op-code 17, return to specified address),near jmp(op-code 18, PC-relative jump). - Type B Instructions:
push(op-code 8, push register onto stack),pop(op-code 9, pop stack into register),ld(op-code 10, load from immediate address),st(op-code 12, store to immediate address). - Type C Instructions: Data transfer:
lds(op-code 4, load with displacement),sts(op-code 5, store with displacement),in(op-code 6, load from I/O device with displacement),out(op-code 7, store to I/O device with displacement). ALU:addi(op-code 2, add immediate),andi(op-code 2, AND immediate),ori(op-code 2, OR immediate).
๐ Example (lds):lds R3, R4(56)โR[3] โ M[R[4] + 56]
๐ Example (addi):addi R3, R4, 56โR[3] โ R[4] + 56 - Type D Instructions:
add(op-code 1, add registers),sub(op-code 1, subtract registers),and(op-code 1, AND registers),or(op-code 1, OR registers).
๐ Example (add):add R3, R5, R6โR[3] โ R[5] + R[6]
Falcon-E Instruction Summary: Tables group instructions by functionality (e.g., data transfer, ALU, control). These tables are provided in the lecture text.
Instruction Set Architecture Comparison
Classifying Instruction Set Architectures: Design choices for ISA critically affect code density (instructions to complete a task), cycles per instruction (CPI), and cycle time. Classification is based on instruction length, number/types of operands, register file, memory specs, data transfer instructions, control flow, and addressing modes.
Instruction Length: Fixed vs. variable. Fixed lengths (used by all RISC machines) simplify design but can waste space. Required length depends on instruction count, register file size, operand count, immediate field size, and desired code density.
- EAGLE: 2 bytes
- FALCON-A: 8 bytes
- FALCON-E: 4 bytes
- SRC: 4 bytes
Instruction types and sub-types: A table summarizes the number of instruction types and sub-types for each processor.
Number of operands in the instructions: Affects instruction length and code density. FALCON-A, FALCON-E, and SRC can have 3, 2, 1, or 0 operands. EAGLE has a maximum of 2 operands. Implicit operands (like an accumulator) reduce instruction size.
Number and Size of General Purpose Registers: More registers decrease memory traffic (accessing memory is slower). However, a very large register file requires more bits for encoding. Tables provide the number and size of registers for each processor.
Memory specifications: Includes memory space, organization, word size, and storage format. A table lists these specifications for the processors compared.
Data transfer instructions: Instructions for moving data between registers and memory.
- Register to register: EAGLE has limited transfers (accumulator only). FALCON-A has
mov. FALCON-E hasldsandsts. SRC has no direct instruction; can useaddiwith zero or store/load via memory. - Register to memory: EAGLE supports load/store to accumulator only. FALCON-A, FALCON-E, and SRC support general load/store.
- Memory to memory: Not supported in any of the discussed processors.
Control Flow Instructions: Include branches (conditional), jumps (unconditional), calls, and returns.
- Conditional Branches: Conditions can be specified via condition codes (flags in ALU, used by EAGLE), a condition register, or compare and branch (used by all processors discussed). Compare and branch makes comparison part of the instruction.
- Size of jumps: All processors except SRC support PC-relative jumps. The displacement size (in bits) determines jump magnitude. A table specifies displacement sizes (e.g., EAGLE: 8 bits, FALCON-A: 26 bits).
Addressing Modes: Methods to specify operand addresses. Common modes: Immediate (constant in instruction), Register (value in register), Direct (constant is memory address), Register Indirect (register holds memory address), Displacement (register + constant), Relative (PC + constant), Indexed/Scaled (register + register, possibly with scaling), Auto increment/decrement (register value used then incremented/decremented). Complex modes reduce instruction count but increase implementation complexity. A table lists supported modes for each processor.
Displacement addressing mode: The most common mode. Displacement size affects efficient address calculation. A table specifies displacement field sizes (e.g., EAGLE: 8 bits, FALCON-E: 17 bits).
Instructions common to all Instruction Set Architectures: Arithmetic (add, addi, sub), Logical (and, andi, or, ori, not), Shift (right, left, arithmetic right), Data Movement (load, store), Control (conditional/unconditional branches, nop, reset). Assembly codes are listed in tables.
Instructions unique to each processor:
- EAGLE:
movia(move immediate to accumulator),a2r(accumulator to register),r2a(register to accumulator),cla(clear accumulator). - FALCON-A:
ret(return from procedure, restoring PC from register ra:PC โ R[ra]). - FALCON-E:
push,pop,ldr(load with displacement),str(store with displacement),bl(branch if less),bg(branch if greater),muli,divi,xor,xori,ror,rori. - SRC:
ldr(load with PC-relative),lar(load with relative address),str(store with relative address),brlnv(never branch, save PC to register),brlpl(branch if positive, save return address),brlmi(branch if negative),brlzr(branch if zero),brlnz(branch if not zero).
Problem Comparison: Implements a = (b - 2) + 4c in all processors. EAGLE requires the most instructions (due to simpler ISA) while other processors achieve higher code density with fewer instructions.
โญ Key Takeaways
You must understand that FALCON-E is a simple, RISC-like processor with a fixed 32-bit instruction size, 8 general-purpose registers, and a load-store architecture where memory is accessed only through explicit load and store instructions. The four instruction formats (A, B, C, D) differ in the number of operands and the presence of a function field, and you must be able to decode RTL for instructions like addi, lds, and add. For ISA comparison, you should know that instruction length, number of operands, register file size, and addressing modes all trade off between code density, design simplicity, and performance. Finally, be prepared to compare ISAs across the four processors, identifying unique instructions and how a common operation might be implemented differently, as demonstrated in the problem comparison.
๐ง Quick Revision Questions
- What is the difference between Type A and Type D instructions in the FALCON-E?
- How is the effective address calculated for a
lds R3, R4(56)instruction? Write its RTL. - Which processors among EAGLE, FALCON-A, FALCON-E, and SRC use a fixed instruction length? What are their respective instruction sizes?
- Explain the difference between condition code-based branching and compare-and-branch addressing modes. Which processors use which?
- How can you perform a register-to-register copy in the SRC processor without a dedicated move instruction? Provide an example.
๐ Lecture 11 โ CISC and RISC
๐ Overview: This lecture explores two fundamental microprocessor architectures: CISC (Complex Instruction Set Computer) and RISC (Reduced Instruction Set Computer). It examines a key CISC exampleโthe Motorola MC68000โand a key RISC exampleโthe SPARC architectureโto highlight their design philosophies, trade-offs, and impact on performance and programming.
๐๏ธ Topics Covered
The lecture begins with an examination of the Motorola MC68000, a classic CISC microprocessor with a complex instruction set, variable instruction lengths, and multiple addressing modes. It then introduces the SPARC architecture, a canonical RISC design emphasizing simple, fixed-length instructions, register windows, and a load/store model. The comparison illustrates the historical and technical motivations behind each approach, including considerations of code density, compiler complexity, and execution speed.
๐ Lecture Summary
A CISC microprocessor: The Motorola MC68000
This section details the Motorola MC68000, a CISC (Complex Instruction Set Computer) microprocessor. The MC68000 has a rich instruction set with many specialized instructions, variable-length instructions (from 2 to 10 bytes), and multiple addressing modes. It features 16 general-purpose data registers (D0โD7) and 8 address registers (A0โA7). The architecture supports powerful operations like memory-to-memory moves and complex instructions that perform multiple operations (e.g., a single instruction can fetch, operate on, and store data). The design prioritizes code densityโusing fewer instructions per taskโat the cost of hardware complexity and variable execution times.
๐ Definition โ CISC: A computer architecture where individual instructions can execute multiple low-level operations (like memory access and arithmetic) in one line of code, often using variable instruction lengths and many addressing modes.
๐ Formula: Instruction length = from 2 to 10 bytes (variable) โ meant complex decoding but compact code.
๐ Example: The MC68000 instruction MOVE.L (A0)+, D0 moves a 32-bit value from the memory address pointed to by address register A0 (post-incrementing A0) into data register D0. This single instruction accomplishes memory read, register increment, and data transferโthree operationsโin one step, showing CISCโs power at the cost of execution complexity.
A RISC Architecture: The SPARC
This section introduces the SPARC (Scalable Processor Architecture), a classic RISC (Reduced Instruction Set Computer) design. RISC architectures emphasize a small, highly optimized set of instructions, each typically one word in size (32 bits fixed length). The SPARC uses a load/store architecture: only load and store instructions access memory; all other operations work on registers. A key feature is register windows, which provide a large number of overlapping register sets (usually 32 registers visible at a time out of a larger pool) to reduce memory traffic during function calls. Instructions are executed in a single cycle, simplifying the control logic and enabling pipelining. RISC designs prioritize simplicity and speed over code density.
๐ Definition โ RISC: A computer architecture where each instruction performs only one operation (e.g., add, load, store), using fixed-length instructions, a load/store model, and many registers to simplify hardware and enhance pipelining.
๐ Formula: Instruction length = 32 bits (fixed) โ enables fast decoding and pipelining.
๐ Example: In SPARC, adding two numbers requires two separate instructions: LD [addr], %r1 (load data from memory address into register 1) and ADD %r1, %r2, %r3 (add register 1 and register 2, store result in register 3). This contrasts with CISC, where a single instruction might do all of this, showing RISCโs trade-off of more instructions per task for simpler, faster execution.
๐ก Why this matters: Understanding CISC vs. RISC helps explain design choices in modern processors (like Intelโs x86 being CISC inside but often translating to RISC-like micro-ops) and performance optimization.
โญ Key Takeaways
For the exam, remember that CISC (exemplified by MC68000) uses variable-length instructions, many addressing modes, and powerful single instructions that can perform multiple operations (e.g., memory fetch, add, store) to achieve high code density but with complex hardware and variable cycles per instruction. In contrast, RISC (exemplified by SPARC) uses fixed-length instructions, a load/store model where only load and store access memory, and a large register set often organized into register windows to reduce memory access; this enables simple hardware, single-cycle execution, and effective pipelining. The fundamental trade-off is between code density (CISC) and execution speed/simplicity (RISC). The MC68000 has separate data and address registers, while SPARC uses register windows to manage function calls efficiently.
๐ง Quick Revision Questions
- What are the key differences in instruction length between the MC68000 (CISC) and SPARC (RISC)?
- Explain the load/store architecture used in RISC, and give one reason why it benefits pipeline performance.
- What is the purpose of register windows in the SPARC architecture?
- In the MC68000, what does the instruction
MOVE.L (A0)+, D0do, and how does it illustrate CISC philosophy? - Why might a RISC program require more instructions than a CISC program to perform the same task, and yet still be faster overall?
๐ Lecture 12 โ CPU Design
๐ Overview: This lecture explores the central processing unit design from the logic designerโs perspective, focusing on converting behavioral RTL into concrete structural RTL. It examines the uni-bus implementation of the SRC processor, detailing data path design, control unit design, and structural RTL descriptions for various instruction types, providing a foundation for understanding processor architecture implementation.
๐๏ธ Topics Covered
The lecture covers the complete processor design process, beginning with ISA design through behavioral and structural RTL descriptions. It examines the uni-bus data path implementation for the SRC processor, including all major components like the register file, MAR, MBR, PC, IR, registers A and C, and the ALSU. Detailed structural RTL descriptions are provided for instruction fetch, arithmetic/logic instructions (including register-to-register sub, add, not, and immediate operations), as well as load and store instructions, with timing step requirements for each.
๐ Lecture Summary
The design process
The processor design process begins with the specification of behavioral RTL for its instruction set. This abstract description is then converted into structural RTL which shows actual implementation details. Since the processor divides into two main sub-systemsโthe data path and the control unitโthe design procedure splits into two phases: data path design and control unit design.
๐ก Why this matters: The design activity must consider pros and cons of different approaches, as execution time depends on three factors: ET = IC ร CPI ร T (Execution Time = Instruction Count ร Cycles Per Instruction ร Clock cycle Time). Implementation details affect CPI and clock cycle time, so designers must consider effect on overall performance, amount of control hardware, and development time.
๐ Definition โ Behavioral RTL: A register transfer language description of processor behavior in response to specific instructions, not bound to any specific implementation, presenting only static (registers) and dynamic aspects (operations) necessary to understand functionality.
๐ Definition โ Structural RTL: A register transfer language description formed according to the proposed micro-architecture, showing actual implementation steps including hidden temporary registers necessary for instruction execution, satisfying time and space requirements specified by clocking interval and number of registers and buses.
Processor Design
The processor design procedure involves five steps:
1. ISA Design: Specification of the instruction set including decisions about number and size of instructions, formats, addressing modes, memory organization, and programmerโs view of CPU (number and size of general and special purpose registers).
2. Behavioral RTL Description: Describes processor behavior in register transfer language, where the unit of activity is instruction execution (unlike clock cycle in actual case).
3. Implementation of the Data Path: Involves decisions about placement and interconnection of registers, type of flip-flops, number and kind of interconnection buses. All decisions affect number and speed of register transfers during operations. The structure of ALU and memory-to-CPU interface are also decided here.
4. Structural RTL Description: In accordance with chosen data path implementation, structural RTL for every instruction is described, satisfying time and space requirements.
5. Control Unit Design: Involves timing and synchronization issues plus combinational logic. Approaches include hard-wired or micro-programmed control. Steps include: a) Analyze structural RTL and prepare list of control signals; b) Develop logic circuits for control signals; c) Tie everything together.
A Uni-bus Data Path Implementation for the SRC
The Data Path: The data path is the arithmetic portion of the Von Neumann architecture, consisting of registers, internal buses, arithmetic units, and shifters. The 1-Bus SRC data path employs a single bus for data flow.
The following units are present in the SRC data path:
-
The Register File: The general-purpose register file includes 32 registers R0 to R31, each 32-bit wide. These registers communicate with other components via the internal processor bus.
-
MAR: The Memory Address Register takes input from the ALSU as the address of the memory location to be accessed and transfers memory contents onto the memory sub-system.
-
MBR: The Memory Buffer Register has a bi-directional connection with both the memory sub-system and the registers and ALSU. It holds data during transmission to and from memory.
-
PC: The Program Counter holds the address of the next instruction to be executed. Its value is incremented after loading each instruction and can be changed based on branch decisions in ALSU. It has a bi-directional connection with the internal processor bus.
-
IR: The Instruction Register holds the instruction being executed. Instruction fields are extracted from IR and transferred to appropriate registers according to external circuitry.
-
Registers A and C: Required to hold an operand or result value while the bus is busy transmitting some other value. Both registers are programmer invisible.
-
ALSU: A 32-bit Arithmetic Logic Shift Unit that takes input from memory or registers via the bus, computes results according to control signals, and places result in register C for final transfer to destination.
Timing Step Generator: A timing device that provides mutually exclusive and sequential timing intervals (analogous to clock cycles in actual processor). Each mutually exclusive step is carried out in one timing interval, named T0, T1...T7.
Structural RTL descriptions of selected SRC instructions
Structural RTL for Instruction Fetch: Takes three time steps:
- T0: Address of instruction is moved to MAR and PC value is incremented
- T1: Instruction is brought from memory into MBR, and incremented PC is updated
- T2: Instruction from MBR is written into IR for execution
What follows is the instruction execution phase. The number of timing steps depends on instruction type and complexity.
Structural RTL for Arithmetic/Logic Instructions: Come in two formatsโimmediate operand and register operand.
Register-to-Register sub: sub ra, rb, rc takes three timing steps:
- T3: Register A receives contents of register rb
- T4: Value of register rc is subtracted (since op-code is sub) from A
- T5: Result is transferred into destination register ra
๐ก Why this matters: Control signals must be applied to the ALSU based on decoding the op-code field of an instruction. ALSU functions use uppercase names (e.g., SUB, ADD) to differentiate from actual operation-code mnemonics. Functions SHL, SHR, SHC, and SHRA assume a barrel shifter is available.
Structural RTL for Register-to-Register add: add ra, rb, rc:
- T0-T2: Instruction fetch (common to all instructions)
- T3: First operand moved to register A
- T4: Computation of sum
- T5: Result transferred to destination
Complete execution takes 6 time steps. Other arithmetic/logic instructions like sub, and, and or have similar structural RTL, differing only in T4 step where sign changes to (-), (^), or (~) according to opcode.
Structural RTL for the not instruction: not ra, rb:
- T0-T2: Instruction fetch
- T3: Operand value brought into ALSU, which uses control function NOT, negates (inverts) the value, result moves to register C
- T4: Result assigned to destination register through internal bus
Control signals needed: signal to allow reading of instruction-specified source register in T3, signal for ALSU function selection, and signal to allow only instruction-specified destination register to read result from data bus.
Structural RTL for the addi instruction:
- T0-T2: Instruction fetch
- T3: First operand brought into ALSU through register A
- T4: Second operand c2 extracted from IR register, sign extended to 32 bits, added to first operand, written into result register C
- T5: Result written into destination register
Sign extension is assumed to be carried out in the ALSU. Sign extension for 17-bit c2: (15ฮฑIR<16> ยฉIR<16..0>). Sign extension for 22-bit c1: (10ฮฑIR<21> ยฉIR<21..0>). Other instructions with same structural RTL: subi, andi, and ori.
RTL for the load (ld) and store (st) instructions:
Syntax for load: ld ra, c2(rb). Syntax for store: st ra, c2(rb).
First 6 time steps (T0 to T5) are the same for both:
- T0-T2: Instruction fetch
- T3: Register A gets value of register rb (if not zero)
- T4: Constant is sign-extended and added to register A value using ALSU, result assigned to register C
- T5: Value in C transferred to MAR (completes effective address calculation)
For load instruction:
- T6: Corresponding memory location accessed, result stored in MBR
- T7: Result transferred to destination register ra using data bus
For store instruction:
- T6: Value of register stored to MBR
- T7: Value in MBR stored in memory location indexed by MAR
If more time steps are required, a counter with more bits and larger decoder can be used (e.g., 4-bit counter with 4-to-16 decoder can produce up to 16 time steps).
โญ Key Takeaways
The processor design process follows a sequential flow from ISA specification through behavioral RTL to structural RTL, then data path implementation and control unit design. The uni-bus SRC implementation uses a single bus connecting all major components (register file, MAR, MBR, PC, IR, registers A and C, ALSU) with a timing step generator providing mutually exclusive timing intervals. Instruction fetch always requires three timing steps (T0-T2), while execution timing varies by instruction complexityโarithmetic/logic instructions typically take three execution steps, while load/store instructions require more (up to T7). The key difference between load and store instructions occurs after effective address calculation: load reads memory into MBR then transfers to destination register, while store moves register value to MBR then writes to memory. Control signals must be carefully designed based on op-code decoding to coordinate all data path operations across the appropriate timing steps.
๐ง Quick Revision Questions
-
What are the five steps in the processor design procedure, and what is the main output of each step?
-
In the uni-bus SRC data path, which registers are programmer visible and which are programmer invisible?
-
How many timing steps does the instruction fetch phase require, and what happens in each step?
-
What is the difference in structural RTL between a load instruction (ld) and a store instruction (st) during steps T6 and T7?
-
How does sign extension work for the 17-bit c2 and 22-bit c1 fields in immediate instructions, and where is this operation performed?
๐ Lecture 13 โ Structural RTL Description of the FALCON-A
๐ Overview: This lecture continues the structural RTL description of the SRC processor and introduces the structural RTL for the FALCON-A processor. It covers branch, shift, arithmetic, logical, and memory instructions in detail, highlighting the differences in data path width, register size, and number compared to SRC. Understanding these RTL descriptions is crucial for processor design and implementation.
๐๏ธ Topics Covered
The lecture covers Structural RTL for branch instructions (brzr, brlzr), Structural RTL for shift instructions, Structural RTL Description of FALCON-A Instructions including uni-bus data path implementation, ALSU functions needed, and structural RTL for subtract, addition, multiplication, division, not, add immediate, load/store, and conditional jump instructions. It also explains sign extension for immediate constants and the need for additional registers (AH, CH) for multiplication and division operations.
๐ Lecture Summary
Structural RTL for branch instructions
The lecture examines the structural RTL for branch instructions, including unconditional and conditional branches. The branch if zero (brzr) instruction brzr rb, rc instructs the processor to branch to the instruction at the address held in register rb if the value stored in register rc is zero. The first three steps are for instruction fetch, then the value of register rc is checked and the condition flag CON is set. In time step T4, the program counter is set to the register rb value depending on the CON bit.
๐ Definition โ brzr (branch if zero): A conditional branch instruction that branches to the address in register rb if register rc contains zero.
The branch and link if zero (brlzr) instruction brlzr ra, rb, rc is the same as brzr but additionally saves the return address. The steps are the same as brzr with an additional step after the condition bit is set: the current value of the program counter is saved to register ra, implementing the linking procedure.
๐ Definition โ brlzr (branch and link if zero): A conditional branch instruction that branches to the address in register rb if register rc contains zero, and saves the return address in register ra.
Structural RTL for shift instructions
Shift instructions are complicated because they require extra hardware to hold and decrement the count. For an ALSU that can perform only single bit shifts, data must be repeatedly cycled through the ALSU and the count decremented until it reaches zero, creating timing problems. These problems can be overcome by employing multiple-bit shifts using a barrel shifter. The structural RTL for shr ra, rb, rc or shr ra, rb, c3 uses n representing a 5-bit register where IR bits 0 to 4 are copied into it. N is the decimal value of the number in this register. The actual shifting occurs in step T5. Other instructions with similar tables are: shl, shc, shra โ for example, for shra, T5 will have Cโ (NฮฑR [rb] <31>) ยฉ R[rb] <31...N>.
๐ Definition โ Barrel shifter: A hardware component that can perform multiple-bit shifts in a single clock cycle, overcoming timing problems associated with single-bit shift operations.
Structural RTL Description of FALCON-A Instructions
Uni-bus data path implementation
Comparing the uni-bus implementation of FALCON-A with that of SRC results in several differences:
- FALCON-A processor bus has 16 lines (16-bits wide) while SRC is 32-bits wide
- All registers of FALCON-A are 16-bits while SRC registers are 32-bits
- Number of registers in FALCON-A is 8 while SRC has 32 registers
- Special registers (PC and IR) are 16-bit registers in FALCON-A (32-bit in SRC)
- MAR (Memory Address Register) and MBR (Memory Buffer Register) are 16-bits in FALCON-A (32-bit in SRC)
- MAR and MBR are dual port registers โ connected to internal bus on one side and external memory on the other side, to point to a particular address for reading or writing data from or to memory
๐ก Why this matters: The reduced bus width and register size in FALCON-A make it a simpler, smaller processor compared to SRC, suitable for embedded or cost-sensitive applications.
ALSU functions needed
The ALSU of FALCON-A has slightly different functions. Two significant instructions are mul and div. When one of these instructions is activated, the ALSU unit takes the operand from its input and provides the output immediately (neglecting propagation delays). FALCON-A has two registers A and AH, each of 16-bits. AH contains the higher 16-bits (most significant) of a 32-bit operand, providing the facility of using 32-bit operands in certain instructions. At the output of ALSU, a 32-bit result needs to be saved in two registers: C and CH where CH stores the most significant 16-bits of the result.
๐ Definition โ AH (Accumulator High): A 16-bit register in FALCON-A that contains the most significant 16-bits of a 32-bit operand. ๐ Definition โ CH (C High): A 16-bit register in FALCON-A that stores the most significant 16-bits of a 32-bit ALSU result.
Why do we need to add AH and CH?
These registers are needed because FALCON-A has mul and div instructions. For div instruction, at the input, one operand (the dividend) would be 32-bits. For mul instruction, the output (result of multiplying two 16-bit numbers) would be 32-bit, placed in C and CH. Data in these two registers will be concatenated, and the input operand is in two registers AH and A. Conceptually, A and AH together represent a 32-bit operand.
Structural RTL for subtract instruction
The sub ra, rb, rc instruction involves three registers. The first three steps fetch the instruction, and in T3, T4, T5 the execution steps are performed.
Structural RTL for addition instruction
The add ra, rb, rc instruction table is almost the same as sub instruction except in timing step T4 we have + sign for addition instead of - sign. Other instructions that belong to the same group are and, or, and sub.
Structural RTL for multiplication instruction
The mul ra, rb, rc instruction is only present in FALCON-A, not in SRC. The first three steps fetch the instruction. In step T3, contents of register R[rb] are brought into buffer register A at the input of ALSU. In step T4, multiplication of A with contents of R[rc] is performed and the result is placed at the output in two registers C and CH โ CH contains the higher 16-bits, C contains the lower 16-bits. These two registers cannot transfer data in one bus cycle (width is 16-bits), so two timing steps are needed: in T5 the higher byte is transferred to register R[0], and in T6 the lower 16-bits are transferred to the placeholder R[a]. The multiplication instruction requires 3 timing steps for Instruction Fetch and 4 timing steps for Instruction Execution, totaling 7 steps.
Structural RTL for division instruction
The div ra, rb, rc instruction has the first three steps the same. In step T3, contents of register rb are placed in buffer register A. In step T4, contents of register R[0] are taken into register AH (assuming higher 16-bits of dividend are placed in R[0] before using the divide instruction). In T5, actual division takes place in two concurrent operations. The dividend at the input of ALSU is represented by concatenation of AH and A. The first operation takes the remainder (AH concatenated with A divided by contents of register rc), placed in register CH. The quotient is placed in C. In T6, C is taken to register R[ra]. In T7, the remainder in CH is taken to default register R[0] through the bus. The divide instruction requires 5 timing steps to execute and 3 to fetch.
๐ Note: For mul and div instructions, register R[0] must be properly loaded prior to use. For example, in the divide instruction, if appropriate data is not available in R[0], the result would be wrong.
Structural RTL for not instruction
The not ra, rb instruction has the first three steps fetching the instruction. In T3, the not operation (one's complement: changing 0's to 1's and 1's to 0's) is performed on contents of R[rb] and transferred into buffer register C. In timing step T4, contents of register C are transferred to register R[ra] through the bus.
Structural RTL for add immediate instruction addi ra, rb, c1
In this instruction, c1 is a constant part of the instruction. First three steps are for Instruction Fetch. In T3, contents of register R[rb] are taken into buffer register A. In T4, contents of A are added with constant c1 after sign extension and brought to C.
Sign extension of 5-bit c1 and 8-bit constant c2
Sign extension for 5-bit c1 is: (11ฮฑIR<4> ยฉIR<4.. 0>) โ the immediate constant c1 is in the lower 5-bits, bit number 4 indicates the sign bit, which is copied to the leftmost 11 positions to make a 16-bit number.
Sign extension for 8-bit c2 is: (8ฮฑIR<7> ยฉIR<7.. 0>) โ the sign bit is placed to the leftmost 8 positions to make a 16-bit number.
๐ Formula โ Sign extension for 5-bit constant: (11ฮฑIR<4> ยฉIR<4.. 0>) โ copies bit 4 (sign bit) to the 11 leftmost positions to create a 16-bit number. ๐ Formula โ Sign extension for 8-bit constant: (8ฮฑIR<7> ยฉIR<7.. 0>) โ copies bit 7 (sign bit) to the 8 leftmost positions to create a 16-bit number.
Structural RTL for the load and store instruction
Tables for load and store instructions are the same as SRC except a slight difference in notation. When square brackets [R[rb]+c1] appear, it corresponds to the base address in R[rb] and an offset taken from c1.
Structural RTL for conditional jump instructions
The jz ra, [c2] instruction (jump if zero) has the first three steps fetching the instruction. In T3, a 1-bit register CON is set to true if the condition is met. The condition is tested by the contents given by register ra. The condition is R[ra], meaning test the data in register ra. Data could be positive, negative, or zero. For this instruction, it tests if data is zero โ if zero, CON would be 1.
In T4, contents of the PC are taken into buffer register A. In T5, contents of A are added to constant c2 after sign extension, giving the effective address for the jump. In T6, this value is copied to the PC.
In FALCON-A, the number of conditional jumps is more than in SRC. Examples include:
- jz (op-code=19) jump if zero:
jz r3, [4](R[3]=0): PCโ PC+2 - jnz (op-code=18) jump if not zero:
jnz r4, [variable](R[4]โ 0): PCโ PC+variable - jpl (op-code=16) jump if positive:
jpl r3, [label](R[3]โฅ0): PC โ PC+(label-PC) - jmi (op-code=17) jump if negative:
jmi r7, [address](R[7]<0): PCโ PC+address
The unconditional jump instruction will be explained in the next lecture.
โญ Key Takeaways
The structural RTL for FALCON-A differs significantly from SRC in bus width (16-bit vs 32-bit), register count (8 vs 32), and register size (16-bit vs 32-bit). The multiplication and division instructions require additional registers AH and CH to handle 32-bit operands and results, along with extra timing steps for data transfer due to the narrower bus width. Sign extension of immediate constants (5-bit c1 and 8-bit c2) is critical for correct arithmetic operations with immediate values. Conditional jumps test a flag register CON based on the contents of a specified register, and jump instructions require multiple steps to compute the effective address and update the program counter. Register R[0] plays a special role in storing high-order bits for division and multiplication operations, and must be properly initialized before use.
๐ง Quick Revision Questions
- What are the key differences between FALCON-A and SRC processor implementations in terms of bus width, register count, and register size?
- Why are the additional registers AH and CH needed in FALCON-A, and how are they used in the mul and div instructions?
- Describe the timing steps for the branch and link if zero (brlzr) instruction, including how the return address is saved.
- What is the sign extension process for a 5-bit constant c1, and why is it necessary in the addi instruction?
- How does the conditional jump instruction jz work, including how the CON flag is set and how the effective address is computed?