123
Async2000, April, Eilat Balsa Demonstration - 1 Balsa – Live @Eilat.fun A Hands-on Tutorial Session Doug Edwards & A. Bardsley

Balsa – Live @Eilat.fun

  • Upload
    doria

  • View
    51

  • Download
    0

Embed Size (px)

DESCRIPTION

Balsa – Live @Eilat.fun. A Hands-on Tutorial Session Doug Edwards & A. Bardsley. Overview of Session. Balsa for Dummies Toolkit Language Features mini examples with hand-holding DIY Example Stack-based Calculator compile balsa & simulate locally generate xilinx bit stream in Manchester - PowerPoint PPT Presentation

Citation preview

Page 1: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 1

Balsa – Live @Eilat.fun

A Hands-on Tutorial SessionDoug Edwards & A. Bardsley

Page 2: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 2

Overview of Session

Balsa for Dummies• Toolkit• Language Features• mini examples with hand-holding

DIY Example• Stack-based Calculator

– compile balsa & simulate locally– generate xilinx bit stream in Manchester– run on xilinx prototyping board

Page 3: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 3

Staff involved in Demonstration

Doug Edwards• presenter

John Bainbridge• demonstrator

Andrew Bardsley• principal author

– (in Manchester !!)

Page 4: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 4

What is Balsa?

Language for synthesising large async circuits & systems

CSP/OCCAM background Tangram-like

• based on Tangram compilation function• compiles to a small (but expanding) set of

handshake circuits• origins: ESPRIT 6143 EXACT project

Page 5: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 5

Handshake circuits – 1

Circuits communicate along channels Channels connect ports at circuit interfaces Ports have:

• Type• Direction• Sense

Page 6: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 6

Handshake Circuits – 2

Port type determines the number of data wires• no data wires == control only port!

Port direction is input, output or control only Port sense

• Active: initiate transfers• Passive: respond to requests

Page 7: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 7

Pull Circuits – active inputs

Pull Circuits:

active ported circuits/ control driven req

ack

datacct

req

ack

data

active input port

Page 8: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 8

Pull Circuits

Pull Circuits:

Circuit demands datareq

ack

datacct

req

ack

data

Page 9: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 9

Pull Circuits

Pull Circuits:

data is suppliedreq

ack

datacct

req

ack

data

Page 10: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 10

Pull Circuits

Pull Circuits:

validity is signalledreq

ack

datacct

req

ack

data

Page 11: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 11

Pull Circuits

Pull Circuits:

data is accepted and can then be released req

ack

datacct

req

ack

data

Page 12: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 12

Pull Circuits

Pull Circuits:

circuit outputs datareq

ack

datacct

req

ack

data

Page 13: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 13

Pull Circuits

Pull Circuits:

circuit signals validity of data req

ack

datacct

req

ack

data

Page 14: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 14

Pull Circuits

Pull Circuits:

data is acceptedreq

ack

datacct

req

ack

data

Page 15: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 15

Pull Circuits

Pull Circuits:

data is releasedreq

ack

datacct

req

ack

data

Page 16: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 16

Pull Circuits

Pull Circuits:

ack is de-assertedreq

ack

datacct

req

ack

data

Page 17: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 17

Tool Overview

balsa-mgr – GUI project manager

balsa-md – makefile generator

compilation toolssimulation toolstech mapping toolsutility tools

Page 18: Balsa – Live @Eilat.fun

Design Flow

Page 19: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 19

Compilation Tools

balsa-c• compiles balsa programs to breeze• includes other breeze definition files

– breeze is a handshake -circuit netlist format– acts as a library format for within Balsa

balsa-netlist• produces an EDIF netlist from a compiled balsa

program– technology independent

Page 20: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 20

Simulation Tools

breeze2lard• produces a lard simulation file

various lard utilities• mainly hidden within the Makefile by

balsa-md

Page 21: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 21

Tech Mapping Tools – 1

Silicon back-ends• Compass

– used in Amulet3 DMA controller

• AMS 0.35 µ library within Cadence– in progress, but …

• SGS 0.18µ– now available

Page 22: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 22

Tech Mapping Tools – 2

Programmable Gate-Array back-ends• balsa-pv

– generates powerview schematics & symbols– uses Viewlogic tools

• balsa-xi– compiles design + test harness to xilinx parts– requires Xilinx tools

Page 23: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 23

Xilinx Families Supported

xilinx 4000e (used here)• runs on in-house prototyping boards • not optimised, will not be supported

xilinx virtex devices• future target for development• targeted at commercially available boards

– XSV boards from Xess corp– 50K-800K gates @ $700-$1600– 2Mbyte on board ram + peripherals

