cse140l: components and design techniques for digital

30
1 CSE140L: Components and Design Techniques for Digital Systems Lab CPU design and PLDs Tajana Simunic Rosing Source: Vahid, Katz

Upload: others

Post on 21-Oct-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE140L: Components and Design Techniques for Digital

1

CSE140L: Components and Design Techniques for Digital Systems Lab

CPU design and PLDs

Tajana Simunic Rosing

Source: Vahid, Katz

Page 2: CSE140L: Components and Design Techniques for Digital

Updates & Outline• Lab #3 due• Lab #4 – CPU design• Today:

– CPU design - lab overview– PLDs

2

Page 3: CSE140L: Components and Design Techniques for Digital

3

CSE140L: Components and Design Techniques for Digital Systems Lab

Lab #4 – CPU design

Tajana Simunic Rosing

Source: Vahid, Katz

Page 4: CSE140L: Components and Design Techniques for Digital

Simple in-order processor

Objectives:

• Implementing a real processor on FPGA (challenging but fun!)

Challenges:• Design and implement the processor data path• Design and implement the processor control units• Make the whole thing work

Page 5: CSE140L: Components and Design Techniques for Digital

Processor overview

InstructionMemory

Control unit

RegisterFile

ALU

PC

Address

7-bit instruction

Page 6: CSE140L: Components and Design Techniques for Digital

Instruction format

3-bit OP code 4-bit data

• Each Instruction has a size of 7 bits

Instruction format

Determines the instruction (i.e 100 = add)

Page 7: CSE140L: Components and Design Techniques for Digital

Instruction set

R3 = R1 + R2

Page 8: CSE140L: Components and Design Techniques for Digital

Instruction memory• Holds the whole program instructions• Implemented as a ROM• Can hold up to 16 instructions

InstructionMemory

Address

7-bit instruction

module instruction_ROM(addr, inst);input [3:0] addr;output [6:0] inst;wire [6:0] memory [15:0];

assign memory[0] = 7'b0000000;assign memory[1] = 7'b0010001;assign memory[2] = 7'b0100010;assign memory[3] = 7'b1000000;assign memory[4] = 7'b0110000;assign memory[5] = 7'b0100100;assign memory[6] = 7'b1100000;assign memory[7] = 7'b1110011;assign memory[8] = 7'b0000000;assign memory[9] = 7'b0000000;assign memory[10] = 7'b0000000;assign memory[11] = 7'b0000000;assign memory[12] = 7'b0000000;assign memory[13] = 7'b0000000;assign memory[14] = 7'b0000000;assign memory[15] = 7'b0000000;assign inst = memory[addr];

endmodule

Page 9: CSE140L: Components and Design Techniques for Digital

Program counter

PC

Address to memory

clk resetenable load

Branch address

• Generate the next instruction address

• For non-control flow instructions• PC = PC + 1 (Enable signal = 1)

• For control flow instructions• PC = Branch address (load signal = 1)

• Think about how to implement this unit

Page 10: CSE140L: Components and Design Techniques for Digital

Instruction decoder

Control unit

Instruction 3bit OP

Data path control signals

• Decodes the instruction by reading the3-bit OP code bits from the memory

• Generate the control signals to the restof the processor (i.e. tells the ALU to

add when there is an ADD instruction)

• Think about how to implement this unit

Page 11: CSE140L: Components and Design Techniques for Digital

Register file

RegisterFile

Control signals

ALU

ALU output

Instruction (bit0-bit3)

• Contains THREE 4-bit registers and the Flag bit• Each register is made up of D-FF

• Challenge:• Determine the appropriate interfacing

with the rest of you processorCompareflag

Page 12: CSE140L: Components and Design Techniques for Digital

ALU

ALU

Control

ResultsInput operands

• Performs Addition, Multiplication and comparison• Two input 4-bit operands• Outputs: 4-bit results and 1-bit Compare

Interfacing• Implement it!

Page 13: CSE140L: Components and Design Techniques for Digital

Sample code

Page 14: CSE140L: Components and Design Techniques for Digital

Test your design

• Testing phase is essential to ensure that your design is a bug free

• Here are some tips• Generate test cases for all the instructions• Generate test cases with various input conditions• Generate test cases for some interesting combinations of

