vmm_data_macros_utils.sv

Go to the documentation of this file.
00001 // 
00002 // -------------------------------------------------------------
00003 //    Copyright 2004-2008 Synopsys, Inc.
00004 //    All Rights Reserved Worldwide
00005 // 
00006 //    Licensed under the Apache License, Version 2.0 (the
00007 //    "License"); you may not use this file except in
00008 //    compliance with the License.  You may obtain a copy of
00009 //    the License at
00010 // 
00011 //        http://www.apache.org/licenses/LICENSE-2.0
00012 // 
00013 //    Unless required by applicable law or agreed to in
00014 //    writing, software distributed under the License is
00015 //    distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
00016 //    CONDITIONS OF ANY KIND, either express or implied.  See
00017 //    the License for the specific language governing
00018 //    permissions and limitations under the License.
00019 // -------------------------------------------------------------
00020 // 
00021 
00022 
00023 `define vmm_data_member_scalar_count(__name,__count) \
00024  \
00025       __count = $bits(__name)/8; \
00026       if ($bits(__name)%8 ) __count++; 
00027 
00028 
00029 `define vmm_data_member_scalar_pack(__pack,__maxbits,__count,__offset) \
00030  \
00031          for (int i=0; i < __count; i++) begin \
00032          __pack[__offset+i] = __maxbits[i*8 +: 8]; \
00033       end 
00034 
00035 
00036 `define vmm_data_member_scalar_unpack(__unpack,__maxbits,__count,__offset) \
00037  \
00038          for (int i=0; i < __count; i++) begin \
00039           __maxbits[i*8 +: 8] = __unpack[__offset+i]; \
00040       end 
00041 
00042 
00043 `define vmm_data_member_scalar_packint(__pack,__index,__st,__endian) \
00044  \
00045    if ( __endian) begin \
00046            {__pack[__st],__pack[__st+1],__pack[__st+2],__pack[__st+3]} = __index; \
00047    end \
00048    else begin \
00049            {__pack[__st+3],__pack[__st+2],__pack[__st+1],__pack[__st]} = __index; \
00050    end
00051 
00052 
00053 `define vmm_data_member_scalar_unpackint(__unpack,__index,__st,__endian) \
00054  \
00055    if ( __endian) begin \
00056            __index = {__unpack[__st],__unpack[__st+1],__unpack[__st+2],__unpack[__st+3]}; \
00057    end \
00058    else begin \
00059            __index = {__unpack[__st+3],__unpack[__st+2],__unpack[__st+1],__unpack[__st]}; \
00060    end
00061 
00062 
00063 `define vmm_data_member_update_offset(__offset,__count) \
00064  \
00065     __offset = __offset + __count;
00066 
00067 
00068 `define vmm_data_member_enum_set_name(__name,__stemp,__index) \
00069  \
00070      if ( __stemp == __name.name()) begin \
00071                    __name = __name; \
00072                    __index =0; \
00073           end \
00074      else begin \
00075               while ( __stemp != __name.name()) begin \
00076                    __name = __name.next(); \
00077                    if ( __index > __name.num() ) \
00078                        break; \
00079                    __index++; \
00080                end \
00081            end

Intelligent Design Verification
Intelligent Design Verification
Project: VMM, Revision: 1.0.1
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
Doxygen Version: 1.5.6
Sat Oct 18 11:32:18 2008
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV