75
F-CPU: Year 4 Bail Cedric Boulay Nicolas Yann Guidon F-CPU 19C3 presentation – p.1/64

F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU: Year 4Bail Cedric

Boulay Nicolas

Yann Guidon

F-CPU 19C3 presentation – p.1/64

Page 2: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Plan

F-CPU 4 dummies

A simple SIMD character comparison

Another example : arbitrary byte shuffling in one byte

The hardware design flow

TCPA

Design

Call convention

F-CPU 19C3 presentation – p.2/64

Page 3: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU 4 dummiesYann Guidon

F-CPU 19C3 presentation – p.3/64

Page 4: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Introduction

Goal : to design a microprocessor that can be used andmodified by anyone without industrial pressure

<RMS_beard=on> It’s all about freedom : This is‘Freedom CPU’, not ‘Free CPU’

‘Year 4’ means 4th presentation to CCC and 4th year ofexistence

F-CPU 19C3 presentation – p.4/64

Page 5: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Architecture

F-CPU is designed ‘from scratch’ and is not compatiblewith existing computers

The architecture is aimed at high efficiency forcomputation intensive software

RISC features and methodsFixed-size 32 bits instructions64 x 64 bits registersLoad-store architectureNo stackRegister #0 is hardwired to 0Conditional move and jump/call/return

F-CPU 19C3 presentation – p.5/64

Page 6: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Data types

Beware ! a register is not equivalent to a number !

Registers are ‘at least’ 64-bit wide

Registers can have more than 64 bits !