instructions (e.g. control flow with non-control flowinstructions)

Good luck and have FUN!

Page 15: CSE140L: Components and Design Techniques for Digital

15

CSE140L: Components and Design Techniques for Digital Systems Lab

PLDs (cont.)

Tajana Simunic Rosing

Source: Xilinx

Page 16: CSE140L: Components and Design Techniques for Digital

16

Programmable Logic Devices (PLD)• PLDs combine PLA/PAL with memory and other advanced

structures– Similar to PLA/PAL, hence Field-Programmable Gate Arrays

• Types:– Antifuse PLDs– EPLD & EEPLD– FPGAs with RAMs– FPGA with processing

• Digital Signal Processing• General purpose CPU

Page 17: CSE140L: Components and Design Techniques for Digital

Field-Programmable Gate Arrays

• Logic blocks– To implement combinational

and sequential logic• Interconnect

– Wires to connect inputs andoutputs to logic blocks

• I/O blocks– Special logic blocks at

periphery of device forexternal connections

• Key questions:– How to make logic blocks programmable?– How to connect the wires?– After the chip has been manufactured

Page 18: CSE140L: Components and Design Techniques for Digital

18

Antifuse PLDs• Actel’s Axcelerator Family

• Antifuse: – open when not programmed– Low resistance when programmed

Page 19: CSE140L: Components and Design Techniques for Digital

Actel’s Axcelerator C-Cell

• C-Cell– Basic multiplexer logic plus

more inputs and support for fast carry calculation

– Carry connections are “direct” and do not require propagation through the programmable interconnect

Page 20: CSE140L: Components and Design Techniques for Digital

Actel’s Accelerator R-Cell

• R-Cell– Core is D flip-flop– Muxes for altering the clock and

selecting an input– Feed back path for current value

of the flip-flop for simple hold– Direct connection from one C-cell

output of logic module to an R-cell input; Eliminates need to use the programmable interconnect

• Interconnection Fabric– Partitioned wires– Special long wires

Page 21: CSE140L: Components and Design Techniques for Digital

21

Altera’s EEPLD• Altera’s MAX 7k Block Diagram Global Routing:

ProgrammableInterconnectArray

LogicArrayBlocks

Page 22: CSE140L: Components and Design Techniques for Digital

22

EEPLD

• Altera’s MAX 7k Logic Block

Page 23: CSE140L: Components and Design Techniques for Digital

23

SRAM based PLD• Altera’s Flex 10k Block Diagram

Page 24: CSE140L: Components and Design Techniques for Digital

24

SRAM based PLD• Altera’s Flex 10k Logic Array Block (LAB)

Page 25: CSE140L: Components and Design Techniques for Digital

25

SRAM based PLD• Altera’s Flex 10k Logic Element (LE)

Page 26: CSE140L: Components and Design Techniques for Digital

CLB

CLB

CLB

CLB

SwitchMatrix

ProgrammableInterconnect I/O Blocks (IOBs)

ConfigurableLogic Blocks (CLBs)

D Q

SlewRate

Control

PassivePull-Up,

Pull-Down

Delay

Vcc

OutputBuffer

InputBuffer

Q D

Pad

D QSD

RDEC

S/RControl

D QSD

RDEC

S/RControl

1

1

F'G'

H'

DIN

F'G'

H'

DIN

F'

G'H'

H'

HFunc.Gen.

GFunc.Gen.

FFunc.Gen.

G4G3G2G1

F4F3F2F1

C4C1 C2 C3

K

Y

X

H1 DIN S/R EC

Page 27: CSE140L: Components and Design Techniques for Digital

28

FPGA with DSP• Altera’s Stratix II: Block Diagram

Page 28: CSE140L: Components and Design Techniques for Digital

29

FPGA with DSP

• Altera’s Stratix II: – DSP Detail

Page 29: CSE140L: Components and Design Techniques for Digital

30

FPGA with General Purpose CPU & Analog• Actel’s Fusion Family Diagram

– FPGA with ARM 7 CPU and Analog Components

Page 30: CSE140L: Components and Design Techniques for Digital

Programmable Logic Summary• Discrete Gates• Packaged Logic• PLAs• Ever more general architectures of programmable combinational +

sequential logic and interconnect– Altera– Actel– Xilinx