Page 24: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 24

Utilitity Tools

breeze2ps• creates a ps handshake circuit graph

breeze-cost• enumerates the handshake circuit used and

gives an approximate area cost balsa-md

• automatic Makefile maker balsa-mgr

Page 25: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 25

Balsa Language Features

Data types based on sequence of bits• Arrays and records are bit-based• Element extraction is by array slicing• Strict data typing

Structural iteration Arrayed channels Parameterised & recursive functions

Page 26: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 26

Balsa Language Features

Enclosed selection semantics• Allows passive ported circuits• Allows push (micropipeline-style) circuits• Allows un-buffered (latch-free) circuits

Page 27: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 27

Exercise 1a: Hello World

Objective: understanding & compiling the simplest balsa program

go to directory ~/Balsa/Buffers open file buffer1a.balsa

(using your favourite editor)

Page 28: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 28

Example: Single Place Buffer

import [balsa.types.basic]

public

type word is 16 bits

procedure buffer (input i : word; output o : word) is

local variable x : word

begin

loop

i -> x; -- Input communication

o <- x -- Output communication

end

end

librarymechanismvisibility

type declaration

channel declarations

proceduredefinition implies

latchrepeat foreversequential

operation

Page 29: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 29

Exercise 1b: Hello World

compile the program:balsa-c buffer1a

list the files created• (examine the files if really curious)

Page 30: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 30

Exercise 2a: 2-place buffer

Objective: illustration of parallel composition & modular compilation.

specify a 2-place buffer by composing two 1-place buffers

open file buffer2c.balsa

Page 31: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 31

Code for 2-place buffer

import [balsa.types.basic]

import [buffer1a]

public

-- NB type word is declared previously

procedure buffer2c (input i : word; output o : word) is

local channel c : word

begin

buffer (?, ?) ||

buffer (?, ?)

end

reusecomponent

buffers connected by common signal names

internal channelconnects two

1-place buffers

internal channelconnects two

1-place buffers

parallel composition

ii cc oo

Page 32: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 32

Exercise 2a: 2-place buffer

edit the buffer2c.balsa to replace the ‘?’s by appropriate channel names.

compile the program:balsa-c buffer2c

create a postscript plot of the handshake circuit graph & view itbreeze2ps buffer2c

gv buffer2c

Page 33: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 33

Code for 2-place buffer

import [balsa.types.basic]

import [buffer1a]

public

-- type word has been declared in buffer1a

procedure buffer2c (input i : word; output o : word) is

local channel c : word

begin

buffer (i, c) ||

buffer (c, o)

end

buffers connected by by common channel name

ii cc oo

Page 34: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 34

Exercise 2a: H/S Circuit Graph

Top Level ViewTop Level View

Page 35: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 35

Exercise 2b: A Flattened Circuit

Recompile the circuit & examine the handshake circuit produced:balsa-c -f buffer2c

breeze2ps buffer2c

gv buffer2c.ps

Page 36: Balsa – Live @Eilat.fun

Flattened ViewFlattened View

Page 37: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 37

Exercise 3a: A modulo-16 Counter

Objective: balsa type enforcement & simple use of balsa-md

go to directory ~/Balsa/Counters open file count16a.balsa

Page 38: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 38

Code for modulo-16 counter

procedure count16 (sync aclk; output count : nibble) is

local variable count_reg : nibble

begin

loop

sync aclk ;

count <- count_reg ;

count_reg := ( count_reg + 1 as nibble)

end

end

await h/son input

handshakeonly input

inc internalregister

cast result backto correct size

then output countfrom internal register

assign result backto internal variable

internalregister

Page 39: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 39

Exercise 3b: Simulation

Objective: Simple Simulation

Generate a Makefile with test-harness rulesbalsa-md -t count16 count16a

Examine the Makefile Run the simulation

make sim | more(terminate with Ctrl-C)

procedure nameprocedure name

generate a test harnessgenerate a test harness

Page 40: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 40

Exercise 3c: Simulation Results

Page 41: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 41

Exercise 3d: Graphical Simulation

Objective: using the LARD channel viewer

type make sim-win run the simulation

Page 42: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 42

Running the Simulation

Starting the simulation Stopping the simulation

Page 43: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 43

Lard Time View

Channel valuesChannel values

cursor sensitivecursor sensitivemessagesmessages

request (red)request (red)

ack (green)ack (green)

Page 44: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 44

Passive Inputs

By default, Balsa generates circuit fragments with active ports

The select statement generates circuit fragments with passive inputs• select is normally a choice operator, but can be

used with just a single input What is a passive port?

