Top Banner
Software Synthesis and Co-Design based on an Asynchronous Concurrency Model Bill Lin Electrical and Computer Engineering University of California, San Diego [email protected]
33

Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Jul 07, 2018

Download

Documents

hakhanh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Software Synthesis and Co-Designbased on an Asynchronous

Concurrency Model

Bill LinElectrical and Computer EngineeringUniversity of California, San Diego

[email protected]

Page 2: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Acknowledgments

• Industrial interactions– Qualcomm Inc.– Hughes Network Systems– Nokia Design Center

• Group members:– Ranjita Bhagwan– James Hurt– Andrew May– Xin Wang– Xiaohan Zhu

Picasso Project

Page 3: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Billion Transistors Era

TI’s roadmap for 2001 [EB News, 8/31/98]• 0.07µm effective channel length• Copper interconnect• 1 GHz clock frequencyF 400 million transistors on a single chip!

ARM9TDMI, latest 32-bit ARM RISC CPU• 111K transistorsF 400 million transistors = 3,603 ARM9 CPUs

Page 4: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

System-on-a-Chip

Single-Chip Digital Baseband Processor

Page 5: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Outline

• Model of computation• Software synthesis• Hardware synthesis• Hardware/software co-design

Page 6: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Models of ComputationUser’s Perspective

• Java, Modula-3, Ada, Occam (CSP) …• used for concurrent software• supported by multi-tasking OS

• VHDL, Verilog: hardware• Esterel: reactive programming software synthesis, logic synthesis

• DSP designs• hardware: Cathedral, Hyper, …• system synthesis, software: Ptolemy, Cossap, SPW, ...

Asynchronous Models

Synchronous Models Data-Flow Models

Page 7: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Programming Model

• Model = “C” + CSP– C-like basic constructs: easy to learn.– CSP (Concurrent Sequential Processes) [Hoare’85]

model of concurrency and communication. Formallyand rigorously defined.

Communication: send and receive along channels

Page 8: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Programming Model

