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
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
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
FPGA Application Processor
Abstraction
Synthesis Application
2
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL ;
entity SimpleALU is port ( clk:in std_logic; A,B:in std_logic_vector(31 downto 0);
R:out std_logic_vector(31 downto 0) ); end SimpleALU;
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;
ALU
A B R
clk
Interface
3
Components
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL ;
entity SimpleALU is port ( clk:in std_logic; A,B:in std_logic_vector(31 downto 0);
R:out std_logic_vector(31 downto 0) ); end SimpleALU;
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;
propagation delay to take effect
ALU
A B R
clk
Interface
3
(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
clk Execute
FPGA available ? Outputs No Yes
3 2 1
Simulated execution
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
5
processes with sensitivity list (event listener)
update
inputs will become active
trigger other processes
Update signals value
Determine events occur Execute processes triggered by events Start End
6
first time
clk
done signal is asserted
alu := SimpleALU new. alu A:20. alu B:15. alu opcode:false. alu execute.
7
communication interface
from the model
generated
for low level synthesis
SimpleALU Interface R A B
Final circuit
Low level synthesis
0110
Bit file
FPGA
VHDL HW. configuration Export Program 8
ByteArray and sent to FPGA
data it received and sends to the target circuit
fetched from Smalltalk in a reverse way
#[<A>,<B>,<opcode>] #[<R>]
SimpleALU R A B
Interface
Pharo VM
9
specific amount of time
some specific points of time
stored in a time queue
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
execution of FPGA circuit ?
capabilities on hardware
11
execution of FPGA circuit ?
capabilities on hardware
11
Target circuit Clock controller
global clock
clk
execution of FPGA circuit ?
capabilities on hardware
11
Target circuit Clock controller
global clock
clk
…… 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
12
…… 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
when changing
Interface
Target circuit Clock controller
halt global clock
clk
clock counter
done start
Inputs Output
12
“set another breakpoint”
“stop when out = 10”
13
hardware co-simulation
Smalltalk→FPGA
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
t e r V H D L C
p i l e r
S y n t h e s i s t
s D S L V H D L P a r s e r S i m u l a t
F F I
14
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
Working progress
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
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.
SimpleCounter new.
MUX Target circuit
= = =
… …
select
Clock controller
break global clock
resume
clk Debug sub-circuit
start done
clock counter
Breakpoint controller Interface
Inputs Outputs
13
SimpleCounter new.
MUX Target circuit
= = =
… …
select
Clock controller
break global clock
resume
clk Debug sub-circuit
start done
clock counter
Breakpoint controller Interface
Inputs Outputs
13
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