Your Ad Here

Thursday, April 9, 2009

specman e-language constraint usage example

Adding a small example for using the constraint feature with the help of specman elite e-language.

file name : packet_def.e
<'
packet_kind_t : [ small, medium, large]

'>
file name : packet.e
<’
struct packet_s {
Addr: uint (bits: 32);
Kind: packet_kind_t;

my_method () is {
// define the actions required e.g parity_calculation
};

// call the above mentioned method in run phase

run() is also {

my_method();

};

}; // end of struct def

'>

file name : packet_top.e

<'

import packet_def.e;

import packet.e;

extend sys {

pkt : packet_s ;

};

'>

// Writing the Top Test case for applying constraints

file name : packet_test.e

<'

import packet_top.e;

extend packet_s {

keep soft Kind = = Small ;

keep soft addr in [10..40];
};
‘>

No comments:

Post a Comment