• Tidak ada hasil yang ditemukan

ASMs, Implicit Verilog and One-hot Designs: The VITO approach

N/A
N/A
Protected

Academic year: 2018

Membagikan "ASMs, Implicit Verilog and One-hot Designs: The VITO approach"

Copied!
10
0
0

Teks penuh

(1)

Copyright by Mark Arnold, 2002

ASMs, Implicit Verilog and

One-hot Designs:

The VITO approach

Mark G. Arnold

University of Manchester Institute of

Science and Technology

Copyright by Mark Arnold, 2002

Outline

Outline

Structure and Behavior

Algorithmic State Machines

Basic Intro to Verilog Portlist, input and output

always for (C-like) behavioral code Implicit Verilog

Blocking (=) and Nonblocking Assignment (<=) Wait for clock event @(posedge sysclk)

One-hot controllers

Verilog Implicit To One-hot (VITO) preprocessor

Examples Silly Power (XY)

Copyright by Mark Arnold, 2002

Structure and Behavior

Structure and Behavior

Unit A Unit B

Structure

How to build system?

Ex: Unit A is connected to Unit B

Behavior

What does system do?

Ex: What algorithm does unit A use? Algorithmic State Machine is one way. Behavioral HDLs are another:

Verilog or VHDL

Copyright by Mark Arnold, 2002

STATE_NAME

Algorithmic State Machine (ASM)

Algorithmic State Machine (ASM)

… … other states

Rectangles describe states. System clock (sysclk) determines when transitions occur. Nice to give the state a name.

Copyright by Mark Arnold, 2002

STATE_NAME

Moore action

Algorithmic State Machine (ASM)

Algorithmic State Machine (ASM)

… … other states

Inside of rectangle are commands that happen anytime the state is entered (Moore)

Copyright by Mark Arnold, 2002

STATE_NAME

cond 1

0

Moore action

Algorithmic State Machine (ASM)

Algorithmic State Machine (ASM)

… … other states

(2)

Copyright by Mark Arnold, 2002

STATE_NAME

cond 1

0

Moore action

Mealy action

Algorithmic State Machine (ASM)

Algorithmic State Machine (ASM)

… … other states

Optional oval comes after diamond. It says commands that happen anytime only when the state is entered and the condition is true. (Mealy)

Copyright by Mark Arnold, 2002

STATE_NAME

cond 1

0

Moore action

Algorithmic State Machine (ASM)

Algorithmic State Machine (ASM)

… … other states

Let’s ignore ovals, and concentrate on Moore machines.

Copyright by Mark Arnold, 2002

Verilog and VHDL several kinds of assignment:

Evaluate b Change a Blocking assignment Now Now a = b;

Nonblocking assignment Now Future a <= b;

Nonblocking assignment is a better model of how clocked flip flops work. Let’s use this in an ASM chart:

Kinds of Assignments

Kinds of Assignments

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

Silly Machine sysclk

reset

/ a / b 2 2

Structure Two input ports:

sysclk is the system clock reset (ignored for the moment) Two output ports:

a (two bits wide) b (two bits wide)

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

Behavior: Two states:

INIT initializes a and b

SWAP interchanges them

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

What is the output ?

a b

(3)

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

What is the output ?

a b

INIT x x SWAP 1 3

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

What is the output ?

a b

INIT x x SWAP 1 3

INIT 3 1

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

What is the output ?

a b

INIT x x SWAP 1 3

INIT 3 1

SWAP 1 3 ...

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a = b b = a

a = 1 b = 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

Blocking = doesn’t work:

a b

INIT x x SWAP 1 3

INIT 3 33 SWAP 33 3 ...

Copyright by Mark Arnold, 2002

Silly Example

Silly Example

a = b b = a

a = 1 b = 3

INIT

SWAP

Silly Machine sysclk

reset

/ a / b 2 2

Blocking = doesn’t work:

a b

INIT x x SWAP 1 3

INIT 3 33 SWAP 33 3 ... VITO requires <= not =

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

endmodule

Start with the structure.

The portlist shows all the inputs and outputs

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

Silly Machine sysclk

reset

(4)

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset;

endmodule

Have to specify which ones are inputs...

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

Silly Machine sysclk

reset

/ a / b 2 2

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b;

endmodule

and outputs. The [1:0] means two bits wide.

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

Silly Machine sysclk

reset

/ a / b 2 2

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b;

