scaling the abstraction cliff: high-level languages for system design stephen a. edwards synopsys,...
Post on 22-Dec-2015
217 views
TRANSCRIPT
![Page 1: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/1.jpg)
Scaling the Abstraction Cliff: High-Level Languages for System Design
Scaling the Abstraction Cliff: High-Level Languages for System Design
Stephen A. Edwards Synopsys, USA
Luciano Lavagno University of Udine, Italy
devidamente modificada...
![Page 2: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/2.jpg)
PremisePremise
Shrinking hardware costs, higher levels of integration allow more complex designs
Designers’ coding rate staying constant
Higher-level languages the solutionSuccinctly express complex systems
![Page 3: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/3.jpg)
DiversityDiversity
Why not just one “perfect” high-level language?
Flexibility trades off analyzabilityGeneral-purpose languages (e.g., assembly)
difficult to check or synthesize efficiently.
Solution: Domain-specific languages
![Page 4: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/4.jpg)
Domain-specific languagesDomain-specific languages
Language embodies methodology
VerilogModel system and testbench
Multi-rate signal processing languagesBlocks with fixed I/O rates
Java’s concurrencyThreads plus per-object locks to ensure atomic
access
![Page 5: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/5.jpg)
Types of LanguagesTypes of Languages
HardwareStructural and procedural stylesUnbuffered “wire” communicationDiscrete-event semantics
SoftwareProceduralSome concurrencyMemory
DataflowPractical for signal processingConcurrency + buffered communication
HybridMixture of other ideas
![Page 6: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/6.jpg)
Hardware LanguagesHardware Languages
Goal: specify connected gates concisely
Originally targeted at simulation
Discrete event semantics skip idle portions
Mixture of structural and procedural modeling
![Page 7: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/7.jpg)
Hardware LanguagesHardware Languages
VerilogStructural and procedural modelingFour-valued vectorsGate and transistor primitivesLess flexibleSuccinct
VHDLStructural and procedural modelingFew built-in types; powerful type systemFewer built-in features for hardware modelingMore flexibleVerbose
![Page 8: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/8.jpg)
Hardware methodologyHardware methodology
Partition system into functional blocks
FSMs, datapath, combinational logic
Develop, test, and assemble
Simulate to verify correctness
Synthesize to generate netlist
![Page 9: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/9.jpg)
VerilogVerilog
Started in 1984 as input to event-driven simulator designed to beat gate-level simulators
Netlist-like hierarchical structure
Communicating concurrent processes
Wires for structural communication, Regs for procedural communication
![Page 10: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/10.jpg)
Verilog: Software CommunicationVerilog: Software Communication
Four-valued scalar or vector “register”
reg alu_carry_out; reg [31:0] alu_operand;
Does not always correspond to a latch Actually shared memory Semantics are convenient for simulation Value set by procedural assignment:
always @(posedge clk) count = count + 1;
![Page 11: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/11.jpg)
Verilog: Procedural codeVerilog: Procedural code
Concurrently-running processes communicating through regs
reg [1:0] state; reg high, farm, start;
always @(posedge clk)begin case (state) HG: begin high = GREEN; farm = RED; start = 0; if (car && long) begin start = 1; state = HY; end end
![Page 12: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/12.jpg)
Verilog: Event controlVerilog: Event control
Wait for time
#10 a = 0;
Wait for a change:
@(b or c); a = b + c;
Wait for an event:
@(posedge clk); q = d;
![Page 13: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/13.jpg)
Verilog: Blocking vs. Non-blockingVerilog: Blocking vs. Non-blocking
Blocking assignments happen immediately
a = 5; c = a; // c now contains 5
Non-blocking assignments happen at the end of the current instant
a <= 5; c <= a; // c gets a’s old value
Non-blocking good for flip-flops
![Page 14: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/14.jpg)
VHDLVHDL
Designed for everything from switch to board-level modeling and simulation
Also has event-driven semantics
Fewer digital-logic-specific constructs than Verilog
More flexible languagePowerful type systemMore access to event-driven machinery
![Page 15: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/15.jpg)
VHDL: CommunicationVHDL: Communication
Processes communicate through resolved signals:
architecture Structure of mux2 is signal i1, i2 : Bit;
Processes may also use local variables:
process variable count := Bit_Vector (3 downto 0); begin count := count + 1;
![Page 16: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/16.jpg)
VHDL: The wait statementVHDL: The wait statement
Wait for a change
wait on A, B;
Wait for a condition
wait on Clk until Clk = ‘1’;
Wait with timeout
wait for 10ns; wait on Clk until Clk = ‘1’ for 10ns;
![Page 17: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/17.jpg)
Verilog and VHDL ComparedVerilog and VHDL ComparedVerilog VHDL
Structure Hierarchy Separate interfaces Concurrency Switch-level modeling Gate-level modeling Dataflow modeling Procedural modeling
Type system Event access
Local variables Shared memory Wires Resolution functions
![Page 18: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/18.jpg)
Software LanguagesSoftware Languages
Goal: specify machine code conciselySequential semantics:
Perform this operationChange system state
Raising abstraction: symbols, expressions, control-flow, functions, objects, templates, garbage collection
![Page 19: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/19.jpg)
Software LanguagesSoftware Languages
CAdds types, expressions, control, functions
C++Adds classes, inheritance, namespaces,
templates, exceptions
JavaAdds automatic garbage collection, threadsRemoves bare pointers, multiple inheritance
Real-Time Operating SystemsAdd concurrency, timing control
![Page 20: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/20.jpg)
Software methodologySoftware methodology
CDivide into recursive functions
C++Divide into objects (data and methods)
JavaDivide into objects, threads
RTOSDivide into processes, assign priorities
![Page 21: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/21.jpg)
The C LanguageThe C Language
“Structured Assembly Language”
Expressions with named variables, arrays
a = b + c[10];
Control-flow (conditionals, loops)
for (i=0; i<10; i++) { … }
Recursive Functions
int fib(int x) { return x = 0 ? 1 : fib(x-1) + fib(x-2); }
![Page 22: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/22.jpg)
The C Language: DeclarationsThe C Language: Declarations
Specifier + Declarator syntax for declarations
unsigned int *a[10];
Specifier: base type and modifiers
Base types match the processor’s natural ones
Declarator: How to reference the base type (array, pointer, function)
![Page 23: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/23.jpg)
The C Language: Storage ClassesThe C Language: Storage Classes
Stack: Allocated and released when functions are called/return
Saves space, enables recursion
Heap: Allocated/freed by malloc(), free() in any order.
Flexible, slow, error-prone, can become fragmented
Static: Allocated when program is compiled, always present
![Page 24: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/24.jpg)
C++: ClassesC++: Classes
C with added structuring features
Classes: Binding functions to data types
class Shape { int x,y; void move(dx, dy) { x += dx; y += dy; }};
Shape b;b.move(10,20);
![Page 25: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/25.jpg)
C++: InheritanceC++: Inheritance
Inheritance: New types from existing ones
class Rectangle : public Shape { int h, w; void resize(hh, ww) { h = hh; w = ww; }};
Rectangle c;c.resize(5,20);c.move(10,20);
![Page 26: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/26.jpg)
C++: TemplatesC++: Templates
Macros parameterized by types
template <class T> void sort(T* ar){ // … T tmp; tmp = ar[i]; // …}
int a[10];sort(a); // Creates sort<int>
![Page 27: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/27.jpg)
C++: ExceptionsC++: Exceptions
Handle deeply-nested error conditions:
class MyException {}; // Define exception
void bar(){ throw MyException; // Throw exception}
void foo() { try { bar(); } catch (MyException e) { … } // Handle}
![Page 28: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/28.jpg)
C++: Operator OverloadingC++: Operator Overloading
Use expression-like syntax on new types
class Complex {…};Complex operator + (Complex &a, int b){ // ...}
Complex x, y;
x = y + 5; // uses operator +
![Page 29: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/29.jpg)
C++: Standard Template LibraryC++: Standard Template Library
Library of polymorphic data types with iterators, simple searching algorithms
vector: Variable-sized arraylist: Linked listmap: Associative arrayqueue: Variable-sized queuestring: Variable-sized character strings with
memory management
![Page 30: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/30.jpg)
Java: Simplified C++Java: Simplified C++
Simpler, higher-level C++-like language
Standard type sizes fixed (e.g., int is 32 bits)
No pointers: Object references only
Automatic garbage collection
No multiple inheritance except for interfaces: method declarations without definitions
![Page 31: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/31.jpg)
Java ThreadsJava Threads
Threads have direct language support
Object::wait() causes a thread to suspend itself and add itself to the object’s wait set
sleep() suspends a thread for a specified time period
Object::notify(), notifyAll() awakens one or all threads waiting on the object
yield() forces a context switch
![Page 32: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/32.jpg)
Java Locks/SemaphoresJava Locks/Semaphores
Every Java object has a lock that at most one thread can acquire
Synchronized statements or methods wait to acquire the lock before running
Only locks out other synchronized code: programmer responsible for ensuring safety
public static void abs(int[] values) { synchronized (values) { for (int i = 0; i < values.length; i++) if (values[i] < 0) values[i] = -values[i]; }}
![Page 33: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/33.jpg)
Java Thread ExampleJava Thread Example
Class OnePlace { Element value;
public synchronized void write(Element e) { while (value != null) wait(); value = e; notifyAll(); }
public synchronized Element read() { while (value == null) wait(); Element e = value; value = null; notifyAll(); return e; }}
synchronized acquires lock
wait suspends thread
notifyAll awakens all waiting threads
![Page 34: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/34.jpg)
Java: Thread SchedulingJava: Thread Scheduling
Scheduling algorithm vaguely definedMade it easier to implement using existing
thread packages
Threads have priorities
Lower-priority threads guaranteed to run when higher-priority threads are blocked
No guarantee of fairness among equal-priority threads
![Page 35: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/35.jpg)
Real-Time Operating SystemsReal-Time Operating Systems
Provides concurrency to sequential languages
Idea: processes handle function, operating system handles timing
Predictability, responsiveness main criteria
![Page 36: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/36.jpg)
RTOS schedulingRTOS scheduling
Fixed-priority preemptive
Sacrifices fairness to reduce context-switching overhead
Meeting deadlines more important
Process preempted when higher-priority process is activated
Process otherwise runs until it suspends
![Page 37: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/37.jpg)
RTOS SchedulingRTOS Scheduling
Highest-priority task always running Equal-priority tasks sometimes timesliced
1
2
3
![Page 38: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/38.jpg)
Rate Monotonic AnalysisRate Monotonic Analysis
Common priority assignment scheme
System model:Tasks invoked periodicallyEach runs for some fraction of their periodAsynchronous: unrelated periods, phases
Rate Monotonic Analysis:Assign highest priorities to tasks with smallest
periods
![Page 39: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/39.jpg)
Priority InversionPriority Inversion
Deadlock arising when tasks compete for shared resources
1
2
Task 2 acquires lock on shared resource
Task 1 preempts task 2
Task 1 deadlocks trying to acquire lock since Task 2 is preempted
One solution: priority inheritance
Task 2 given higher priority while it has the lock
![Page 40: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/40.jpg)
Software languages comparedSoftware languages compared
C C++ Java RTOSExpressions Control-flow Recursive functions Exceptions Classes, Inheritance Multiple inheritance
Operator Overloading Templates Namespaces Garbage collection
Threads, Locks
![Page 41: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/41.jpg)
Dataflow LanguagesDataflow Languages
Best for signal processing
Bufferedpoint-to-point communication Concurrent
processes exchange data
![Page 42: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/42.jpg)
Dataflow LanguagesDataflow Languages
Kahn Process NetworksConcurrently-running sequential processesBlocking read, non-blocking writeVery flexible, hard to schedule
Synchronous DataflowRestriction of Kahn NetworksFixed communicationEasy to schedule
![Page 43: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/43.jpg)
Dataflow: mudanca de perspectiva!Dataflow: mudanca de perspectiva!
Outras linguagens: voltadas à ação dataflow: perspectiva do DADO Exemplo: Silage
restrições de tempo-realrestrições de precisão numérica (digital noise)processamento de sinais e controle: decisão
do símbolo, decisão do algortimooferecer abstração, mas também informações
explícitas para ótima implementação a = b+c+c
semântica comportamental: 2´ssemântica implementação: 3 somadores
distintos
![Page 44: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/44.jpg)
Porque não proceduraisPorque não procedurais
Paralelismo difícil de ser extraídoexplicitado pelo usuário; HW-C, MIMOLA,
PASCAL, SDLa exploração do espaço de projeto pode ficart
limitada; as semânticas de implementação serão válidas?
DSP: paralelismo de fina granularidade pode ser BEM explorado
Silagefix <16,6>signal == valores continuos amostrados a
intervalos constantessinal definido por equação, não por comando
![Page 45: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/45.jpg)
Ao invés da equação ...Ao invés da equação ...
while(true){ // infinite loop through inputsbuffer[entry] = FemtoJavaIO.read(0);if (entry<(size-1)) entry++;else entry = 0;sum = 0;for (j=0;j<size; j++) {//coefficient control loop
if (entry+j>(size-1)) {sum = sum + (coef[j]*buffer[entry+j-
size]);}else {
sum = sum + (coef[j]*buffer[entry+j]);}}//end for
FemtoJavaIO.write( sum , 1 );i++;
}//end while
![Page 46: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/46.jpg)
Escreve-seEscreve-se
sum[0]=0;(i:0..N):: sum[i+1] = sum[i] + c[i] * in@i;y = sum[N+1];
OBS: data structure != memory structure multirate: interpolate, decimate, switch
![Page 47: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/47.jpg)
Dataflow methodologyDataflow methodology
Kahn:Write code for each processTest by running
SDF:Assemble primitives: adders, downsamplersScheduleGenerate codeSimulate
![Page 48: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/48.jpg)
Kahn Process NetworksKahn Process Networks
Processes are concurrent C-like functions Communicate through blocking read,
nonblocking write
/* Alternately copy u and v to w, printing each */process f(in int u, in int v, out int w){ int i; bool b = true; for (;;) { i = b ? wait(u) : wait(w); printf("%i\n", i); send(i, w); b = !b; }}
Wait for next input on port
Send data on given port
![Page 49: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/49.jpg)
Kahn Networks: DeterminacyKahn Networks: Determinacy
Sequences of communicated data does not depend on relative process execution speeds
A process cannot check whether data is available before attempting a read
A process cannot wait for data on more than one port at a time
Therefore, order of reads, writes depend only on data, not its arrival time
Single process reads or writes each channel
![Page 50: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/50.jpg)
Kahn Processes: SchedulingKahn Processes: Scheduling
Relative rates the challenge
Which process should run next?
?
?
??
?
One solution: Start with bounded buffers. Increase the size of the smallest buffer when buffer-full deadlock occurs.
![Page 51: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/51.jpg)
Synchronous DataflowSynchronous Dataflow
Each process has a firing rule:Consumes and produces a fixed number of
tokens every time Predictable communication: easy scheduling Well-suited for multi-rate signal processing A subset of Kahn Networks: deterministic
1 2
2
1
1
1
3 2
Initial token (delay)
![Page 52: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/52.jpg)
SDF Scheduling 1SDF Scheduling 1
Each arc imposes a rate constraint
Solving the system answers how many times each actor fires per cycle
Valid schedule: any one that fires actors this many times without underflow
A75
B 5A = 7B
![Page 53: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/53.jpg)
SDF Scheduling 2SDF Scheduling 2
Code generation produces nested loops with each block’s code inlined
Best code size comes from single-appearance schedule
A
B
C
322
3 3
1
D
1
412
6
(3B)C(4D)(2A)
(3BD)BCA(2D)A
SAS: minimum code size
Smaller buffer memory
![Page 54: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/54.jpg)
Dataflow languages comparedDataflow languages compared
Kahn SDFConcurrent FIFO communication Deterministic Data dependent behavior Fixed rates Statically schedulable
![Page 55: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/55.jpg)
Hybrid LanguagesHybrid Languages
A mixture of ideas from other more “pure” languages
Amenable to both hardware and software implementation
![Page 56: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/56.jpg)
Hybrid LanguagesHybrid Languages
EsterelSynchronous hardware model with software
control-flow Polis
Finite state machine plus datapath for hardware/software implementation
SDLBuffered communicating finite-state machines
for protocols in software SystemC
System modeling in C++, allowing refinement CoCentricTM System Studio
Dataflow plus Esterel-like synchrony
![Page 57: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/57.jpg)
Hybrid MethodologiesHybrid Methodologies
EsterelDivide into processes, behaviorsUse preemption
PolisDivide into small processes, dataflowPartition: select hardware or software for eachSimulate or synthesize
SDLDivide into processesDefine channels, messages passed along eachCreate FSM for each process
![Page 58: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/58.jpg)
Hybrid MethodologiesHybrid Methodologies
SystemCStart with arbitrary C and refineDivide into processesCombine hierarchicallySimulate, Synthesize
CoCentricTM System StudioAssemble standard componentsAdd custom dataflow, control subsystemsAssemble hierarchicallySimulate, possibly embedded in another
simulator
![Page 59: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/59.jpg)
Esterel: Model of TimeEsterel: Model of Time
Like synchronous digital logicUses a global clock
Precise control over which events appear in which clock cycles
Global clock
Computation
Inputs ready
Outputs produced
![Page 60: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/60.jpg)
EsterelEsterel
every RESET doevery RESET do looploop await A;await A; emit B;emit B; present C then emit D end;present C then emit D end; pausepause endend|||| looploop present B then emit C end;present B then emit C end; pausepause endendendend
Wait for next cycle with A present
Infinite loop
Run concurrently
Same-cycle bidirectional
communication
Restart when RESET present
![Page 61: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/61.jpg)
Esterel PreemptionEsterel Preemption
Preempt the body before it runs
Terminate the body after it runs
Restart the body before it runs
abort bodywhen condition
weak abort bodywhen condition
every condition do bodyend
Bodies may be concurrent
![Page 62: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/62.jpg)
Esterel Suspend statementEsterel Suspend statement
Strong preemption Does not terminate its body
suspend loop emit A; pause; emit B; pause endwhen C
A A B
CC
B A AB
![Page 63: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/63.jpg)
Esterel ExceptionsEsterel Exceptions
Exceptions a form of weak preemption
Exit taken after peer threads have run
Here, A and B are emitted in the second cycle
trap T in
pause; emit A|| pause; exit T
handle T do emit Bend
![Page 64: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/64.jpg)
PolisPolis
+
1 - 1 - 0 a b0 0 - - - b c1 1 - - - b d- 1 - 0 - a c- 0 - 1 - b d
Single-place input buffers
Datapath elements
Reactive finite-state machines defined by tables
![Page 65: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/65.jpg)
Polis communicationPolis communication
Channels convey either values or events
Only events cause CFSM transitions, but a CFSM can also read a value
A CFSM consumes all its events after each transition
![Page 66: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/66.jpg)
Polis SemanticsPolis Semantics
Communication time is arbitrary
CFSM computation time is non-zero, but arbitrary
Events that arrive while a CFSM is transitioning are ignored
The event in a valued event is read before its presence/absence, value is written first
![Page 67: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/67.jpg)
Polis SynthesisPolis Synthesis
Software synthesis
Each CFSM becomes a process running under an RTOS
Buffers in shared memory
Hardware synthesis
Each CFSM is a state machineTransitions are taken in a single clock periodInputs are latched
![Page 68: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/68.jpg)
SDLSDL
Concurrent FSMs, each with a single input buffer
a b resetFinite-state machines defined using flowchart notation
Communication channels define what signals they carry
![Page 69: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/69.jpg)
SDL SymbolsSDL Symbols
B
s<3
s=s+1
Wait
B
NextNext
Wait
A
C
C D
State
Receive
Save
Output
Task
Decision
![Page 70: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/70.jpg)
SystemCSystemC
struct complex_mult : sc_module { sc_in<int> a, b; sc_in<int> c, d; sc_out<int> x, y; sc_in_clk clock;
void do_mult() { for (;;) { x = a * c - b * d; wait(); y = a * d + b * c; wait(); } }
SC_CTOR(complex_mult) { SC_CTHREAD(do_mult, clock.pos()); }};
Modules with ports and internal signals
Imperative code with wait statements Instances of
processes, other modules.
![Page 71: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/71.jpg)
SystemC SemanticsSystemC Semantics
Multiple synchronous domains Synchronous processes run when their clock
occurs. Asynchronous processes react to output
changes, run until stable
Sync. Async. Clock
![Page 72: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/72.jpg)
SystemC Libraries and CompilerSystemC Libraries and Compiler
SystemC librariesC++ Class libraries & thread packageAllows SystemC models to be compiled and
simulated using standard C++ compilerFreely available at www.systemc.org
CoCentricTM SystemC CompilerCompiles SystemC models into optimized
hardwareCommercial product from Synopsys
![Page 73: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/73.jpg)
CoCentricTM System StudioCoCentricTM System Studio
Hierarchy of dataflow and FSM models
Kahn-like Dataflow
OR models: FSMsR || N && Q
AND models: Esterel-like synchronous concurrency
![Page 74: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/74.jpg)
CoCentricTM System StudioCoCentricTM System Studio
AND modelsConcurrent with Esterel-like semanticsSignals read after they are written
OR modelsFinite-state machinesWeak transitions: tested after the state’s
action is performedStrong transitions: tested before the actionImmediate transitions: tested when the state is
entered. Disables the action if true
![Page 75: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/75.jpg)
CoCentric System Studio: DataflowCoCentric System Studio: Dataflow
Fixed or variable rate
Static and dynamic scheduling
“Prim” models describe Kahn-like dataflow processes in a C++ subset
CCSS attempts to determine static communication patterns
prim_model adder{ type_param T = int; port in T In1; port in T In2; port out T Sum; main_action { read(In1); read(In2); Sum = In1 + In2; write(Sum); }}
![Page 76: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/76.jpg)
Hybrid Languages ComparedHybrid Languages Compared
Esterel Polis SDL SystemC CCSSConcurrent Hierarchy Preemption Deterministic
Synchronous comm. Buffered comm. FIFO communication
Procedural Finite-state machines Dataflow Multi-rate dataflow
Software implement. Hardware implement.
![Page 77: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/77.jpg)
ConclusionsConclusions
Many types of languagesEach with its own strengths and weaknessesNone clearly “the best”Each problem has its own best language
Hardware languages focus on structureVerilog, VHDL
Software languages focus on sequencingAssembly, C, C++, Java, RTOSes
Dataflow languages focus on moving dataKahn, SDF
Others a mixtureEsterel, Polis, SDL, SystemC, System Studio
![Page 78: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/78.jpg)
Outros caminhosOutros caminhos
Ligar duas linguagens: SDL e UML (2000) projeto MATCH: tudo é Matlab (99) streamIt: Java como frontend de streams
(2000)
linguagem=expressividade=abstração linguagem=guia de implementação resolve-se a contradição? o equilíbrio já existe ou ainda há espaço para
pesquisa?
![Page 79: Scaling the Abstraction Cliff: High-Level Languages for System Design Stephen A. Edwards Synopsys, USA Luciano Lavagno University of Udine, Italy devidamente](https://reader030.vdocuments.mx/reader030/viewer/2022032523/56649d805503460f94a63f26/html5/thumbnails/79.jpg)
Shameless PlugShameless Plug
All of these languages are discussed in greater detail in
Stephen A. EdwardsLanguages for Digital Embedded SystemsKluwer 2000