0% found this document useful (0 votes)
41 views12 pages

Lecture3 PDF

This document provides an overview of Lecture 3 which covers system-level description languages and an introduction to the SpecC language. Specifically, it discusses the goals and requirements of system-level description languages, and presents an overview of the SpecC language including its foundations in ANSI-C, extensions for hardware modeling, and support for data types. The lecture is intended to cover SpecC's structural hierarchy, behavioral hierarchy, exception handling, and communication/synchronization in subsequent parts.

Uploaded by

Frankie Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views12 pages

Lecture3 PDF

This document provides an overview of Lecture 3 which covers system-level description languages and an introduction to the SpecC language. Specifically, it discusses the goals and requirements of system-level description languages, and presents an overview of the SpecC language including its foundations in ANSI-C, extensions for hardware modeling, and support for data types. The lecture is intended to cover SpecC's structural hierarchy, behavioral hierarchy, exception handling, and communication/synchronization in subsequent parts.

Uploaded by

Frankie Liu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

EECS222: Embedded System Modeling Lecture 3

EECS 222:
Embedded System Modeling
Lecture 3

Rainer Dömer

[email protected]

The Henry Samueli School of Engineering


Electrical Engineering and Computer Science
University of California, Irvine

Lecture 3: Overview
• System-Level Description Languages
– Goals
– Requirements
• Introduction to the SpecC Language (Part 1)
– Foundation, types
– Structural hierarchy
– Behavioral hierarchy
– Exception handling

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 2

(c) 2019 R. Doemer 1


EECS222: Embedded System Modeling Lecture 3

System-Level Description Languages


• Goals and Requirements
– Formality
• Formal syntax and semantics
– Executability
• Validation through simulation
– Synthesizability
• Implementation in HW and/or SW
• Support for IP reuse
– Modularity
• Hierarchical composition
• Separation of concepts
– Completeness
• Support for all concepts found in embedded systems
– Orthogonality
• Orthogonal constructs for orthogonal concepts
– Simplicity
• Minimality

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 3

System-Level Description Languages


• Requirements supported by existing languages

Behavioral
hierarchy
Structural
hierarchy
Concurrency

Synchronization
Exception
handling
Timing
State
transitions
Composite
data types

not supported partially supported supported

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 4

(c) 2019 R. Doemer 2


EECS222: Embedded System Modeling Lecture 3

SpecC Language Overview


• Part 1: Today
– Foundation, types
– Structural hierarchy
– Behavioral hierarchy
– Exception handling
• Part 2:
– Communication and synchronization
– Timing
– Library support
– Persistent annotation
• Part 3:
– Register Transfer Level (RTL) support

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 5

The SpecC Language


• Foundation: ANSI-C
– Software requirements are fully covered
– SpecC is a true superset of ANSI-C
– Every C program is a SpecC program
– Leverage of large set of existing programs
– Well-known
– Well-established

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 6

(c) 2019 R. Doemer 3


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Foundation: ANSI-C
– Software requirements are fully covered
– SpecC is a true superset of ANSI-C
– Every C program is a SpecC program
– Leverage of large set of existing programs
– Well-known
– Well-established
• SpecC has extensions needed for hardware
– Minimal, orthogonal set of concepts
– Minimal, orthogonal set of constructs
• SpecC is a real language
– Is not just a class library (as SystemC)
– Relies on dedicated compiler and static analysis

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 7

The SpecC Language


• ANSI-C /* HelloWorld.c */

– Program is set of functions #include <stdio.h>

– Execution starts from int main(void)


{
function main() printf(“Hello World!\n”);
return 0;
}

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 8

(c) 2019 R. Doemer 4


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• ANSI-C /* HelloWorld.c */

– Program is set of functions #include <stdio.h>

– Execution starts from int main(void)


{
function main() printf(“Hello World!\n”);
return 0;
}

• SpecC // HelloWorld.sc

– Program is set of behaviors, #include <stdio.h>


