A META MODEL SUPPORTING BOTH HARDWARE AND SMALLTALK-BASED EXECUTION - - PowerPoint PPT Presentation

a meta model supporting both hardware and smalltalk based
SMART_READER_LITE
LIVE PREVIEW

A META MODEL SUPPORTING BOTH HARDWARE AND SMALLTALK-BASED EXECUTION - - PowerPoint PPT Presentation

A META MODEL SUPPORTING BOTH HARDWARE AND SMALLTALK-BASED EXECUTION OF FPGA CIRCUITS Le Xuan Sang 1,2 Loc Lagadec 1 , Luc Fabress 2 , Jannik Laval 2 and Noury Bouraqadi 2 1 Lab-STICC, ENSTA Bretagne 2 Institut Mines-Telecom, Mines Douai ABOUT


slide-1
SLIDE 1

A META MODEL SUPPORTING BOTH HARDWARE AND SMALLTALK-BASED EXECUTION OF FPGA CIRCUITS

Le Xuan Sang1,2 Loïc Lagadec1, Luc Fabress2, Jannik Laval2 and Noury Bouraqadi2

1 Lab-STICC, ENSTA Bretagne 2 Institut Mines-Telecom, Mines Douai

slide-2
SLIDE 2

ABOUT ME

  • LE Xuan Sang
  • 2014-2017 PHD student
  • Coupling FPGA / Smalltalk

in robotic applications

FPGA Application Processor

Abstraction

Synthesis Application

2

slide-3
SLIDE 3
  • - libraries declararion

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL ;

  • - Entity declaration

entity SimpleALU is port ( clk:in std_logic; A,B:in std_logic_vector(31 downto 0);

  • pcode:in std_logic;

R:out std_logic_vector(31 downto 0) ); end SimpleALU;

  • - Architecture

architecture arch of SimpleALU is Signal r1,r2,r3:signed(31 downto 0) :=(others=>'0'); begin r1<=signed(A); r2<=signed(B); R<=std_logic_vector(r3); process(clk) begin if rising_edge(clk) then case opcode is when '0' => r3<=(r1+r2); when '1' => r3<= r1 AND r2; when others => (others=>'0'); end case; end if; end process; end architecture;

DESCRIPTION OF A CIRCUIT USING VHDL

ALU

A B R

  • pcode

clk

Interface

3

slide-4
SLIDE 4

Components

  • - libraries declararion

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL ;

  • - Entity declaration

entity SimpleALU is port ( clk:in std_logic; A,B:in std_logic_vector(31 downto 0);

  • pcode:in std_logic;

R:out std_logic_vector(31 downto 0) ); end SimpleALU;

  • - Architecture

architecture arch of SimpleALU is Signal r1,r2,r3:signed(31 downto 0) :=(others=>'0'); begin r1<=signed(A); r2<=signed(B); R<=std_logic_vector(r3); process(clk) begin if rising_edge(clk) then case opcode is when '0' => r3<=(r1+r2); when '1' => r3<= r1 AND r2; when others => (others=>'0'); end case; end if; end process; end architecture;

DESCRIPTION OF A CIRCUIT USING VHDL

  • Operated in parallel
  • Activated when its inputs change
  • Signals assignment alway need a

propagation delay to take effect

ALU

A B R

  • pcode

clk

Interface

3

slide-5
SLIDE 5

FPGA CIRCUIT MODELLING

3 problems

(1) The meta-model must capture both the structure and the behaviour of the circuit (2) The parallel characteristics + propagation delay of the FPGA circuits must be taken into account (3) Transparent execution of the circuit on FPGA

4

alu := SimpleALU new. alu A:20. alu B:15. alu opcode:false. "add" alu execute. alu R asInteger "35"

ALU

A B R

  • pcode

clk Execute

  • n FPGA

FPGA available ? Outputs No Yes

3 2 1

Simulated execution

  • n VM
slide-6
SLIDE 6

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-7
SLIDE 7

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-8
SLIDE 8

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-9
SLIDE 9

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-10
SLIDE 10

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-11
SLIDE 11

FULL SOLUTION

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

5

slide-12
SLIDE 12

SMALLTALK-BASED EXECUTION OF THE FPGA CIRCUIT MODEL

slide-13
SLIDE 13

EVENT-DRIVEN FOR PROPAGATION EXECUTION

  • All parallel components are considered as

processes with sensitivity list (event listener)

  • The value of signals is changed only after

update

  • Events occur on signals change
  • All processes that have changed signals as

inputs will become active

  • Execution of a triggered process may

trigger other processes

Update signals value

Determine events occur Execute processes triggered by events Start End

6

slide-14
SLIDE 14

CIRCUIT MODEL EXECUTION

  • Inputs ports are assigned at the

first time

  • Each circuit has a done signal
  • The circuit is triggered by the clock

clk

  • The execution is repeated until the

done signal is asserted

alu := SimpleALU new. alu A:20. alu B:15. alu opcode:false. alu execute.

7

slide-15
SLIDE 15

HARDWARE-BASED EXECUTION OF THE FPGA CIRCUIT MODEL