It is simpler and more efficient to enlarge the registersthan to decode more instructions per cycle (decodingand control logic would explode

Register sizes can be any power of 2 : 128, 256, 512,or even 32768 bits (in theory)

F-CPU 19C3 presentation – p.6/64

Page 7: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Data types (2)

scalar data : aligned to the LSB, all MSB are cleared8, 16, 32 and 64 bit integers are supported

pointers : like scalar data but the number of valid LSB isnot known (depends on the implementation, could be30 or 50)

SIMD data : 2**N scalar data8x8, 4x16 and 2x32 bit integers are supported for 64bit implementations

F-CPU 19C3 presentation – p.7/64

Page 8: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Instruction Format

F-CPU 19C3 presentation – p.8/64

Page 9: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

FC0

1st implementation: FC0Statically scheduled (scoreboard-based)Single-issue coreOut Of Order CompletionMany “Execution units” around a “Crossbar”“Carpaccio” pipeline stages for higher frequency

F-CPU 19C3 presentation – p.9/64

Page 10: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Ongoing work

(this is not complete or exhaustive)

VHDL model

C model

Manual

Boot monitor

Gcc port

Assembler

Linker

L4

Linux

F-CPU 19C3 presentation – p.10/64

Page 11: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Simple SIMD character comparison

F-CPU 19C3 presentation – p.11/64

Page 12: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The ROP2 (logic) unit

F-CPU Design TeamROP2 unit : schematic view for one byte(C) Yann Guidon 8/31/2001version : dec. 2, 2001

rop2

_uni

t.vhd

lro

p2_x

bar.

vhdl

FF FFFF

A BFF

C

FF FF FF

ROP2_function2 1 0

2 1 0

LUT

FF FFFF

A BFF

CFF FFFF

A BFF

CFF FFFF

A BFF

C

FF

SFF

SFF

SFF

S

ROP2_function_bit3

FF FFFF

A BFF

CFF FFFF

A BFF

CFF FFFF

A BFF

CFF FFFF

A BFF

C

FF

SFF

SFF

SFF

S

FFFF

ROP2_mode

3-level signal

amplification

tree (1->4->16->64)

performed by fanout_tree

This is only an indicationof the equation complexity.The circuit will be synthesisedfrom the parametised LUT.

The fanout is higherthan that : 16 for the64-bit version. fanout_treeis used to compensate forthis.

partial_MUX

partial_ROP

partial_OR

partial_AND

F-CPU 19C3 presentation – p.12/64

Page 13: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

C example

char a;

...

if (a == TAB || a == CR|| a == ’ ’ || a == 0) {

...

}

F-CPU 19C3 presentation – p.13/64

Page 14: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Assembler example

a in Ra, temporary result in Rtemp, mask in Rmask :

loadaddri end if, Rjmp ; prefetchsdup.8 Ra, Rtemp ; duplicate aloadcons[0] 0x2000, Rmask ; load constantsloadconsx[1] 0x090A, Rmaskxorn.and.32 Rmask, Rtemp, Rtempbnz Rtemp, Rjmp

...

end if:

F-CPU 19C3 presentation – p.14/64

Page 15: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Arbitrary byte shuffling in one byte

F-CPU 19C3 presentation – p.15/64

Page 16: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Random shuffling example

0 -> 31 -> 22 -> 43 -> 74 -> 55 -> 16 -> 07 -> 6

From this, we generate the following masks :

r3 = mask1 = 0x8040201008040201; // linear bit selectionr5 = maks2 = 0x4001028020100408; // permuted mask

F-CPU 19C3 presentation – p.16/64

Page 17: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The assembly langage source

sdup.b r1, r2 ; duplicate r1 into r2and.or r2, r3, r4 ; first mask and combineand r4, r5, r6 ; second maskshri 32, r6, r7 ; gather the bits in log2or r6, r7shri 16, r6, r7or r6, r7shri 8, r6, r7or r6, r7

9 instructions for shuffling 8 bits :this yields almost 1 instruction per bit!

F-CPU 19C3 presentation – p.17/64

Page 18: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Powerup and BIST method

F-CPU 19C3 presentation – p.18/64

Page 19: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The FC0 pipeline

ROP2 SHL INCASU

RegisterSet

F-CPU 19C3 presentation – p.19/64

Page 20: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Popcount unit and LFSR

ROP2 SHL INCASU

RegisterSet

Signal Generator

compactsignature

generatesignature

F-CPU 19C3 presentation – p.20/64

Page 21: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Popcount unit and LFSR

XO

R

PO

PC

OU

NT

MU

X

LF

SR

64

6666

64

64 64

F-CPU 19C3 presentation – p.21/64

Page 22: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The hardware design flowNicolas Boulay

F-CPU 19C3 presentation – p.22/64

Page 23: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

A transistor

F-CPU 19C3 presentation – p.23/64

Page 24: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

A real transistor

F-CPU 19C3 presentation – p.24/64

Page 25: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

A wafer

F-CPU 19C3 presentation – p.25/64

Page 26: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Some ASIC

F-CPU 19C3 presentation – p.26/64

Page 27: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

An other ASIC

F-CPU 19C3 presentation – p.27/64

Page 28: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

FPGA principe

F-CPU 19C3 presentation – p.28/64

Page 29: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Making hardware

FPGA (field programable gate array)

Semi-custom, full custom (ASIC, Application SpecificIntegrated Circuit).

F-CPU 19C3 presentation – p.29/64

Page 30: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Design IP (or a core)

Nowdays what had been put in mainboard are put in thesame die (piece of silicon). Componants are replace bycore to create System-on-Chip (SoC).

F-cpu is a core. So a SoC could be maid of fritz chip + fcpu.

F-CPU 19C3 presentation – p.30/64

Page 31: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

TCPA

F-CPU 19C3 presentation – p.31/64

Page 32: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

GPL

Depending of the licence, we could obliged to open all

sources. But the cores risk to be not used (imagine that

linux unallowed to run proprietary stuff). And seeing the

code could not surely help to break the protection.

F-CPU 19C3 presentation – p.32/64

Page 33: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

LGPL

Only the core is protected like the Leon is (Sparc V7 clone).

F-CPU 19C3 presentation – p.33/64

Page 34: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

GPL+proprietary interface

Like linux kernel, we could choose to open certain interface

(like the io bus but not the SDRAM bus).

F-CPU 19C3 presentation – p.34/64

Page 35: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Licence

But the licence is a constant flameware on the mailing list.

GPL is currently used, but is too much restrictive from my

point of view. It’s also hard to accept that GPL could cover

hardware, too (something with sources and a "result").

F-CPU 19C3 presentation – p.35/64

Page 36: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Design

F-CPU 19C3 presentation – p.36/64

Page 37: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Design cycle

Write HDL thenSimulate RTLcode (waveform)

Synthesis it tohave a netlist(timing result +number of gateused)

Place and routeto get plan(GDS2 files +more precisetiming result +area used (wire))

F-CPU 19C3 presentation – p.37/64

Page 38: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Design cycle

Write HDL thenSimulate RTLcode (waveform)

Synthesis it tohave a netlist(timing result +number of gateused)

Place and routeto get plan(GDS2 files +more precisetiming result +area used (wire))

F-CPU 19C3 presentation – p.37/64

Page 39: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Design cycle

Write HDL thenSimulate RTLcode (waveform)

Synthesis it tohave a netlist(timing result +number of gateused)

Place and routeto get plan(GDS2 files +more precisetiming result +area used (wire))

F-CPU 19C3 presentation – p.37/64

Page 40: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Simulator

F-CPU sources are compatible with most compilers andhave been tested with :

ncsim (cadence, fastest of the market)

modelsim

Simili (freeware, slower that ncsim)

ghdl (alpha version) (the story of a guy that wanted tolearn Ada and VHDL so he wrote a VHDL gcc front endin Ada)

ALDEC’s Riviera (nice but proprietary)

Vanilla VHDL (abandonware)

F-CPU 19C3 presentation – p.38/64

Page 41: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Synthetiser

Design Compiler (Synopsys, 100 Keur/year... for ASIC)

Synplify (Synplicity for FPGA)

_NO_ free software

F-CPU 19C3 presentation – p.39/64

Page 42: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Place & Route

Cadence tools

Tendance of merged with synthesys tools (for <130 nmtechnology).

Also _NO_ free software

F-CPU 19C3 presentation – p.40/64

Page 43: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

That’s NOT all folks !

Static timing analysis tool to verify synthesis (primetimefrom synopsys : 100 Keur/year).

Equivalence checking between netlist and rtl code (avoidslooow simulation in gate level).

ATPG (automatic patern generator) to create input vectorsto test the chip at the fab to cover the maximum stuck faultwith the minimum of vectors.

BIST generator to test memory.

Formal proofing tools to help finding bug in the rtl design.

F-CPU 19C3 presentation – p.41/64

Page 44: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Tools conclusion

So it miss a lot of free tools !

F-CPU 19C3 presentation – p.42/64

Page 45: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Call conventionCedric Bail

F-CPU 19C3 presentation – p.43/64

Page 46: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised register

No stack pointerNo specific address pointer63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 47: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised registerNo stack pointer

No specific address pointer63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 48: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised registerNo stack pointerNo specific address pointer

63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 49: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised registerNo stack pointerNo specific address pointer63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 50: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised registerNo stack pointerNo specific address pointer63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 51: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

F-CPU call capacity

No specialised registerNo stack pointerNo specific address pointer63 Generals registers

No call

No stack

F-CPU 19C3 presentation – p.44/64

Page 52: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

What we need to do a call

Stack pointer

Return address

Return value

Parameters

F-CPU 19C3 presentation – p.45/64

Page 53: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

C source example

void hanoi(int N, char* D, char* B, char* I){

if (N == 1)printf ("move %s to %s", D, B);

else{

hanoi (N-1, D, I, B);printf ("move %s to %s", D, B);hanoi (N-1, I, B, D);

}}

F-CPU 19C3 presentation – p.46/64

Page 54: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The first call convention

R0

= always zeroR1-R61 = preserved accross callR62 = return addressR63 = stack pointer

F-CPU 19C3 presentation – p.47/64

Page 55: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The first call convention

R0 = always zero

R1-R61 = preserved accross callR62 = return addressR63 = stack pointer

F-CPU 19C3 presentation – p.47/64

Page 56: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The first call convention

R0 = always zeroR1-R61

= preserved accross call

R62

= return address

R63

= stack pointer

F-CPU 19C3 presentation – p.47/64

Page 57: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The first call convention

R0 = always zeroR1-R61 = preserved accross callR62 = return addressR63 = stack pointer

F-CPU 19C3 presentation – p.47/64

Page 58: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The cost

Before using a register need to store it in memory

Before doing a return you need to load them back frommemory

F-CPU 19C3 presentation – p.48/64

Page 59: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Prologue example

storei -8, [sp], r1storei -8, [sp], r2storei -8, [sp], r3storei -8, [sp], r4storei -8, [sp], r5storei -8, [sp], r6storei -8, [sp], r7storei -8, [sp], r62

addi 6 * 8, sp, r1loadi +8, [r1], r2 ; char* Iloadi +8, [r1], r3 ; char* Bloadi +8, [r1], r4 ; char* Dloadi +8, [r1], r5 ; int N

F-CPU 19C3 presentation – p.49/64

Page 60: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Prologue example

storei -8, [sp], r1storei -8, [sp], r2storei -8, [sp], r3storei -8, [sp], r4storei -8, [sp], r5storei -8, [sp], r6storei -8, [sp], r7storei -8, [sp], r62

addi 6 * 8, sp, r1loadi +8, [r1], r2 ; char* Iloadi +8, [r1], r3 ; char* Bloadi +8, [r1], r4 ; char* Dloadi +8, [r1], r5 ; int N

F-CPU 19C3 presentation – p.49/64

Page 61: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Epilogue example

loadi -8, [sp], r62loadi -8, [sp], r7loadi -8, [sp], r6loadi -8, [sp], r5loadi -8, [sp], r4loadi -8, [sp], r3loadi -8, [sp], r2loadi -8, [sp], r1

F-CPU 19C3 presentation – p.50/64

Page 62: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

hanoi with first call convention

22 * 64 bits data are stored

20 * 64 bits data are loaded

No tail recursive call

F-CPU 19C3 presentation – p.51/64

Page 63: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Second call convention

R1-R15 = ParametersR16-R31 = Temporary (not preserved accross call)R32-R61 = Saved temporary (preserved accross call)R62 = Stack pointerR63 = Return address

F-CPU 19C3 presentation – p.52/64

Page 64: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Prologue example

storei -8, [sp], r32storei -8, [sp], r33storei -8, [sp], r34storei -8, [sp], r35storei -8, [sp], r62

F-CPU 19C3 presentation – p.53/64

Page 65: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Epilogue example

loadi +8, [sp], r62loadi +8, [sp], r35loadi +8, [sp], r34loadi +8, [sp], r33loadi +8, [sp], r32

F-CPU 19C3 presentation – p.54/64

Page 66: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

hanoi with second call convention

10 * 64 bits data are stored

10 * 64 bits data are loaded

Tail recursive call

Recursive prologue

F-CPU 19C3 presentation – p.55/64

Page 67: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Recursive prologue example

storei -8, [sp], r36storei -8, [sp], r37

loadcons printf, r36loopentry r37

; Hanoi really start here

F-CPU 19C3 presentation – p.56/64

Page 68: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The maskload/store idea

R1-R15 = ParametersR16-R31 = Temporary (not preserved accross call)R32-R57 = Saved temporary (preserved accross call)R58 = Mask registerR59 = Pointer to Procedure Linkage TableR60 = Pointer to Global Offset TableR61 = Frame pointerR62 = Stack pointerR63 = Return address

F-CPU 19C3 presentation – p.57/64

Page 69: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Prologue example

Will save r48-r52, mr (r58), sp (r62), ra (r63)1100 0100 0001 1111

move r0, t2loadcons.3 0xC82F, t2and mr, t2, t3

maskstore t3, [sp]move t2, r48

F-CPU 19C3 presentation – p.58/64

Page 70: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Epilogue example

maskload r48, [sp]

F-CPU 19C3 presentation – p.59/64

Page 71: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Problem

Asynchronous

Complex

Faults

Never the same binary with the same code

F-CPU 19C3 presentation – p.60/64

Page 72: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Solution

But we can do it with conditionnal load and store.

cstorel t3, [sp], r48shiftli 1, t3, t3msubi 8, sp, sp

F-CPU 19C3 presentation – p.61/64

Page 73: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

The current accepted call convention

R1-R15 = ParametersR16-R31 = Temporary (not preserved accross call)R32-R58 = Saved temporary (preserved accross call)R59 = Pointer to Procedure Linkage TableR60 = Pointer to Global Offset TableR61 = Frame pointerR62 = Stack pointerR63 = Return address

F-CPU 19C3 presentation – p.62/64

Page 74: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Linking solution

Use elf to put information on register used by function andcall graph

Clean address mode

No hidden register

Always the same result with the same code

Always the best result for the binarie

F-CPU 19C3 presentation – p.63/64

Page 75: F-CPU: Year 4f-cpu.seul.org/new/19c3-presentation.pdf · Powerup and BIST method F-CPU 19C3 presentation – p.18/64. The FC0 pipeline ROP2 ASU SHL INC Register Set F-CPU 19C3 presentation

Questions ?

Cedric BAIL : [email protected] BOULAY : [email protected] GUIDON : [email protected]

F-CPU 19C3 presentation – p.64/64