a semantic model for vhdl-ams (charme '97)

21
? A semantic model for VHDL-AMS Natividad Mart´ ınez Madrid, Peter T. Breuer, Carlos Delgado Kloos Universidad Carlos III de Madrid <nmadrid,ptb,cdk>@it.uc3m.es CHARME ’97, Montr´ eal, Canada - October 1997 1

Upload: peter-breuer

Post on 10-Jun-2015

133 views

Category:

Education


0 download

DESCRIPTION

Slides for paper "A Semantic Model for VHDL-AMS", given at CHARME, Montreal, Canada, October 1997. The paper is published in pages 106-126 of "Advances in Hardware Design and Verification", IFIP/Chapman and Hall, 1997. A preprint is available at http://www.academia.edu/1413563/A_semantic_model_for_VHDL-AMS .

TRANSCRIPT

Page 1: A Semantic Model for VHDL-AMS (CHARME '97)

?

A semantic model for VHDL-AMS

Natividad Martınez Madrid, Peter T. Breuer, Carlos Delgado Kloos

Universidad Carlos III de Madrid

<nmadrid,ptb,cdk>@it.uc3m.es

CHARME ’97, Montreal, Canada - October 1997 1

Page 2: A Semantic Model for VHDL-AMS (CHARME '97)

Objectives ?

• explain behaviour of VHDL-AMS processes

– not a detailed syntactic mapping

– provide sufficient primitives

• present an underlying model that . . .

– extends existing model for VHDL

CHARME ’97, Montreal, Canada - October 1997 2

Page 3: A Semantic Model for VHDL-AMS (CHARME '97)

Content of the talk ?

• Introduction

• A process algebraic analysis

• Semantics

• The analog solver with example

CHARME ’97, Montreal, Canada - October 1997 3

Page 4: A Semantic Model for VHDL-AMS (CHARME '97)

Main idea ?

VHDL semantics analog extension

imperative

discrete-event

diff. equations

real time domain

declarative

continuous-time

ց ւ

INTEGRATION

CHARME ’97, Montreal, Canada - October 1997 4

Page 5: A Semantic Model for VHDL-AMS (CHARME '97)

Name space division & Properties ?

VARIABLES assigned

instantaneously

not scheduled

SIGNALS at least δ-delayed preemptively

scheduled

QUANTITIES assigned

instantaneously

governed by diff. eqns.

PROCESSES invariant invariant

CHARME ’97, Montreal, Canada - October 1997 5

Page 6: A Semantic Model for VHDL-AMS (CHARME '97)

Semantics of assignment ?

��������������������������������

��������������������������������

�����������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������

�������������� "Forced" signal assignment

a <= 1 after 4

������������������������������������������������������������

������������������������������������������������������������

a

������������������������������������������������������������������������������

������������������������������������������������������������������������������

. v =x.

�������������� "Relaxed" quantity update

����������

����������

����������

����������

���

���

���

�����������������������������

����������������������������������������������������

������������������������������������������������������������������������������x

a= v

CHARME ’97, Montreal, Canada - October 1997 6

Page 7: A Semantic Model for VHDL-AMS (CHARME '97)

Semantic Domains ?

WorldLine = T ime → State

State = Id → V alue

VHDL Statements

Semantics = (WorldLine, T ime) ↔ (WorldLine, T ime)T ime = Int

VHDL-AMS Statements

Semantics = (EqnSet,WorldLine, T ime) ↔ (EqnSet,WorldLine, T ime)T ime = Real

CHARME ’97, Montreal, Canada - October 1997 7

Page 8: A Semantic Model for VHDL-AMS (CHARME '97)

Parallel decomposition ?

LRM view of basic VHDL compositionality:

• processes in parallel (+ kernel)

• process body loops continuously

• imperative commands in process body run sequentially

Our view:

• no kernel

CHARME ’97, Montreal, Canada - October 1997 8

Page 9: A Semantic Model for VHDL-AMS (CHARME '97)

VHDL-AMS: integer time → real time

Analog Solver

Page 10: A Semantic Model for VHDL-AMS (CHARME '97)

Process algebraic analysis ?

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Ai

Aj

ΣjΣi

ΣjPj’

Pi’

Pi

Pj

Ki

Kj

Σi

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

AS

Ai

Aj

ΣjΣi

ΣjPj’

Pi’

Pj

Ki

Kj

Σi

Pi

CHARME ’97, Montreal, Canada - October 1997 9

Page 11: A Semantic Model for VHDL-AMS (CHARME '97)

Process algebraic analysis (II) ?

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

Σ j

’iΣ

’jΣ

K’iΣ

Σ

QAS

QAS

KAj

KAi

Pi

Pj

Ai

Aj K’j

Pj’

Pi’

CHARME ’97, Montreal, Canada - October 1997 10

Page 12: A Semantic Model for VHDL-AMS (CHARME '97)

Denotational semantics ?

S[a; b] = S[a];S[b]

P[a; b] = P[a] ∪ S[a];P[b]

S[while(true)do a end] = { }

P[while(true)do a end] = P[a] ∪ S[a];P[while(true)do a end]

= µR : Semantics .R = P[a] ∪ S[a];R

S[a||b] = S[a] ∩ S[b]

P[a||b] = P[a] ∩ P[b]

CHARME ’97, Montreal, Canada - October 1997 11

Page 13: A Semantic Model for VHDL-AMS (CHARME '97)

Wait & Assignment semantics ?

Wait Semantics

(e, w0, t0)S[wait until p](e, w1, t1) = w0 = w1

∧ wt1 |= p ∧ ∀t ∈ [t0, t1) . wt 6|= p

(e, w0, t0)P[wait until p](e, w1, t1) = w0 = w1

∧ ∀t ∈ [t0, t1] . wt 6|= p

Assignment Semantics

(e, w0, t0)S[x⇐ y after τ ](e, w1, t1) = t0 = t1

∧ w1 = relax(e, t0)(force assign(w0))

P[x⇐ y after τ ] = { }

CHARME ’97, Montreal, Canada - October 1997 12

Page 14: A Semantic Model for VHDL-AMS (CHARME '97)

Wait semantics ?

������������

������������

������������������������������������������������������������

������������������������������������������������������������

Generalized Wait

a

x

wait until a = 1

on signals -> discrete time

������������������������������������������������������������

������������������������������������������������������������

������������

������������

������������������������������������������������������������

������������������������������������������������������������

������������

������������

wait until x >= 2/3

on quantities -> continuous time

CHARME ’97, Montreal, Canada - October 1997 13

Page 15: A Semantic Model for VHDL-AMS (CHARME '97)

Sequential composition ?

;

������������������������

������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������

a x

������������������������������������������������������������������

������������������������������������������������������������������

��������������������������

��������������������������������������������

��������������������������������������������

������������������������

������������������������

������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������

a x

������������������������������������������������������������������

������������������������������������������������������������������

��������������������������

��������������������������������������������

��������������������������������������������

������������������������

������������������������

������������������������������������������������������������������������������������������������������������

������������������������������������������������������������������������������������������������������������

a x

������������������������������������������������������������������

������������������������������������������������������������������

��������������������������

��������������������������������������������

��������������������������������������������

������������������������

. v =x. a

= v wait until x >= 2/3wait until x >= 2/3wait until x >= 2/3a <= 1 after 4

CHARME ’97, Montreal, Canada - October 1997 14

Page 16: A Semantic Model for VHDL-AMS (CHARME '97)

Analog solution ?

Bouncing ball example

dsdt

= v

dvdt

= −g ± av2

Local approximations(t) = 1v(t) = −gt

origin ats = 1v = 0t = 0

Linear approximation (s, v) = (s0, v0) + (t− t0)(v0,−g ± av20)

Recursion

(s, v)(t0,s0,v0)(t) ∼

(s0, v0) + (t− t0)(v0,−g ± av20) t ∈ [t0, t1)

(s, v)(t1,s1,v1)(t)

s1 = s0 + v0∆t

v1 = v0 + (−g ± av20)∆tt1 = t0 +∆t

CHARME ’97, Montreal, Canada - October 1997 15

Page 17: A Semantic Model for VHDL-AMS (CHARME '97)

Example ?proc [qty s := 1.0, v := 0.0, g := 9.8, a := 0.1 ]

ds/dt == v;

dv/dt == -g + if v<0 then a else -a end * v * v;

begin

wait until s < 0;

v := -v;

s := 0 ;

end

∆t = 0.02

CHARME ’97, Montreal, Canada - October 1997 16

Page 18: A Semantic Model for VHDL-AMS (CHARME '97)

Example Cont. ?proc [qty s := 1.0, v := 0.0, g := 9.8, a := 0.1 ]

ds/dt == v;

dv/dt == -g + if v<0 then a else -a end * v * v;

begin

wait until s < 0;

v := 1.4142 * (g * s + 0.5 * v * v)**0.5 ;

s := 0 ;

end

g ∗ 0+ v′2

2 =

g ∗ s+ v2

2

∆t = 0.06CHARME ’97, Montreal, Canada - October 1997 17

Page 19: A Semantic Model for VHDL-AMS (CHARME '97)

Example Cont. (II) ?

Height

Speed

∆t = 0.06

CHARME ’97, Montreal, Canada - October 1997 18

Page 20: A Semantic Model for VHDL-AMS (CHARME '97)

Unresolved areas ?

• Implementation of the parallel composition of pro-

cesses if quantities are shared between processes

• Errors in the analog solver may require us to rewrite

our program

• The proper execution of the analog solver in δ time

when the processes are in parallel

CHARME ’97, Montreal, Canada - October 1997 19

Page 21: A Semantic Model for VHDL-AMS (CHARME '97)

Conclusion ?

• What? Extension of our VHDL semantics to cover

VHDL-AMS

• How? Embedding of the VHDL semantics in a bigger,

continuous time domain, which contains an oracular

analog solver

• Why? Clarify the draft standard document

CHARME ’97, Montreal, Canada - October 1997 20