typedef struct {rand int ver_pixel,H_Fornt,H_Sync,H_Back,hor_pixel,V_Fornt,V_Sync,V_Back;}pxiel_timming_parameter;
typedef enum { TIMMING_3840X2160 = 0, TIMMING_1920X1080 =1 , TIMMING_640X480 =2 ,TIMMING_RANDOM = 3} timming_type; //add
class lut_3d_rgb_item extends uvm_sequence_item;
rand bit[`SIZE-1 :0] pixel_r[];
rand bit[`SIZE-1 :0] pixel_g[`HEIGHT*`WIDTH];//`HEIGHT*`WIDTH];
rand bit[`SIZE-1 :0] pixel_b[`HEIGHT*`WIDTH];//`HEIGHT*`WIDTH];
rand pxiel_timming_parameter timming_parameter ; //struct
rand timming_type timming ; //enum
rand bit[3:0] binsize ;
constraint pixel_timming_c{
if(timming == TIMMING_3840X2160 )
//if( TIMMING_3840X2160 == $cast(timming, 0)) //error write
{
timming_parameter.ver_pixel == 3840 ;
timming_parameter.H_Fornt == 176 ;
timming_parameter.H_Sync == 88 ;
timming_parameter.H_Back == 296 ;//4400
timming_parameter.hor_pixel == 2160 ;
timming_parameter.V_Fornt == 8 ;
timming_parameter.V_Sync == 10 ;
timming_parameter.V_Back == 72 ; //2250
}
else if(timming == TIMMING_1920X1080)
{
timming_parameter.ver_pixel == 1920 ;
timming_parameter.H_Fornt == 88 ;
timming_parameter.H_Sync == 44 ;
timming_parameter.H_Back == 2200-1920-88-44;
timming_parameter.hor_pixel == 1080 ;
timming_parameter.V_Fornt == 4 ;
timming_parameter.V_Sync == 5 ;
timming_parameter.V_Back == 1125-4-5-1080;
}
else if(timming == TIMMING_640X480)
{
timming_parameter.ver_pixel == 640 ;
timming_parameter.H_Fornt == 16 ;
timming_parameter.H_Sync == 96 ;
timming_parameter.H_Back == 48 ;//800
timming_parameter.hor_pixel == 480 ;
timming_parameter.V_Fornt == 10 ;
timming_parameter.V_Sync == 2 ;
timming_parameter.V_Back == 33 ;//525
}
else {
timming_parameter.ver_pixel == 10 ;
timming_parameter.H_Fornt == 10 ;
timming_parameter.H_Sync == 14 ;
timming_parameter.H_Back == 12 ;
timming_parameter.hor_pixel == 11 ;
timming_parameter.V_Fornt == 13 ;
timming_parameter.V_Sync == 14 ;
timming_parameter.V_Back == 72 ;
}
//solve timming before timming_parameter;
}
constraint pixel_r_c{
foreach(pixel_r[i])
pixel_r[i] dist{[1:1022]:/90,0:/5, 1023:/5};
pixel_r.size() == timming_parameter.ver_pixel * timming_parameter.ver_pixel ;
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/270842.html