endmodule

The outputs are generated in registers that are local to the state machine .

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

Silly Machine sysclk

reset

/ a / b 2 2

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b; always

begin

end endmodule

always is a infinite loop used for behavioral modeling of hardware; begin end similar to { } in C

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b; always

begin

@(posedge sysclk); //INIT

end endmodule

In implicit style, each state starts with @(posedge sysclk)

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

INIT

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b; always

begin

@(posedge sysclk); //INIT

@(posedge sysclk); //SWAP

end endmodule

Sequential execution means implicit state transitions always handles the loop at the bottom

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

INIT

(5)

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b; always

begin

@(posedge sysclk); //INIT a <= 1;

b <= 3;

@(posedge sysclk); //SWAP

end endmodule

The <= means non-blocking assignment: 1 goes into a and 3 goes into b at the rising edge of next clock

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

a <= 1 b <= 3

INIT

SWAP

Copyright by Mark Arnold, 2002 module example(sysclk,reset,a,b);

input sysclk,reset; output [1:0] a,b; reg [1:0] a,b; always

begin

@(posedge sysclk); //INIT a <= 1;

b <= 3;

@(posedge sysclk); //SWAP a <= b;

b <= a;

end endmodule

Non-blocking assignment allows the parallel swap that takes effect at the next clock

Silly Example in Implicit

Silly Example in Implicit Verilog

Verilog

a <= b b <= a

a <= 1 b <= 3

INIT

SWAP

Copyright by Mark Arnold, 2002

For many mathematical algorithms, WHILE is natural

Same condition tested from two states: From entry state

From bottom state of loop

Advantage: don't describe condition twice

The wonderful WHILE

The wonderful WHILE

Copyright by Mark Arnold, 2002

Goal:

Compute

x

y = x * x * … * x

using a loop y times

Special case: x0 = 1 taken care of by WHILE

Ports:

x,y input values (8 bits each) p output product (8 bits) sysclk system clock reset resetting signal

Internal register:

c local loop counter

Example of machine needing WHILE

Copyright by Mark Arnold, 2002

{

c =0;

p =1;p =1;

while( while(c!=yc!=y))

{ {

c =c+1;

p =p*x; p =p*x;

}

}

while(1)

while(1)

{

{

}

}

}

Example of machine needing WHILE

Compute

x

y = x * x * … * x using a loop y times

Here’s this algorithm in C:

Copyright by Mark Arnold, 2002

Compute

x

y = x * x * … * x using a loop y times

For implicit Verilog, Need an always begin end to start behavioral code

always begin

c =0;

p =1;p =1;

while( while(c!=yc!=y))

begin begin

c =c+1;

p =p*x; p =p*x;

end

end

while(1)

while(1)

begin

begin

end

end

end

(6)

Copyright by Mark Arnold, 2002

Example of machine needing WHILE

Compute

x

y = x * x * … * x using a loop y times

For implicit Verilog, Need an always begin end to start behavioral code

Need @(posedge …) for each state

Copyright by Mark Arnold, 2002

always

Example of machine needing WHILE

Compute

x

y = x * x * … * x using a loop y times

For implicit Verilog, Need an always begin end to start behavioral code

Need @(posedge …) for each state

Need <= rather than = (careful: <= not same as = )

Copyright by Mark Arnold, 2002

GREEN

Example of machine needing WHILE

always

Copyright by Mark Arnold, 2002

GREEN

Example of machine needing WHILE

always Here’s where VITO comes in

Copyright by Mark Arnold, 2002 \/ D

Q

Example one-hot controller

Example one-hot controller

GREEN

With the one-hot method,

each state gets a flip flop Copyright by Mark Arnold, 2002

\/ D Q

\/ D Q

Example one-hot controller

Example one-hot controller

GREEN

(7)

Copyright by Mark Arnold, 2002 \/ D

Q

\/ D Q

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

Joining of two possible

transitions require OR gate Copyright by Mark Arnold, 2002

c!=y

\/ D Q

\/ D Q

DEMUX 0 1

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

Decision uses a demux:

Copyright by Mark Arnold, 2002

c!=y

\/ D Q

\/ D Q

DEMUX 0 1

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

Decision uses a demux: no more than one output active

Truth Table for Demux

in c!=y out0 out1 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1

Copyright by Mark Arnold, 2002

c!=y

\/ D Q

\/ D Q

\/ D Q DEMUX 0 1

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