Page 45: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 45

Exercise 4a: A Passive Input Counter

Objective: Generate a counter with a passive input port

Open the file count16c.balsa

Page 46: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 46

Code for Count16c

procedure count16 (sync aclk; output count : nibble) is

local variable count_reg : nibble

begin

loop

select aclk then

count <- count_reg ;

count_reg := ( count_reg + 1 as nibble)

end

end

end

select usuallyoffers a choice but also select makes

aclk a passive i/p

Page 47: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 47

Exercise 4b: Simulating the Counter

Remove the previous compilationmake clean

Generate a new Makefile with a test-harness & run the simulation

balsa-md -t count16 count16c

make sim-win

Page 48: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 48

enclosing handhakeenclosing handhake

Page 49: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 49

Exercise 5a: A modulo-10 Counter

Open the file count10a.balsa

Page 50: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 50

procedure count10(sync aclk; output count: C_size) is

local

variable count_reg : C_size

variable tmp : C_size

begin

loop

select aclk then

if count_reg /= max_count then

tmp := (count_reg + 1 as C_size)

else

tmp := 0

end ;

count <- count_reg ;

count_reg := tmp

end -- complete select H/S

end -- loop end

end

Code for modulo-10 counter

C_size andmax_count previously

declared

if then elseconstruct

Page 51: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 51

Exercise 5b: A modulo-10 Counter

Modify the code so that the count value is output in parallel with updating register tmp

Compile the new description and simulate the design

make clean

balsa-md -t count10 count10amake sim-win

Page 52: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 52

Modified Code

procedure count10(sync aclk; output count: C_size) is

local

variable count_reg : C_size

variable tmp : C_size

begin

loop

select aclk then

if count_reg /= max_count then

tmp := (count_reg + 1 as C_size)

else

tmp := 0

end || count <- count_reg ;

count_reg := tmp

end -- complete select H/S

end -- loop end

end

update in parallel

Page 53: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 53

counter wraps

Page 54: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 54

Exercise 6a: Loadable Up/Down Cntr

Modulo-10 counter• choice of counting up or down• counter may be loaded with a value

Input consists of bundle with control & data• 4 bit data to be optionally loaded• single bit determining down/up• single bit determining load/count

Page 55: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 55

Exercise 6b: Defining data types:

Open file count10d.balsa Define an enumerated type dir:

type dir is enumeration

down, up

end

Define a type mode as an enumeration of load and count

Page 56: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 56

Exercise 6c: Record Structure

Define a type for the input bundle as a record structure• uses types previously defined

type In_bundle is record

ld_data : C_size ;

mode : mode;

dir : dir

end name space separation

Page 57: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 57

Exercise 6d: Completing the Design

if in_sigs.ld_ctrl = load then

count_reg := in_sigs.ld_data

else

case in_sigs.dir of

down then -- counting down

if count_reg /= 0 then

tmp := (count_reg - 1 as C_size)

else

tmp := max_count

end || count <- count_reg

| up then -- counting up

-- fill in this part of the choice

end ; -- end case

record field selector

case statement record field selectorchoice one

choice two

enter code

wrap count

Page 58: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 58

Exercise 6e: Simulation from File

Can generate a simulation test-harness that associate input channels with files

Examine file data Generate test-harness & run simulationmake cleanbalsa-md -t updown10 -D TESTOPTS “-f in_sigs data” count10d

make sim-win

Ignore eof error messageinput channel name name of data filevariable used in Makefile

Page 59: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 59

Simulation Data

{8, load, up} load the counter

{0, count, up} count to 9

{0, count, up} count & wrap to 0

{0, count, up} count to 1

{0, count, down} count down to 0

{0, count, down} count down

{0, count, down} count down

{0, count, down} count down

{0, count, down} count down

{0, count, down} count down

bundle record usingenumerated type

comments

Page 60: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 60

symbolic names preserved

Page 61: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 61

Exercise 7: Sharing Hardware

Balsa statements instantiate hardware• repeated statements cause duplication of gates

Minimise costs by eliminating duplication:• re-arrange code where possible• use shared procedures

Page 62: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 62

Sharing Hardware – Code Example

Open the file count10f.balsa & browse the counter description(the same functionality as count10d.balsa)

Note use of the shared procedure & code rearrangement

Determine the cost of this circuitmake clean

balsa-md count10f

make cost

Page 63: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 63

Parameterised Procedures

Facilitates libraries Ex: buffer with parameterised width

procedure Buffer ( parameter X : type ;

input i : X;

output o : X) is

local variable x : X

begin

loop

i -> x ;

o <- x

end

end

X is of type type

