Introduction to VLSI Programming Lecture 6 Resource sharing









![Two-place wagging buffer byte = type [0. . 255] & wag 2: main proc Two-place wagging buffer byte = type [0. . 255] & wag 2: main proc](https://slidetodoc.com/presentation_image_h2/913d918803d54352f73849685781b72a/image-10.jpg)













- Slides: 23

Introduction to VLSI Programming Lecture 6: Resource sharing (course 2 IN 30) Prof. dr. ir. Kees van Berkel

Time table 2005 date class | lab subject Aug. 30 2 | 0 hours intro; VLSI Sep. 6 3 | 0 hours handshake circuits Sep. 13 3 | 0 hours handshake circuits Sep. 20 3 | 0 hours Tangram Sep. 27 no lecture Oct. 4 no lecture assignment Oct. 11 1 | 2 hours demo, fifos, registers | deadline assignment Oct. 18 1 | 2 hours design cases; Oct. 25 1 | 2 hours DLX introduction Nov. 1 1 | 2 hours low-cost DLX Nov. 8 1 | 2 hours high-speed DLX Nov. 29 9/7/2021 deadline final report Kees van Berkel 2

Lecture 6 Outline: • Recapitulation of Lecture 5 • Sharing of sequentially-used resources: – commands – auxiliary variables – expressions and operators • Lab work: assignment GCD 9/7/2021 Kees van Berkel 3

Tangram • Purpose: programming language for asynchronous VLSI circuits. • Creator: Tangram team @ Philips Research Labs (proto -Tangram 1986; release 2 in 1998). • Inspiration: Hoare’s CSP, Dijkstra’s GCL. • Lectures: no formal introduction; manual hand-out (learn by example, learn by doing). • Main tools: compiler, analyzer, simulator, viewer. 9/7/2021 Kees van Berkel 4

VLSI programming of asynchronous circuits behavior, Tangram program feedback compiler Handshake circuit simulator area, time, energy, test coverage expander Asynchronous circuit (netlist of gates) 9/7/2021 Kees van Berkel 5

VLSI programming for … • Low costs: – introduce resource sharing. • Low delay (high throughput): – introduce parallelism. • Low energy (low power): – reduce activity; … 9/7/2021 Kees van Berkel 6

VLSI programming for low costs • Keep it simple!! • Introduce resource sharing: commands, auxiliary variables, expressions, operators. • Enable resource sharing, by: – reducing parallelism – making similar commands equal 9/7/2021 Kees van Berkel 7

Command sharing P : proc(). S S; …; S P() ; … ; P() S 1 1 | 0 0 S S 9/7/2021 Kees van Berkel 8

Command sharing: example ax : proc(). a? x ; … ; a? x ax() ; … ; ax() 0 0 a | 1 | xw 9/7/2021 a Kees van Berkel 1 | xw 9
![Twoplace wagging buffer byte type 0 255 wag 2 main proc Two-place wagging buffer byte = type [0. . 255] & wag 2: main proc](https://slidetodoc.com/presentation_image_h2/913d918803d54352f73849685781b72a/image-10.jpg)
Two-place wagging buffer byte = type [0. . 255] & wag 2: main proc (a? chan byte & b!chan byte). begin x, y: var byte & ax : proc(). a? x | ax() ; forever do (a? y || b!x) ; (ax() || b!y) od end 9/7/2021 a Kees van Berkel b 10

Procedure definition vs declaration Procedure definition: P = proc (). S – provides a textual shorthand (expansion) – each call generates copy of resource, i. e. no sharing Procedure declaration: P : proc (). S – defines a sharable resource – each call generates access to this resource 9/7/2021 Kees van Berkel 11

Command sharing • Applies only to sequentially used commands. • Saves resources, almost always (i. e. when command is more costly than a mixer). • Impact on delay and energy often favorable. • Introduced by means of procedure declaration. • Makes Tangram program less well readable. Therefore, apply after program is correct & sound. • Should really be applied by compiler. 9/7/2021 Kees van Berkel 12

Sharing of auxiliary variables • x: =E is an auto assignment when E depends on x. This is compiled as aux: =E; x: = aux , where aux is a “fresh” auxiliary variable. • With multiple auto assignments to x, as in: x: =E; . . . ; x: =F auxiliary variables can be shared, as in: aux: =E; aux 2 x(); . . . ; aux: =F; aux 2 x() with aux 2 x(): proc(). x: =aux 9/7/2021 Kees van Berkel 13

Expression sharing f : func(). E x: =E ; … ; a!E x: =f() ; … ; a!f() e 0 E e 1 E | E e 0 e 1 9/7/2021 Kees van Berkel 14

Expression sharing • Applies only to sequentially used expressions. • Often saves resources, (i. e. when expression is more costly than the demultiplexer). • Introduced by means of function declarations. • Makes Tangram program less well readable. Therefore apply after program is correct & sound. • Should really be applied by compiler. 9/7/2021 Kees van Berkel 15

Operator sharing • Consider x 0 : = y 0+z 0 ; … ; x 1 : = y 1+z 1. • Operator + can be shared by introducing add : func(a, b? var T): T. a+b and applying it as in x 0 : = add(y 0, z 0) ; … ; x 1 : = add(y 1, z 1). 9/7/2021 Kees van Berkel 16

Operator sharing: the costs • Operator sharing may introduce multiplexers to (all) inputs of the operator and a demultiplexer to its output. • This form of sharing only reduces costs when: – operator is expensive, – some input(s) and/or output are common. 9/7/2021 Kees van Berkel 17

Operator sharing: example • Consider x : = y+z 0 ; … ; x : = y+z 1. • Operator + can be shared by introducing add 2 y : proc(b? var T). x: =y+b and applying it as in add 2 y(z 0) ; … ; add 2 y(z 1). 9/7/2021 Kees van Berkel 18

Making similar equal: example Consider: x : = y+z ; … ; x : = y-z. Use : y-z = y + bitwise_complement(z) +1 condinv: func (f: bool & x: int 8): int 8. { f x | f bwc(x)} begin y=val x cast bool 8 | <<f#y. 0, f#y. 1, f#y. 2, f#y. 3, f#y. 4, f#y. 5, f#y. 6, f#y. 7>> cast int 8 end addsub: func (f: bool & x: int 8 & y: int 8): int 9. { f x+y | f x-y } (<<f, x>> cast int 9 + <<f, condinv(f, y)>> cast int 9) cast <<bool, int 9>>. 1 9/7/2021 Kees van Berkel 19

Greatest Common Divisor gcd: main proc (ab? chan <<byte, byte>> & c!chan byte). begin x, y: var byte | forever do ab? <<x, y>> ; do x<y then y: = y-x or x>y then x: = x-y od ; c!x od ab c GCD end 9/7/2021 Kees van Berkel 20

Assigment 3: make GCD smaller • Both assignments (y: = y-x and x: = x-y) are auto assignments and hence require an auxiliary variable. • Program requires 4 arithmetic resources (twice < and –). • Reduce costs of GCD by saving on auxiliary variables and arithmetic resources. (Beware the costs of multiplexing!) • Use of ff variables not allowed for this exercise. 9/7/2021 Kees van Berkel 21

Lab-work and report • You are allowed to team up with a colleague. • Report: more than listing of functional Tangram programs: – – analyze the specifications and requirements; present design options, alternatives, trade-offs; motivate your design choices; explain functional correctness of your Tangram programs; – analyze & explain {area, time, energy} of your programs. 9/7/2021 Kees van Berkel 22

Next week: lecture 7 Outline: • Introduction to the DLX processor. • Introduction to Tangram version of a sub-set DLX (executing a software GCD). • Lab work: extend instruction set of Tangram DLX and reduce its costs. 9/7/2021 Kees van Berkel 23