slide-16
SLIDE 16

AUTOMATIC DEPLOYEMENT ON FPGA

  • 1. Generate automatically the

communication interface

  • 2. The VHDL codes is exported

from the model

  • 3. The hardware configuration is

generated

  • 4. The vendor tool-chain is used

for low level synthesis

SimpleALU Interface R A B

  • pcode

Final circuit

Low level synthesis

0110

Bit file

FPGA

VHDL HW. configuration Export Program 8

No effort for developper

slide-17
SLIDE 17

HARDWARE BASED EXECUTION OF CIRCUIT MODEL

  • 1. The inputs signals are assigned
  • 2. The input values are encode as

ByteArray and sent to FPGA

  • 3. The interface circuit decodes the

data it received and sends to the target circuit

  • 4. The outputs of the circuit can be

fetched from Smalltalk in a reverse way

#[<A>,<B>,<opcode>] #[<R>]

SimpleALU R A B

  • pcode

Interface

Pharo VM

9

slide-18
SLIDE 18

CONTROLLABILITY AND DEBUGGING

slide-19
SLIDE 19

POST-MORTEM ANALYSIS OF SIMULATION

  • The circuit is executed for a

specific amount of time

  • The inputs are changed at

some specific points of time

  • Next input changes are

stored in a time queue

  • Timing information and

signals values are traced continuously into a VCD file