vars defined in termsof parameterised type

Page 64: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 64

Using Parameterised Modules

-- pbuffer1a.balsa - calling parameterised a procedure

import [balsa.types.basic]

import [pbuffer1]

public

-- instantiate a byte-wide single place buffer

procedure test (input a :byte ; output b : byte) is

begin

Buffer over type byte of a,b

end

invoke a buffer of width byte

Page 65: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 65

Recursive Procedures

Adding recursion to Balsa allows elegant specifications of many circuits

Especially useful in conjunction with parameterised procedures

Go to directory ~/Balsa/Muxs Browse file pmux1.balsa

Page 66: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 66

An n-way multiplexer

Decompose MUX:

inp0

inp1

inpn-2

inpn-1out1

out0

inp0

inpn-1

inpn/2

outout

Before Decomposition After Decomposition

inpn/2-1

Page 67: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 67

An n-way multiplexer -1

-- Pmux1.balsa: A recursive parameterised MUX definition

import [balsa.types.basic]

public

procedure PMux ( parameter X : type;

parameter n : cardinal;

array n of input inp : X;

output out : X ) is

begin

-- procedure body

width of input

number of inputs

each input is a channeloutput

channel

Page 68: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 68

An n-way multiplexer -2

if n = 0 then print error,”Parameter n should not be zero”

| n = 1 then

loop select inp[0] -> inp then

out <- inp

end

end

| n = 2 then

loop

select inp[0] -> inp then

out <- inp

| inp[1] -> inp then

out <- inp

end

end

when data arrives oneither i/p, pass it to o/p

base cases

Page 69: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 69

An n-way multiplexer -3

else

local

channel out0, out1 : X

constant mid = n/2

begin

PMux over type X, mid of inp[0..mid-1],out0 ||

PMux over type X, n-mid of inp[mid..n-1],out1 ||

PMux over type X, 2 of {out0,out1},out

end

end

end

2 internalchannels

two half-size muxs& one 2:1 mux

Page 70: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 70

Simulation

3 possibilities• default lard test-harness• balsa test program

– balsa is flexible enough to be able to specify many test sequences

• custom lard test program– write your own lard

Page 71: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 71

Using Balsa as a Test Language

File test_pmux.balsa is a test-harness for testing the 5 input multiplexer

Generate a Makefile & run the simulation:balsa-md -t test test_pmux

make sim-win

Page 72: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 72

Design Example

Simple 8-bit Calculator• Inputs

– 4 operator buttons (#, , +, -)– Hex keypad input

• Output– 2 Line x 20 char display

Page 73: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 73

Design Flow

Compile balsa & simulate locally Submit design over web to Manchester

• Xilinx bitstream generated in Manchester using Xilinx compilation tools

• Xilinx bit file returned to local directory Download & run on prototyping board

• 4 boards available – first come, first served

Page 74: Balsa – Live @Eilat.fun
Page 75: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 75

Design Framework

Use template in Calculator/calc.balsa Specification of calculator is up to you

• suggest add, subtract and push• parameterised depth stack (4-8 deep)

– simulate this in isolation using LARD

• display may be scrolled and addressed by character position (routines provided)

• don’t get bogged down driving the display– keep it simple for first attempt

Page 76: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 76

Design Restrictions

The top level channel declarations must not be changed because:• a test harness wrapper is provided that

a) provides a hardware interface to the board components

b) provides a LARD interface to a model of the display hardware

• changing the interface will break the test harnesses provided !

Page 77: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 77

Simulation Environment

balsa source lard code• accurately reflects the balsa program

lard code model of display• crafted by Andrew Bardsley specially for this

event follow the instructions in the hand-out to run

the simulator automatically

Page 78: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 78

Example Simulation

Reset

Simulation Simulation WindowWindow

Page 79: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 79

Example Simulation

Enter 1st digit

press 3press 3

acc pushed to stackacc pushed to stack

Page 80: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 80

Example Simulation

Enter 2nd digit

press 1press 1

2nd digit entered2nd digit entered

Page 81: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 81

Example Simulation

Enter 45

31 pushed to stack31 pushed to stack

Page 82: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 82

Example Simulation

Enter 17

45 pushed to stack45 pushed to stack

Page 83: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 83

Example Simulation

Add 17+45

stack poppedstack popped

Page 84: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 84

Example Simulation

Add 5C+31

stack poppedstack popped

Page 85: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 85

Example Simulation

Reverse Subtract(0 - 8D) = 73

= -8D= -8D

Page 86: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 86

Design of a Stack

pushes & pops are sequenced select between input & output requests passive input channels implied

pushData

