// ========== Copyright Header Begin ========================================== // // OpenSPARC T2 Processor File: pcg_data_gen.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 // have any questions. // // ========== Copyright Header End ============================================ task data_gen(integer type, integer seed, integer len, byte_array buf, var integer offset, bit[63:0] options, pg my_root, integer tagged, integer ifedx) { integer min,max,n,o,b,l; bit [15:0] tmp16; bit [7:0] tmp8,s; integer exact_len; integer debug_dg = 1; if(debug_dg) printf("DEBUG: PG: data_gen: input: type: %0d (%h), len: %0d, offset: %0d, tagged: %0d, ifedx: %0d\n", type,type,len,offset,tagged,ifedx); exact_len = (type & DAT_LEN_EXACT) ? 1 : 0; exact_len = ptr_to_first_pg.check_option(type, DAT_LEN_EXACT); type = type & DAT_TYPE_MASK; if(len<0) exact_len = 1; case(len) { -1: len = 64; -2: len = 128; -3: len = 256; -4: len = 512; -5: len = 1024; -6: len = (tagged) ? 1522 : 1518; -7: { // len = random(seed); len = random(); min = 64; max = (tagged) ? 1522 : 1518; while(lenmax) len = random(); } -8: len = 63-offset-4; -9: len = 65-offset-4; -10: len = (tagged) ? 1521 : 1517; -11: len = (tagged) ? 1523 : 1519; } if(exact_len) { len = len-offset-4; if(ifedx) len = len - 4; } else len = len - 2; // Compensate for token if(len<0) { len = 0; if(!quiet_on) printf("PG[%0d]: WARNING: Data length (payload) is zero.\n",my_port); } o=offset; // Safe offset b = seed; if( my_root != null & check_option(options, O_FRM_LEN_ERR2) ) len = cfg_reg[CFG_FRM_LEN] - offset -4; if(debug_dg) printf("DEBUG: PG: data_gen: offset: %0d, len: %0d type: %0d\n",o,len,type); l = 1; case(type) { DAT_RAND:{ // Do not Set Seed not required in Vera, creates problem // random(seed); random(); // Fill bufffer with random data for(n=0;n7) tmp8[15-b++] = 1; } if(b>15) b = 0; buf.val[offset++] = tmp8; } DAT_W0: // Fill with walking ones for(n=0;n7) tmp8[15-b++] = 0; } if(b>15) b = 0; buf.val[offset++] = tmp8; } DAT_FC_PAUSE: // Frame Control Pause Frame { len = 64-offset-4; o = offset; for(n=0;n 64'h0) check_option = 1; else check_option = 0; } function bit [7:0] class_mask(integer funct, bit[7:0] a, bit[7:0] b) { case(funct) { CLF_SRC: class_mask = a; CLF_DST: class_mask = b; CLF_OR: class_mask = a && b; CLF_AND: class_mask = a || b; default: class_mask = 8'h00; } }