alu := SimpleALU new. queue := { #clk clock: 50ns. #A change:{1. 3. 5. 7} every:50ns. #B change:{0. 2. 4. 6} every:50ns. #opcode change:{'0'.'1'} every:100ns. } asTimeQueueFor:400ns. stream := WaveFormStream on:'ALU.vcd'. alu modellingExecution:#execute timeQueue:queue dumpOn:stream.

10

slide-20
SLIDE 20

HARDWARE BREAKPOINT

  • How can we manually stop the

execution of FPGA circuit ?

  • Enables the software like debug

capabilities on hardware

11

slide-21
SLIDE 21

HARDWARE BREAKPOINT

  • How can we manually stop the

execution of FPGA circuit ?

  • Enables the software like debug

capabilities on hardware

11

Target circuit Clock controller

global clock

clk

slide-22
SLIDE 22

HARDWARE BREAKPOINT

  • How can we manually stop the

execution of FPGA circuit ?

  • Enables the software like debug

capabilities on hardware

11

Target circuit Clock controller

global clock

clk

slide-23
SLIDE 23

STATIC BREAKPOINT

…… SimpleCounter>>execute <hdl:#combinational> {self clk. self reset. self start} onChange: [ self reset = '1' ifTrue:[ cnt reset:'0'. ] ifFalse:[ self start = '1' ifTrue:[ cnt reset:'0'. done <- false. ] ifFalse:[ cnt = 100 ifTrue:[ done <- true. ] ifFalse:[ cnt <- (cnt +1).] cnt = 4 ifTrue:[ self halt. ] ] ] ] dout <- cnt.

Halting

A simple counter

12

slide-24
SLIDE 24

STATIC BREAKPOINT

…… SimpleCounter>>execute <hdl:#combinational> {self clk. self reset. self start} onChange: [ self reset = '1' ifTrue:[ cnt reset:'0'. ] ifFalse:[ self start = '1' ifTrue:[ cnt reset:'0'. done <- false. ] ifFalse:[ cnt = 100 ifTrue:[ done <- true. ] ifFalse:[ cnt <- (cnt +1).] cnt = 4 ifTrue:[ self halt. ] ] ] ] dout <- cnt.

Halting

  • Need to re-synthesize the circuit

when changing

Interface

Target circuit Clock controller

halt global clock

clk

clock counter

done start

Inputs Output

12

A simple counter

slide-25
SLIDE 25

DYNAMIC BREAKPOINT

  • bj := SimpleCounter new.
  • bj setBreakpointOn:#dout value:4.
  • bj enableBreakpointOn:#dout.
  • bj execute. "stop at breakpoint”

“set another breakpoint”

  • bj setBreakpointOn:#dout value:10.
  • bj resume. "resume the execution”

“stop when out = 10”

  • bj resume. "Continue”

13

slide-26
SLIDE 26
  • Future work
  • Short term
  • Extend the meta-model
  • support software-

hardware co-simulation

  • Long term
  • Get closer to Smalltalk :

Smalltalk→FPGA

CONCLUSION AND FUTURE WORK

VHDL Legacy VCD

VHDL

0110

Bit file Low level synthesis

FPGA FX2Interface

MetaModel

I n t e r f a c e A d a p t e r s E x p

  • r

t e r V H D L C

  • m

p i l e r

S y n t h e s i s t

  • l

s D S L V H D L P a r s e r S i m u l a t

  • r

F F I

14

slide-27
SLIDE 27

A META MODEL SUPPORTING BOTH HARDWARE AND SMALLTALK-BASED EXECUTION OF FPGA CIRCUITS

Le Xuan Sang1,2 Loïc Lagadec1, Luc Fabress2, Jannik Laval2 and Noury Bouraqadi2

1 Lab-STICC, ENSTA Bretagne 2 Institut Mines-Telecom, Mines Douai

slide-28
SLIDE 28
  • 1. Source code analysis.
  • 2. Resource allocation.
  • 3. Scheduling.
  • 4. Resource binding
  • 5. Generate appropriate interface between

application and the circuit

  • 6. Modelling and simulation FPGA circuit at RTL level.

HIGH LEVEL SYNTHESIS FRAMEWORK

Working progress

slide-29
SLIDE 29
  • Based on the IEEE 1076.66 RTL synthesis standard

(VHDL-87)

  • Support almost any VHDL structures in the

standard

  • Each meta-description in the meta-model capture

both structure and behaviour of a circuit element

  • Signals and Ports are modelled by objects with

history

META-MODEL (1)

slide-30
SLIDE 30

Dedicated DSL for circuit description

META-MODEL (2)

HDLSketch subclass: #SimpleALU instanceVariableNames: 'r1 r2 r3' SimpleALU>>setUpPorts self in:{#A.#B}of:(LogicVector size:32). self in:#opcode of:Logic new. self out:#R of:(LogicVector size:32) SimpleALU>>setUpSignals r1 := Signal of:(LogicVector size:32 signed:true). r2 := Signal of:(LogicVector size:32 signed:true). r3 := Signal of:(LogicVector size:32 signed:true). SimpleALU>>execute <hdl:#combinational> r1 <- (self A). r2 <- (self B). self R <- r3. {self clk} onChange:[ self done <- false. self clk posedge ifTrue:[ self opcode caseOf: { ['0'] -> [r3 <- (r1 + r2)]. ['1'] -> [r3 <- (r1 and:r2)]. }. self done <- true. ]].

DSL

HDLSketch class » compile:text classified:aCategory notifying:requestor |ast| ast := self compiler parse: text. (ast hasPragmaNamed: #hdl:) ifTrue:[ ModelBuilder for:self ast:ast notificator:requestor. ˆself compiledMethodFor:ast selector. ]. ˆsuper compile:text classified:aCategory notifying:requestor.

Error report Syntax analysis Model generation Circuit checking Executable code generation error Ok Ok error

slide-31
SLIDE 31
  • Reuse of Legacy VHDL
  • A builtin VHDL Parser (based on PetitParser).
  • Third-party VHDL codes with respect to the

IEEE 1076.66 RTL standard can be converted to our circuit-model.

  • Updated: the converted circuit model now

can be simulated in our environment

META-MODEL (3)

slide-32
SLIDE 32

EXAMPLE

HDLSketch subclass: #SimpleCounter instanceVariableNames: 'cnt' SimpleCounter>>setupPorts self out:#dout of:(LogicVector size:32). SimpleCounter>>setupSignals cnt := Signal of:(LogicVector size:32). SimpleCounter>>execute <hdl:#combinational> {self clk. self reset. self start} onChange: [ self reset = '1' ifTrue:[ cnt reset:'0'. ] ifFalse:[ self start = '1' ifTrue:[ cnt reset:'0'. done <- false. ] ifFalse:[ cnt = 100 ifTrue:[ done <- true. ] ifFalse:[ cnt <- (cnt +1).] ] ] ] dout <- cnt.

A counter from 0 to 100

slide-33
SLIDE 33

DYNAMIC BREAKPOINT

  • bj :=

SimpleCounter new.

  • bj setBreakpointOn:#dout value:4.
  • bj enableBreakpointOn:#dout.
  • bj execute. "stop at breakpoint"
  • bj resume. "resume the execution"

MUX Target circuit

= = =

  • utput 1
  • utput 2
  • utput m

… …

  • ref. 1
  • ref. 2
  • ref. m

select

Clock controller

break global clock

resume

clk Debug sub-circuit

start done

clock counter

Breakpoint controller Interface

Inputs Outputs

13

slide-34
SLIDE 34

DYNAMIC BREAKPOINT

  • bj :=

SimpleCounter new.

  • bj setBreakpointOn:#dout value:4.
  • bj enableBreakpointOn:#dout.
  • bj execute. "stop at breakpoint"
  • bj resume. "resume the execution"

MUX Target circuit

= = =

  • utput 1
  • utput 2
  • utput m

… …

  • ref. 1
  • ref. 2
  • ref. m

select

Clock controller

break global clock

resume

clk Debug sub-circuit

start done

clock counter

Breakpoint controller Interface

Inputs Outputs

13

slide-35
SLIDE 35

HDLCase HDLMeta HDLData HDLStatement HDLComponent HDLControl HDLOperation HDLIfElse HDLLoop HDLLMux HDLProcess HDLArithmetic HDLLogic HDLLAssignment HDLConditionalSelection

1

*

1

*

1

*

1

*

ConcurentControl SequentialControl

1

*

1

*

HDLType Signal

1 1 1 1 1

*

1 1

HDLArchitecture HDLEntity HDLDesignEntry Port

1 1 1 * 1 1 1 * 1

HDLStaticObject

1 *

1

Logic LogicVector

model HDLSketch

1 1