module basic ovm session7 sequences and tests jaynsley
TRANSCRIPT
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
1/21
www.verificationacademy.com
Basic OVMSequences and Tests
John AynsleyCTO, Doulos
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
2/21
Layered Sequential Stimulus
Drive transactions into DUT
Constrained random
sequence of transactions
Nested, layered or
virtual sequences
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
3/21
Sequence of Transactions
cl ass r ead_modi f y_wr i t e ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( r ead_modi f y_wr i t e)f unct i on new ( st r i ng name = " " ) ;
super . new( name) ;endf unct i on: new
t ask body;my_t r ansact i on t x;i nt a;i nt d;
tx = my_transaction: : t ype_i d: : cr eat e( "t x") ;st ar t _i t em( tx) ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
4/21
Sequence of Transactions
cl ass r ead_modi f y_wr i t e ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( r ead_modi f y_wr i t e)f unct i on new ( st r i ng name = " " ) ;
super . new( name) ;endf unct i on: new
t ask body;my_t r ansact i on t x;i nt a;i nt d;
t x = my_t r ansact i on: : t ype_i d: : creat e( " t x") ;st ar t _i t em( t x) ;assert( tx.randomize() with { cmd == 0; } ) ;f i ni sh_i t em( t x) ;
Read
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
5/21
Sequence of Transactions
. . .a = tx.addr;
d = tx.data;
++d;
Modify
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
6/21
Sequence of Transactions
. . .a = t x. addr ;d = t x. dat a;++d;
t x = my_t r ansact i on: : t ype_i d: : creat e( " t x" ) ;st ar t _i t em( t x) ;assert( tx.randomize() with {
cmd == 1; addr == a; data == d; } ) ;
f i ni sh_i t em( t x) ;endt ask: body
endcl ass: r ead_modi f y_wr i t e
Write
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
7/21
Sequence of Sequences
cl ass seq_of _commands ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( seq_of _commands)rand int n;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
8/21
Sequence of Sequences
cl ass seq_of _commands ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( seq_of _commands)r and i nt n;constraint how_many { n inside {[2:4]}; }
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
9/21
Sequence of Sequences
cl ass seq_of _commands ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( seq_of _commands)r and i nt n;const r ai nt how_many { n i nsi de {[ 2: 4] }; }. . .
t ask body;repeat(n)
begi n
endendt ask: body
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
10/21
Sequence of Sequences
cl ass seq_of _commands ext ends ovm_sequence#( my_t r ansact i on) ;
`ovm_obj ect _ut i l s( seq_of _commands)r and i nt n;const r ai nt how_many { n i nsi de {[ 2: 4] }; }. . .
t ask body;r epeat ( n)begi n
r ead_modi f y_wr i t e seq;seq = read_modify_write: : t ype_i d: : cr eat e( "seq") ;
st ar t _i t em( seq ) ;f i ni sh_i t em( seq ) ;
endendt ask: body
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
11/21
A Sequence Library
package my_seq_l i br ary;i mpor t ovm_pkg: : *;
cl ass read_modify_write ext ends ovm_sequence#( my_t r ansact i on) ;
. . .
cl ass seq_of_commands ext ends ovm_sequence#( my_t r ansact i on) ;
. . .
endpackage
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
12/21
Starting a Sequence
cl ass t est 1 ext ends ovm_test;
`ovm_component _ut i l s( t est 1)
my_env my_env_h;
. . .
t ask run;r ead_modi f y_wr i t e seq;seq = read_modify_write: : t ype_i d: : cr eat e( "seq") ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
13/21
Starting a Sequence
cl ass t est 1 ext ends ovm_t est ;
`ovm_component _ut i l s( t est 1)
my_env my_env_h;
. . .
t ask run;r ead_modi f y_wr i t e seq;seq = r ead_modi f y_wr i t e: : t ype_i d: : cr eat e( "seq") ;seq.start( . . .
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
14/21
Starting a Sequence
cl ass t est 1 ext ends ovm_t est ;
`ovm_component _ut i l s( t est 1)
my_env my_env_h;
. . .
t ask run;r ead_modi f y_wr i t e seq;seq = r ead_modi f y_wr i t e: : t ype_i d: : cr eat e( "seq") ;seq. star t ( my_env_h.my_agent_h.my_sequencer_h ) ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
15/21
Starting a Sequence
cl ass test2 ext ends ovm_t est ;
`ovm_component _ut i l s( t est 2)
my_env my_env_h;
. . .
t ask run;seq_of _commands seq;seq = seq_of_commands: : t ype_i d: : cr eat e( "seq") ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
16/21
Randomizing a Sequence
cl ass test2 ext ends ovm_t est ;
`ovm_component _ut i l s( t est 2)
my_env my_env_h;
. . .
t ask run;seq_of _commands seq;seq = seq_of_commands: : t ype_i d: : cr eat e( "seq") ;
assert( seq.randomize( ) ) ;
seq. st ar t ( my_env_h. my_agent _h. my_sequencer_h ) ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
17/21
Constraining a Sequence
cl ass test3 ext ends ovm_t est ;
`ovm_component _ut i l s( t est 2)
my_env my_env_h;
. . .
t ask run;seq_of _commands seq;seq = seq_of _commands: : t ype_i d: : cr eat e( "seq" ) ;seq. how_many. constraint_mode(0) ;
asser t ( seq. r andomi ze( ) with {seq. n > 10 && seq. n < 20; } ) ;seq. st ar t ( my_env_h. my_agent _h. my_sequencer_h ) ;
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
18/21
Selecting a Test
modul e t op;. . .
i ni t i albegi n: bl k
. . .run_test(" test3") ;
end
endmodul e: t op
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
19/21
Selecting a Test
modul e t op;. . .
i ni t i albegi n: bl k
. . .run_test( ) ;
end
endmodul e: t op
vsim +OVM_TESTNAME=test3Command line:
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
20/21
Summary
Tests define differences
-
8/18/2019 Module Basic Ovm Session7 Sequences and Tests Jaynsley
21/21
www.verificationacademy.com
Basic OVMSequences and Tests
John AynsleyCTO, Doulos