popData stack n-1stack 1stack 1(var)(var)

stack(n)

Page 87: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 87

Design of a Stack

decompose into buffer & stack(n-1) connect with local channels compose in parallel

pushData

popData

bufferbuffer stack(n-1)

stack(n)

Page 88: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 88

Design of a Stack

pushData

popData

bufferbuffer stack(n-1)

stack(n)but can’t selectbut can’t selectoutput channelsoutput channels

need to choose need to choose between incoming between incoming

requestsrequests

Page 89: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 89

Design of a stack

pushData

popData

pop_reqpop_req bufferbuffer stack(n-1)

stack(n)add pop_reqadd pop_reqsync channelsync channel

Page 90: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 90

Stack Operation - push

1st push-data request• select input from pushData

pushData

popData

pop_reqpop_req bufferbuffer stack(n-1)

stack(n)

Page 91: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 91

Stack Operation - push

1st data item stored

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 92: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 92

Stack Operation - push

2nd data item arrives

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 93: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 93

Stack Operation - push

push existing data

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 94: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 94

Stack Operation - push

push existing data

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 95: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 95

Stack Operation - push

buffer now free

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 96: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 96

Stack Operation - push

accept new data• reqs ripple to bottom of stack & acks ripple

back to top – performance penalty

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 97: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 97

Stack Operation

data pushed

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 98: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 98

Stack Operation - pop

1st pop_req• select pop_req

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 99: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 99

Stack Operation - pop

Output top-of-stack

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 100: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 100

Stack Operation - pop

Buffer now free

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 101: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 101

Stack Operation - pop

Now request pop from stack(n-1)• (in parallel with requesting pop data)

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

request readrequest read

pop_requestpop_request

Page 102: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 102

Stack Operation - pop

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 103: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 103

Stack Operation - pop

pop completed

pushData

popData

stack(n-1)pop_reqpop_req bufferbuffer

stack(n)

Page 104: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 104

Possible Pitfalls

shared procedures:• only variables and external channels allowed –

not local channels• can not be parameterised

reserved words• e.g. in and push

remember the base case (depth = 1) in recursive stack definition

Page 105: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 105

Source Level Debugginging

Before starting simulation, add “source-view” module

Page 106: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 106

Source Level Debugging

Use these button tocontrol simulation

Waiting for inputin select

Active thread

Page 107: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 107

Balsa – Current Status

Used to implement Amulet3 DMA Weaknesses

• simulation environment• user-interface

Funding secured until April 2003• datapath optimisations• D-I implementations (back to the future?)• some language development

Page 108: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 108

Balsa: The Complete Works

Page 109: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 109

Push Circuits – passive inputs

Push Circuits:

Circuit waits for data

passive input

req

ack

datacct

active output

req

ack

data

Page 110: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 110

Push Circuits

Push Circuits:

data arrivesreq

ack

datacct

req

ack

data

Page 111: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 111

Push Circuits

Push Circuits:

data validity signalledreq

ack

datacct

req

ack

data

Page 112: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 112

Push Circuits

Push Circuits:

circuit accepts data

data stored in latchreq

ack

datacct

req

ack

data

Page 113: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 113

Push Circuits

Push Circuits:

circuit signals data takenreq

ack

datacct

req

ack

data

Page 114: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 114

Push Circuits

Push Circuits:

Circuit outputs datareq

ack

datacct

req

ack

data

Page 115: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 115

Push Circuits

Push Circuits:

Circuit signals validityreq

ack

datacct

req

ack

data

Page 116: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 116

Push Circuits

Push Circuits:

receiver takes datareq

ack

datacct

req

ack

data

Page 117: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 117

Enclosed Handshakes

Push Circuits:

data arrivesreq

ack

datacct

req

ack

data

Page 118: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 118

Enclosed Handshakes

Push Circuits:

data validity signalledreq

ack

datacct

req

ack

data

Page 119: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 119

Enclosed Handshakes

Push Circuits:

circuit accepts datareq

ack

datacct

req

ack

data

Page 120: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 120

Enclosed Handshakes

Push Circuits:

Circuit outputs datareq

ack

datacct

req

ack

data

Page 121: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 121

Enclosed Handshakes

Push Circuits:

Circuit signals validityreq

ack

datacct

req

ack

data

Page 122: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 122

Enclosed Handshakes

Push Circuits:

receiver takes datareq

ack

datacct

req

ack

data

Page 123: Balsa – Live @Eilat.fun

Async2000, April, EilatBalsa Demonstration - 123

Enclosed Handshakes

Push Circuits:

input handshake completes

No latch required

req

ack

datacct

req

ack

data