// ========== Copyright Header Begin ==========================================
// OpenSPARC T2 Processor File: htp_db.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 ============================================
//=======================================================
//= HTP Transmitter Descriptor structure ===
//=======================================================
bit [13:0] packet_length = 14'h0040; // packet_length
bit [13:0] buffer_length[]; // buffer_length
bit [4:0] chksum_start = 5'h00; // check sum start
bit [7:0] chksum_stuff = 8'h00; // check sum stuff
bit chksum_enable = 1'b1; // check sum enable
bit no_crc = 1'b1; // when set crc not inserted
// into the outgoing frame
bit int_me = 1'b0; // when set TX_INT_ME
// frame into the TX_FIFO
bit [3:0] qos = 4'h0; // service level of packet
bit [3:0] fdst = 4'h0; // final destination
bit [3:0] idst = 4'h0; // initial destination
bit [3:0] pkt_src = 4'h0; // Packet source
bit [3:0] pkt_type = 4'bx; // Packet type
// 4'b0001 - IB Management
// 4'b0010 - Ethernet Packet
// 4'b0011 - IPSec(decrypted)
// 4'b0100 - IPSec(encrypted)
// 4'b0110 - TCP Termiantion
// 4'b1001 - CPU-host management packet
bit [7:0] packet_type =8'hxx; // irx_packet type
bit [7:0] dst_port = 8'hxx; // destination mac port sent to irx cntrl wd
bit [7:0] ib_dst_port = 8'hxx; // destination mac port sent to irx cntrl wd
bit eop[]; // End of packet
bit sop[]; // Start of packet
bit [6:0] mac_index; // mac_index
bit [1:0] mac_port; // mac port
// fields of the IRX CONTROL WD
bit [15:0] chksum_data = 16'h0000;
bit [10:0] bucket_cnt = 11'h000;
bit [10:0] eop_offset = 11'h000;
bit [6:0] data_offset = 7'h00;
bit [5:0] reserved = 6'h00;
bit [127:0] status_wd = 128'b0; // status word for IRX INTF
bit bad_pkt = 1'b0; // bad pkt bit
bit [1:0] la4_prot = 2'b00; // 00 -> uninterested
bit [1:0] la3_vers = 2'b00; // 00 -> uninterested
bit [2:0] la2_opti = 3'b000; // 000 -> ethernet
// adding the null pkt bit
bit null_pkt = 1'b0; // default not a null pkt
bit err_pkt = 1'b0; // default not a err pkt
bit no_sop_pkt = 1'b0; // default the pkt has sop
bit no_eop_pkt = 1'b0; // default the pkt has eop
bit pkt_len_err = 1'b0; // default pkt has no len err
// bit [127:0] htp_txdesc = 128'hx; // This is the descriptor
// written into the host memory
// bit [127:0] htp_irx_ctrlwd = 128'hx; // This is the control word
// new bits of IBTP control word1 (BMC)
bit [4:0] ipsec_reserved = 5'h00;
bit [2:0] ipsec_reserved2 = 3'b000;
bit [5:0] ipsec_reserved3 = 5'h00;
bit [15:0] tcp_chksum = 16'hffff;
bit tcp_fullchksum_ok = 1'b1;
bit tcp_fullchksum = 1'b1;
bit partial_chksum = 1'b0;
bit ip_hdr_chksum_ok = 1'b0;
bit [7:0] ipsec_mac_index = 8'h00;
bit [11:0] mac_default = 12'h000;
bit [3:0] ipsec_mac_port = 4'hf;
bit [10:0] ipsec_eop_offset = 11'h000;
bit [10:0] ipsec_bucket_cnt = 11'h000;
// other bits for the control word two
bit [7:0] QPN_bypass = 8'h00;
bit [1:0] mode_bit = 2'b00;
bit [7:0] hdr_len = 8'h00;
bit [15:0] tt_index = 16'h0000;
bit [31:0] TCP_seq = 32'h0000_0000;
bit [15:0] tcp_seg_len = 16'h0000;
bit [12:0] first_bkt_ptr = 13'h0000;
bit [12:0] last_bkt_ptr = 13'h0000;
// htp-fflp driver values after the look up
bit [2:0] l2_option = 3'b000;
bit [1:0] l3_option = 2'b01;
bit [1:0] l4_option = 2'b01;
bit [3:0] l4_hdr_len = 4'h0;
bit solicited_event = 1'b0;
bit [31:0] seq_num = 32'h0000_0000;
bit [15:0] cam_index = 16'h0000;
bit [1:0] pkt_dest = 2'b00;
bit [1:0] pkt_mode = 2'b00;
bit cfg_def_vlan_ena = 1'b0;
bit reserved_fflp = 1'b0;
bit [7:0] ehp_qp_info = 8'h00;
// completion data handle
// buffer pointer of the pkt
bit [39:0] buffer_ptr = 40'h00_00000_0000;
bit [15:0] comp_offset = 16'h0000;
// adding the task definition
function bit [127:0] get_tx_descriptor(bit [39:0] pkt_bufptr, integer i);
function bit [127:0] get_htp_irx_ctrlwd();
function bit [31:0] get_irx_route_tag();
function bit [127:0] get_status_wd();
// functions to get the control word for htp_bmc in case of IPSED decrypted packet
function bit [127:0] get_htp_bmc_ctrlwd1();
function bit [127:0] get_htp_bmc_ctrlwd2();
// completion wr back word
function bit [127:0] get_comp_wrbk_wd(integer buf_indx, bit [1:0] chnl);
} // end of class htp_txdesc_db
// initializing the commonc parameters
printf("Intializing the buffer length array\n");
buffer_length[i] = 14'h0000;
printf("Intializing the EOP array\n");
printf("Intializing the SOP array\n");
function bit [127:0] htp_db :: get_tx_descriptor(bit [39:0] pkt_bufptr, integer i)
get_tx_descriptor = htp_txdesc;
function bit [127:0] htp_db :: get_htp_irx_ctrlwd()
bit [127:0] htp_irx_ctrlwd;
dst_port = {6'h00,mac_port};
4'b0000 : packet_type = 8'b0xxx_xxxx;
4'b0001 : packet_type = 8'b1000_0001;
4'b0010 : packet_type = 8'b1000_0010;
4'b0011 : packet_type = 8'b1000_0011;
4'b0100 : packet_type = 8'b1000_0100;
4'b0101 : packet_type = 8'b1000_0101;
4'b0110 : packet_type = 8'b1000_0110;
4'b0111 : packet_type = 8'b1000_0111;
4'b1000 : packet_type = 8'b1000_1000;
4'b1001 : packet_type = 8'b1000_1001;
htp_irx_ctrlwd = {packet_type,
get_htp_irx_ctrlwd = htp_irx_ctrlwd;
function bit [31:0] htp_db :: get_irx_route_tag()
bit [31:0] htp_irx_route_tag;
htp_irx_route_tag = {packet_type,pkt_src,idst,fdst,dst_port,qos};
get_irx_route_tag = htp_irx_route_tag;
// status word for IRX interface
function bit [127:0] htp_db :: get_status_wd()
bit [127:0] htp_irx_status_wd;
htp_irx_status_wd = {bad_pkt,111'b0,chksum_data};
get_status_wd = htp_irx_status_wd;
// this is used for IPSEC packet in the TCP flow mode going to the IB_PORT
function bit [127:0] htp_db :: get_htp_bmc_ctrlwd1()
bit [127:0] htp_bmc_ctrlwd1;
// dst_port = {6'h00,mac_port};
4'b0000 : packet_type = 8'b0xxx_xxxx;
4'b0001 : packet_type = 8'b1000_0001;
4'b0010 : packet_type = 8'b1000_0010;
4'b0011 : packet_type = 8'b1000_0011;
4'b0100 : packet_type = 8'b1000_0100;
4'b0101 : packet_type = 8'b1000_0101;
4'b0110 : packet_type = 8'b1000_0110;
4'b0111 : packet_type = 8'b1000_0111;
4'b1000 : packet_type = 8'b1000_1000;
4'b1001 : packet_type = 8'b1000_1001;
htp_bmc_ctrlwd1 = {packet_type,
get_htp_bmc_ctrlwd1 = htp_bmc_ctrlwd1;
// this is used for IPSEC packet in the TCP flow mode going to the IB_PORT
function bit [127:0] htp_db :: get_htp_bmc_ctrlwd2()
bit [127:0] htp_bmc_ctrlwd2;
// mode_bit = chksum_start[4:3];
// use_mc_index = chksum_start[2];
// push_bit = chksum_start[1];
// TOE_wbn = chksum_start[0];
get_htp_bmc_ctrlwd2 = htp_bmc_ctrlwd2;
//--------------------------------------------------
//----- comp write back word function --------------
//--------------------------------------------------
function bit [127:0] htp_db :: get_comp_wrbk_wd(integer buf_indx, bit [1:0] chnl)
bit [127:0] htp_cp_wrbk_wd;
get_comp_wrbk_wd = htp_cp_wrbk_wd;