channels, and interfaces behavior Main
– Execution starts from {
int main(void)
behavior Main.main() {
printf(“Hello World!\n”);
return 0;
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 9

The SpecC Language


• SpecC types
– Support for all ANSI-C types
• predefined types (int, float, double, …)
• composite types (arrays, pointers)
• user-defined types (struct, union, enum)
– Boolean type: Explicit support of truth values
• bool b1 = true;
• bool b2 = false;
– Bit vector type: Explicit support of bit vectors of arbitrary length
• bit[15:0] bv = 1111000011110000b;
– Event type: Support of synchronization
• event e;
– Buffered and signal types: Explicit support of RTL concepts
• buffered[clk] bit[32] reg;
• signal bit[16] address;
EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 10

(c) 2019 R. Doemer 5


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Bit vector type typedef bit[7:0] byte;
byte a;
// type definition

– signed or unsigned unsigned bit[16] b;

– arbitrary length bit[31:0] BitMagic(bit[4] c, bit[32] d)


{
– standard operators bit[31:0] r;

• logical operations a = 11001100b; // constant


• arithmetic operations b = 1111000011110000ub; // assignment

• comparison operations b[7:0] = a; // sliced access


b = d[31:16];
• type conversion
• type promotion if (b[15]) // single bit
b[15] = 0b; // access
– concatenation operator
r = a @ d[11:0] @ c // concatenation
• a @ b @ 11110000b;

– slice operator a = ~(a & 11110000b); // logical op.


• a[l:r] r += 42 + 3*a; // arithmetic op.

return r;
}

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 11

The SpecC Language


• Basic structure Behavior Ports Channel Interfaces
– Top behavior
– Child behaviors p1 p2
c1
– Channels B
– Interfaces v1

– Variables (wires)
– Ports
b1 b2

Variable
Child behaviors (wire)

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 12

(c) 2019 R. Doemer 6


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Structural hierarchy
interface I1
{
bit[63:0] Read(void); p1 p2
void Write(bit[63:0]); c1
}; B
v1
channel C1 implements I1;

behavior B1(in int, I1, out int);

behavior B(in int p1, out int p2) b1 b2


{
int v1;
C1 c1;
B1 b1(p1, c1, v1),
b2(v1, c1, p2);
SpecC 2.0:
void main(void)
{ par { b1.main();
b1;
if b is a behavior instance,
b2.main();
b2; b; is equivalent to b.main();
}
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 13

The SpecC Language


• Typical test bench
– Top-level behavior: Main
– Stimulus provides test vectors
– Design under test (DUT) represents the target SoC
– Monitor observes and checks outputs

Main
v1 v3
v2 v4

Stimulus DUT Monitor

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 14

(c) 2019 R. Doemer 7


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Behavioral hierarchy
Sequential FSM Concurrent Pipelined
execution execution execution execution
B_seq B_fsm
b1 b1 b2

b2 b3 b4

b3 b5 b6

behavior B_seq behavior B_fsm


{ {
B b1, b2, b3; B b1, b2, b3,
b4, b5, b6;
void main(void) void main(void)
{ b1; { fsm { b1:{…}
b2; b2:{…}
b3; …}
} }
}; };

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 15

The SpecC Language


• Behavioral hierarchy
Sequential FSM Concurrent Pipelined
execution execution execution execution
B_seq B_fsm B_par B_pipe
b1 b1 b2 b1 b1

b2 b3 b4 b2 b2

b3 b5 b6 b3 b3

behavior B_seq behavior B_fsm behavior B_par behavior B_pipe


{ { { {
B b1, b2, b3; B b1, b2, b3, B b1, b2, b3; B b1, b2, b3;
b4, b5, b6;
void main(void) void main(void) void main(void) void main(void)
{ b1; { fsm { b1:{…} { par{ b1; { pipe{ b1;
b2; b2:{…} b2; b2;
b3; …} b3; } b3; }
} } } }
}; }; }; };

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 16

(c) 2019 R. Doemer 8


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Finite State Machine (FSM)
– Explicit state transitions
• triple < current_state, condition, next_state >
• fsm { <current_state> : { if <condition> goto <next_state> } …
}
– Moore-type FSM
– Mealy-type FSM
B_FSM
behavior B_FSM(in int a, in int b)
{
b=0
B b1, b2, b3; b>0

void main(void) b1 b2
{ fsm { b1:{ if (b<0) break;
a>0
if (b==0) goto b1; a>b
if (b>0) goto b2; } a0
b2:{ if (a>0) goto b1; }
b3:{ if (a>b) goto b1; }
b3
b<0
} ab
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 17

The SpecC Language


• Pipeline
– Explicit execution in pipeline fashion
• pipe { <instance_list> }; behavior Pipeline
{

Stage1 b1;
Stage2 b2;
Pipeline Stage3 b3;

void main(void)
{

pipe
{ b1;
b2;
b1 b2 b3 b3;
}
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 18

(c) 2019 R. Doemer 9


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Pipeline
– Explicit execution in pipeline fashion
• pipe { <instance_list> }; behavior Pipeline
{
• pipe (<init>; <cond>; <incr>) { … }

Stage1 b1;
Stage2 b2;
Pipeline Stage3 b3;

void main(void)
{
int i;
pipe(i=0; i<10; i++)
{ b1;
b2;
b1 b2 b3 b3;
}
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 19

The SpecC Language


• Pipeline
– Explicit execution in pipeline fashion
• pipe { <instance_list> }; behavior Pipeline
{
• pipe (<init>; <cond>; <incr>) { … } int v1;
– Support for automatic buffering int v2;
int v3;

Stage1 b1(v1, v2);


Stage2 b2(v2, v3);
Pipeline Stage3 b3(v3, v1);
v1
void main(void)
v2 v3 {
int i;
pipe(i=0; i<10; i++)
{ b1;
b2;
b1 b2 b3 b3;
}
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 20

(c) 2019 R. Doemer 10


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Pipeline
– Explicit execution in pipeline fashion
• pipe { <instance_list> }; behavior Pipeline
{
• pipe (<init>; <cond>; <incr>) { … } piped piped int v1;
– Support for automatic buffering piped int v2;
piped int v3;
• piped […] <type> <variable_list>;
Stage1 b1(v1, v2);
Stage2 b2(v2, v3);
Pipeline Stage3 b3(v3, v1);
v1
void main(void)
v2 v3 {
int i;
pipe(i=0; i<10; i++)
{ b1;
b2;
b1 b2 b3 b3;
}
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 21

The SpecC Language


• Exception handling
– Abortion – Interrupt
e1 B1 e2

b
e1 e2

a1 a2

behavior B1(in event e1, in event e2)


{
B b, a1, a2;

void main(void)
{ try { b; }
trap (e1) { a1; }
trap (e2) { a2; }
}
};

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 22

(c) 2019 R. Doemer 11


EECS222: Embedded System Modeling Lecture 3

The SpecC Language


• Exception handling
– Abortion – Interrupt
e1 B1 e2 e1 B2 e2

b b
e1 e2 e1 e2

a1 a2 i1 i2

behavior B1(in event e1, in event e2) behavior B2(in event e1, in event e2)
{ {
B b, a1, a2; B b, i1, i2;

void main(void) void main(void)


{ try { b; } { try { b; }
trap (e1) { a1; } interrupt (e1) { i1; }
trap (e2) { a2; } interrupt (e2) { i2; }
} }
}; };

EECS222: Embedded System Modeling, Lecture 3 (c) 2019 R. Doemer 23

(c) 2019 R. Doemer 12

You might also like