When cond true, start loop

Copyright by Mark Arnold, 2002

c!=y

\/ D Q

\/ D Q

\/ D Q

\/ D Q

DEMUX 0 1

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

BLUE follows unconditionally from WHITE;

DEMUX shared by RED and BLUE because of OR Copyright by Mark Arnold, 2002

c!=y

\/ D Q

\/ D Q

\/ D Q

\/ D Q

\/ D Q

DEMUX 0 1

Example one-hot controller

Example one-hot controller

GREEN p <= 1

c <= 0

c!=y BLACK

RED

WHITE

BLUE 1

0

c <=c+1

p <= p*x

(8)

Copyright by Mark Arnold, 2002

Example one-hot controller

Example one-hot controller

GREEN

All 5 flip flops need sysclk.

Anything else needed? Copyright by Mark Arnold, 2002

c!=y

Example one-hot controller

Example one-hot controller

GREEN

Set BLACK, clear others with async reset signal

Copyright by Mark Arnold, 2002

c!=y

Example one-hot controller

Example one-hot controller

GREEN

are mutually exclusive; they control datapath Copyright by Mark Arnold, 2002

c!=y

Example one-hot controller

Example one-hot controller

GREEN

are mutually exclusive; they control datapath c!=y output

from datapath

Copyright by Mark Arnold, 2002 + 1

Example datapath

datapath

always

Copyright by Mark Arnold, 2002 + 1

Example datapath

datapath

(9)

Copyright by Mark Arnold, 2002

Example datapath

datapath

always

Copyright by Mark Arnold, 2002 + 1

Example datapath

datapath

always

Copyright by Mark Arnold, 2002 + 1

Example datapath

datapath

always

Copyright by Mark Arnold, 2002 + 1

Example datapath

datapath

/

The busses are M bits wide

Copyright by Mark Arnold, 2002

module vito_power(sysclk,reset,x,y,p); input sysclk,reset; input [`M:0] x,y; output [`M:0] p;

endmodule Copyright by Mark Arnold, 2002

Verilog Implicit To One-hot

Verilog synthesis preprocessor Works with any synthesis tool Accepts implicit and explicit style Leaves explicit block(s) alone Converts implicit block(s) to one-hot Vendor independent, freely available

Where is VITO?

Where is VITO?

www.verilog.vito.com

(10)

Copyright by Mark Arnold, 2002

Verilog to synthesize Verilog source

synthesis tool

generate architecture unchanged

statements and comments

implicit

always

parser

generate controller

VITO

merge

VITO

VITO

Organization

Organization

Copyright by Mark Arnold, 2002

Synthesis tool often successful in optimizing VITO

Comparison of different implicit design flows

Implicit tool Synopsys VITO

Synthesis tool Synopsys Synopsys

Optimization tool MINC MINC

Technology Vantis Vantis

CLBs 363 345

Comparison of explicit versus implicit for Power (xy)

Style explicit implicit

Design entry graphic ASM textual Verilog

Tool VeriBest VITO

Synthesis tool VeriBest VeriBest

Technology Xilinx Xilinx

CLBs 337 323

Referensi

Dokumen terkait

Kepada peserta lelang yang keberatan dengan pengumuman ini diberikan kesempatan untuk menyampaikan sanggahan melalui aplikasi SPSE kepada Pokja I Unit Layanan Pengadaan Kota

[r]

Application deadlines for one Masters Course to the other are different and set by the Consortium. They may vary from early December to late January. Please

KEMENTERIAN PENDIDIKAN DAN KEBUDAYAAN BALAI PELESTARIAN CAGAR BUDAYA TERNATE.. WILAYAH KERJA PROVINSI MALUKU, MALUKU UTARA, PAPUA DAN PAPUA BARAT

Tujuan yang ingin dicapai pada perancangan ini adalah menciptakan interior yang nyaman agar pengunjung dapat melakukan aktivitas dengan baik dan tidak merasa

Bagi calon Penyedia barang/jasa diberi waktu masa sanggah selama 5 (lima) hari kerja dari tanggal 07 Agustus 2012 sampai dengan tanggal 13 Agustus 2012 (sesuai jadwal pada

[r]

Penerapan strategi manajemen risiko yang dilakukan BMT Al Munawarah &amp; BMT Berkah Madani sudah cukup efektif dengan melakukan pemenuhan PPAP (Penyisihan Penghapusan