2

I can't find a uvm_field_* macro that I can use in my testbench. I defined a struct:

typedef struct {
   unsigned byte red;
   unsigned byte green;
   unsigned byte blue;
} pixel;

Now, in my sequence item, I declare:

rand pixel unsigned data[];
rand int   unsigned height;
rand int   unsigned width;

`uvm_object_utils_begin(cgs_rgb_trans_t)
  `uvm_field_int(height, UVM_ALL_ON)
  `uvm_field_int(width, UVM_ALL_ON)
  `uvm_field_array_pixel(data, UVM_ALL_ON)
`uvm_object_utils_end

I doubt this will work. Can i just register it as `uvm_field_array_int? What is the method to do this?

noobuntu
  • 903
  • 1
  • 18
  • 42

2 Answers2

2

In my organization, we do not recommend using the field automation macros because of these limitations, confusion over which cases are auto-configured, and the severe performance penalty they impose. In addition, so-called UVM ints are internally represented as 4K bit vectors, wasting lots of memory. See this article for more info and alternatives.

dave_59
  • 39,096
  • 3
  • 24
  • 63
  • so i guess its not possible! i would think uvm_field_* macros are templated to accept any type. oh well.. – noobuntu May 29 '14 at 14:22
1

You always could use 'uvm_field_array_int and a pair of pack/unpack function that transforms the pixel info into an int (you would still have a byte of the int free) and the other way round. Your sequence would have, instead of an array of pixels, an array of ints, and then you could transform from/to in the driver and monitor.

eSedano
  • 312
  • 2
  • 13
  • Not having a pack/unpack function is the reason I wanted to go with a typdef pixel in the first place. I wanted to be able to refer to each component of the pixel as data[i].red, data[i].green etc. rather than byte red = (data[i]>>16) & 'hFF – noobuntu May 28 '14 at 17:25