P1 (input chan(int) a, output chan(int) b){ int x, t; for (;;) { x = <-a; // receive if (x < 0) { x = 10 - x; } else { x = 10 + x; } b<- = x; // send }}

P2 (input chan(int) b, output chan(int) a){ int y, z = 0; for (;;) { a<- = 10; // send y = <-b; // receive z = (z + y) % 345; }}

P1 P2

Page 9: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Programming Model

• True concurrent threads of control withconditional execution and data-dependent loops

• Can model both control and data computations

Page 10: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Outline

• Model of computation• Software synthesis• Hardware synthesis• Hardware/software co-design

Page 11: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Traditional Approach

• Real-Time Operating Systems (RTOS) widelyused to support multi-tasking, but …

• Alternative approach: statically schedule thecomputation at compile-time

CPU

RTOS

Task Task Task...Context-switching

and communication= performance

overhead

On-chipRAM = $$$

Portabilitydepends

on RTOS

Page 12: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Main Contribution

• Static scheduling– Input: CSP-based model– Output: Ordinary sequential C

• Advantages– Portable to different processors with conventional C

compilers– Avoids memory and performance overhead of RTOS– Compiler optimizations across processes

Page 13: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Intermediate Representation

• Hierarchical construction using Petri net algebra[DAC’94, ISSS’97]

a<-=10

p2

y=<-b

x=<-a

p1

b<-=x

p2

y=x

x=10

p1

Page 14: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Synthesis Procedure

• Systematically generate acyclic Petri net segments• Statically schedule operations (transitions) in each

segment• Generate control-flow graph induced by static

schedule• Generate C code from the control-flow graph

Page 15: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Maximal Expansions

• Cut-off places correspond to set of placesencountered when a cycle has been reached

• Corresponding acyclic Petri net segment is calleda Maximal Expansion with respect to m

ap1

b d

c e

gp2

hp3

p4k

l

i

j

f

ap1

b d

c e

gp2

hp3

p4k

l

i

j

fp2’p1’ p3’

Cut-offplaces

Page 16: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Cut-Off Markings

• Reachable markings from m with no enabledtransitions: CM(E)

• e.g. m = (p1,p2), CM(E) = { (p1,p2), (p3,p4) }

a

p1

b d

c e

g

p2

h

p3

p4

k

l

i

j

f

p2’p1’ p3’

a

p1

b d

c e

g

p2

h

p3

p4

k

l

i

j

f

p2’p1’ p3’

Cut-offmarking

Page 17: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Expansion on New Markings

• Until no new cut-off markings. Convergenceguaranteed. e.g. m = (p3,p4), CM(E) = {(p3,p4)}.Stop.

ap1

b d

c e

hp3

p4’

k

l

i

j

f

gp2

p3’

p4

ap1

b d

c e

hp3

p4’

k

l

i

j

f

gp2

p3’

p4

ap1

b d

c e

hp3

p4’

k

l

i

j

f

gp2

p3’

p4

Page 18: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Static Schedule

• Definition: π : T -> N such that if t1 precedes t2,then π(t1) < π(t2)

a

p1

b d

c e

g

p2

h

p3

p4k

l

i

j

f

p2’p1’ p3’

a g

b h

c i c k e i e k

d h

j l

p1p2

f p3p4

• Given π, use modifiedPetri net firing rules togenerate reachability graph

Page 19: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Optimized Code Generation

• Code optimization across processes possible

• Sophisticated state-of-the-art optimizing Ccompilers can exploit instruction-level parallelism(e.g. super-scalar, pipelined, VLIW, EPIC CPUs)

generated-program ( ){ int x, y, z = 0;p1p2: x = 10; if (x < 10) x = 10 - x; else x = 10 + x; y = x; z = (z + y) % 345; goto p1p2;}

generated-program ( ){ int z = 0;p1p2: z = (z + 20) % 345; goto p1p2;}

e.g. after constant propagation

Page 20: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Experimental Results

• RC5 encryption chain example

• Contains data-dependent loops and mixed control-data computations

RC5EncryptIn

Out RC5Decrypt

...// r = # of roundswhile (i <= r) { A=ROTL(A^B,A)+S[2*i]; B=ROTL(B^A,B)+S[2*i+1]; i++;}...

Page 21: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Implementation and Results

• Implementation: C generator– Synthesis = pre-processor to C– Threads = multi-tasking using C + Solaris Threads (can

port to other thread packages or RTOS)

• ResultsSize ThreadsSynthesis

2MB8MB

32MB

34.7103.5554.5

2.06.1

21.7Rate 58KB/s1.51MB/s

Page 22: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Java Generator

• Synthesis– Generate Java instead of C– No usage of Java Threads and Monitors– Only need (Embedded) Java VM “minus” Java Threads

and Monitors

• Threads– Processes and channels mapped to Java Threads and

Monitors– Need Java VM that supports Java Threads and

Monitors

Page 23: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Outline

• Model of computation• Software synthesis• Hardware synthesis• Hardware/software co-design

Page 24: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Hardware Synthesis

• Procedure– Group processes together into Petri nets (degenerate

case: one process, one Petri net)

– Apply handshake expansion to each Petri net forexternal communications

– Apply static scheduling of each Petri net to synthesizestate machine

– Convert state machine to behavioral VHDL (Verilog)– Apply VHDL (Verilog) synthesis

P1

P2

P3N1 N2

Page 25: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Handshake Expansion

• Examples:– request / acknowledge protocol– sender_ready / receiver_ready protocol– on-chip bus protocols

P1 P2chan

C1 C2reqack

data

Page 26: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Hardware Synthesis

• Commercial tools based on earlier high-levelsynthesis research– IMEC, Berkeley, IBM, Irvine, CMU, USC, …

• Cycle-true synthesis (high-level RT synthesis)– retains one-to-one correspondence between states and

clock cycles

• Behavioral synthesis– introduces “micro-cycles” as extra degree of freedom

Page 27: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Embedding VHDL / Verilog

• Embedded VHDL /Verilog component isencapsulated usinghandshake protocol

native P1(input chan(int) a, b, output chan(int) c);

native P4(input chan(int) a);

P2(input chan(int) a, output chan(int) b, c) { …}

P3(input chan(int) a, output chan(int) b, c) { …}

system (input chan(int) cin, output chan(int) cout){ chan(int) c1, c2, c3; par { P1 (cin, c1, c2); P2 (c2, c1, c3); P3 (c3, c4, cout); }}

P2

P3

P1cin

cout

c1

c2

c3

c4

Page 28: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Outline

• Model of computation• Software synthesis• Hardware synthesis• Hardware/software co-design

Page 29: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Problem

DSP core ProgramRAM µP core

I/O drivers real-time OS

task ...

ASICCircuitry

High-SpeedHW

accelerators

Glue Logic

applicationprogram

ProgramRAM

DataRAM

task task

A/D&

D/A

Host interface

EmbeddedReal-TimeSoftware

Hardware:Gates &Macros

Page 30: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

CoWare Approach

ASICM

I/O unit

System architecture

µPM

I/O unit

Drivers RTOS Interface

“C”app. code C “VHDL”

app.

DSP

φ1=100Mhz

φ2=200Mhz

...

... C

ASIC

Interface

“VHDL”app.

M

C VHDL

C VHDL

CoWare = C compilation + HDL synthesis+ Interface Synthesis

[IEEE’97, DAES’97, DAC’96, EuroDAC’96]

Page 31: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

New Approach

• Permits direct programming of software andhardware components when appropriate

• Permits the embedding of C / Java and VHDL /Verilog for the development of software andhardware components, respectively, whenappropriate

• Permits the use of model as a scripting languageto glue together components, including non-trivialglue logic behavior

• Builds upon interface synthesis and co-simulationsolutions from CoWare project

Page 32: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Putting it all Together

Concurrent Specification,including embedding of C / Java code

and VHDL / Verilog components

VHDL / VerilogSynthesis

C / JavaCompilation

Interface Synthesis

SoftwareSynthesis

HardwareSynthesis

Page 33: Software Synthesis and Co-Design based on an …embedded.eecs.berkeley.edu/esd-seminar/fall98/slides/lin.pdf · Software Synthesis and Co-Design based on an Asynchronous Concurrency

Thank [email protected]