Search code examples
unpackspecman

Specman - add bits in the beginning and end of list of bit


I have the following list of bit which contains 8 bits (input to function):

bs: list of bit;

I have the following struct:

struct uart_frame_s like any_sequence_item {
   %start_bit : bit;
   data_size : uint;
   %data[data_size] : list of bit;
   %stop_bit : bit;

   keep soft start_bit == 0;
   keep soft stop_bit == 1;
   keep soft data_size == 8;
};

I have to execute the following:

  unpack(packing.low, bs, current_frame);

The problem that bs size is 8, but current frame contains 10 bits.... So how can I add bits in the beginning and end of list of bit ('0' in the beginning and '1' in the end).

Or alternatively verify that the bs will unpack to 1-8 bits in current frame.


Solution

  • if you want to pack the bs into the frame data field, you can -

    unpack(packing.low, bs, current_frame.data);