// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: rand_packet.vr
// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// For the avoidance of doubt, and except that if any non-GPL license
// choice is available it will apply instead, Sun elects to use only
// the General Public License version 2 (GPLv2) at this time for any
// software where a choice of GPL license versions is made
// available with the language indicating that GPLv2 or any later version
// may be used, or where a choice of which version of the GPL is applied is
// otherwise unspecified.
// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
// CA 95054 USA or visit www.sun.com if you need additional information or
// ========== Copyright Header End ============================================
#include <vera_defines.vrh>
#include "pcg_defines.vri"
#include "rand_defines.vri"
class rx_rand_dma_parameters {
integer blk_size_max = 4;
rand integer blk_size = 4;
rand integer buf_siz0 = 256;
rand integer buf_siz1 = 1024;
rand integer buf_siz2 = 2048;
rand bit[15:0] desc_ring_length = 16'hfff;
rand bit[15:0] comp_ring_length = 16'hfff;
rand bit[15:0] initial_kick;
bit[15:0] cring_min, cring_max;
bit[15:0] dring_min, dring_max;
integer initial_kick_min, initial_kick_max;
constraint comp_ring_length_limit {
comp_ring_length <= cring_max;
comp_ring_length >= cring_min;
comp_ring_length == (comp_ring_length/64)*64; //multiple of 64 for now - cache line length
constraint desc_ring_length_limit {
desc_ring_length <= dring_max;
desc_ring_length >= dring_min;
desc_ring_length == (desc_ring_length/64)*64; //multiple of 64 for now - cache line length
constraint initial_kick_limit {
initial_kick >= initial_kick_min;
initial_kick < initial_kick_max;
initial_kick < desc_ring_length;
initial_kick == (initial_kick/16)*16;
//initial_kick == (initial_kick/64)*64; //multiple of 64 for now - cache line length
//valid block sizes: 4, 8, 16, 32
//valid size0: 256, 512, 1024, 2048
//valid size1: 1024, 2048, 4096, 8192
//valis size2: 2048, 4096, 8192, 16384
blk_size <= blk_size_max;
blk_size >= buf_siz2/1024;
if(get_plus_arg (CHECK, "CRING_MAX")) {
cring_max=get_plus_arg (NUM, "CRING_MAX");
if(cring_max>12'hfff) cring_max='hfff;
if(get_plus_arg (CHECK, "CRING_MIN")) cring_min=get_plus_arg (NUM, "CRING_MIN");
printf("TEST Cring_min=0x%0h Cring_max=0x%0h\n", cring_min, cring_max);
if(get_plus_arg (CHECK, "DRING_MAX")) dring_max=get_plus_arg (NUM, "DRING_MAX");
if(get_plus_arg (CHECK, "DRING_MIN")) dring_min=get_plus_arg (NUM, "DRING_MIN");
printf("TEST Dring_min=0x%0h Dring_max=0x%0h\n", dring_min, dring_max);
if(get_plus_arg (CHECK, "INITIAL_KICK_MAX")) initial_kick_max=get_plus_arg (NUM, "INITIAL_KICK_MAX");
else initial_kick_max='h100;
if(get_plus_arg (CHECK, "INITIAL_KICK_MIN")) initial_kick_min=get_plus_arg (NUM, "INITIAL_KICK_MIN");
else initial_kick_min='hc0;
printf("TEST initial_kick_min=0x%0h initial_kick_max=0x%0h\n", initial_kick_min, initial_kick_max);
if(get_plus_arg (CHECK, "BLK_SIZE_MAX")) blk_size_max=get_plus_arg (NUM, "BLK_SIZE_MAX");
printf("TEST blk_size_max=%0d\n", blk_size_max);
/////////////////////////////////////////
rand bit[47:0] xmac_l2_dest_addr;
rand bit[47:0] bmac_l2_dest_addr;
rand bit[47:0] l2_src_addr = 48'hdef0_7294_3815;
rand bit[19:0] node_src_port = 20'h00001;
rand integer rx_frame_class_funct = CLF_SRC;
rand integer rx_frame_data_type = DAT_SEQ;
rand bit[31:0] rx_param_rcv_isn = 32'hA5A5_F5F5;
rand bit[5:0] rx_tcp_flags = 6'b00_0010;
integer xmac_addr_weight=6;
integer bmac_addr_weight=12;
constraint xmac_l2_dest_addr_dist {
xmac_l2_dest_addr15 :/xmac_addr_weight
constraint bmac_l2_dest_addr_dist {
bmac_l2_dest_addr7 :/bmac_addr_weight
constraint l2_src_addr_dist {
constraint rx_frame_class_funct_dist {
rx_frame_class_funct dist {
rx_frame_class_funct_0 :/25,
rx_frame_class_funct_1 :/25,
rx_frame_class_funct_2 :/25,
rx_frame_class_funct_3 :/25
constraint rx_frame_data_type_dist {
rx_frame_data_type dist {
constraint rx_tcp_flags_dist {
if(get_plus_arg(CHECK, "SEND_PAUSE")) send_pause=get_plus_arg (NUM, "SEND_PAUSE");
printf("TEST send_pause=%0d\n", send_pause);
printf("TEST xmac_addr_weight=%0d bmac_addr_weight=%0d\n", xmac_addr_weight, bmac_addr_weight);