00001 // $Id: ovm__packer_8svh-source.html,v 1.1 2008/10/07 21:54:34 alex.marin Exp $ 00002 //---------------------------------------------------------------------- 00003 // Copyright 2007-2008 Mentor Graphics Corporation 00004 // Copyright 2007-2008 Cadence Design Systems, Inc. 00005 // All Rights Reserved Worldwide 00006 // 00007 // Licensed under the Apache License, Version 2.0 (the 00008 // "License"); you may not use this file except in 00009 // compliance with the License. You may obtain a copy of 00010 // the License at 00011 // 00012 // http://www.apache.org/licenses/LICENSE-2.0 00013 // 00014 // Unless required by applicable law or agreed to in 00015 // writing, software distributed under the License is 00016 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00017 // CONDITIONS OF ANY KIND, either express or implied. See 00018 // the License for the specific language governing 00019 // permissions and limitations under the License. 00020 //---------------------------------------------------------------------- 00021 00022 00023 /******************************************************************************* 00024 00025 FILE : ovm_packer.svh 00026 00027 This class provides the packing/unpacking policy for data objects. 00028 00029 *******************************************************************************/ 00030 00031 `ifndef OVM_PACKER_SVH 00032 `define OVM_PACKER_SVH 00033 00034 00035 // ovm_packer 00036 // ------------ 00037 00038 class ovm_packer; 00039 static bit bitstream[]; //local bits for (un)pack_bytes 00040 static bit fabitstream[]; //field automation bits for (un)pack_bytes 00041 int count = 0; //used to count the number of packed bits 00042 ovm_scope_stack scope = new; 00043 00044 bit use_metadata = 0; //insert metadata for dynamic fields 00045 bit physical = 1; //pack/unpack physical fields by default 00046 bit abstract = 0; //don't pack abstract fields by default 00047 bit big_endian = 1; //load pack array from left to right 00048 bit reverse_order = 0; //flip the bit order around 00049 byte byte_size = 8; //set up bytesize for endianess 00050 int word_size = 16; //set up worksize for endianess 00051 bit nopack = 0; //only count packable bits 00052 00053 ovm_recursion_policy_enum policy = OVM_DEFAULT_POLICY; 00054 00055 ovm_bitstream_t m_bits = 0; 00056 int m_packed_size = 0; 00057 00058 // User interface for packing data into a bitstream 00059 extern virtual function void pack_field_int (logic[63:0] value, int size); 00060 extern virtual function void pack_field (ovm_bitstream_t value, int size); 00061 extern virtual function void pack_string (string value); 00062 extern virtual function void pack_time (time value); 00063 extern virtual function void pack_real (real value); 00064 extern virtual function void pack_object (ovm_object value); 00065 00066 // User interface for unpacking data from a bitstream 00067 extern virtual function bit is_null (); 00068 extern virtual function logic[63:0] unpack_field_int (int size); 00069 extern virtual function ovm_bitstream_t unpack_field (int size); 00070 extern virtual function string unpack_string (int num_chars=-1); 00071 extern virtual function time unpack_time (); 00072 extern virtual function real unpack_real (); 00073 extern virtual function void unpack_object (ovm_object value); 00074 00075 extern virtual function int get_packed_size(); 00076 00077 // methods primarily for internal use 00078 00079 extern virtual function ovm_bitstream_t get_packed_bits (); 00080 00081 extern virtual function bit unsigned get_bit (int unsigned index); 00082 extern virtual function byte unsigned get_byte (int unsigned index); 00083 extern virtual function int unsigned get_int (int unsigned index); 00084 00085 extern virtual function void get_bits (ref bit unsigned bits[]); 00086 extern virtual function void get_bytes(ref byte unsigned bytes[]); 00087 extern virtual function void get_ints (ref int unsigned ints[]); 00088 00089 extern virtual function void put_bits (ref bit unsigned bitstream[]); 00090 extern virtual function void put_bytes(ref byte unsigned bytestream[]); 00091 extern virtual function void put_ints (ref int unsigned intstream[]); 00092 00093 extern virtual function void set_packed_size(); 00094 extern function void index_error(int index, string id, int sz); 00095 extern function bit enough_bits(int needed, string id); 00096 00097 extern function void reset(); 00098 00099 endclass 00100 00101 `endif //OVM_OBJECT_SVH 00102
![]() Intelligent Design Verification Project: OVM, Revision: 1.1.0 |
Copyright (c) 2008 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.4.6 Mon Sep 29 14:20:12 2008 |