// ********************************************************************
// Actel Corporation Proprietary and Confidential
//  Copyright 2010 Actel Corporation.  All rights reserved.
//
// ANY USE OR REDISTRIBUTION IN PART OR IN WHOLE MUST BE HANDLED IN
// ACCORDANCE WITH THE ACTEL LICENSE AGREEMENT AND MUST BE APPROVED
// IN ADVANCE IN WRITING.
//
// Description:	User testbench include file for CoreAHBLite - contains
//				various constants, procedures, etc. used by main BFM script
//
//
// SVN Revision Information:
// SVN $Revision: 21348 $
// SVN $Date: 2013-10-23 16:00:39 +0100 (Wed, 23 Oct 2013) $
//
//
// Notes:
// 1. best viewed with tabstops set to "4"
//
//
// *********************************************************************


memmap BASE					0x00000000;

// constants
constant mode0_slot_incr	0x10000000;
constant mode1_slot_incr	0x10000;
constant mode1_client_incr	0x1000;
constant huge_slotsize		0x80000000;

// global variables to store local copy of testbench parameters and constants
// derived from testbench parameters
int FAMILY
int MEMSPACE
int HADDR_SHG_CFG
int SC_0
int SC_1
int SC_2
int SC_3
int SC_4
int SC_5
int SC_6
int SC_7
int SC_8
int SC_9
int SC_10
int SC_11
int SC_12
int SC_13
int SC_14
int SC_15
int M0_AHBSLOT0ENABLE
int M0_AHBSLOT1ENABLE
int M0_AHBSLOT2ENABLE
int M0_AHBSLOT3ENABLE
int M0_AHBSLOT4ENABLE
int M0_AHBSLOT5ENABLE
int M0_AHBSLOT6ENABLE
int M0_AHBSLOT7ENABLE
int M0_AHBSLOT8ENABLE
int M0_AHBSLOT9ENABLE
int M0_AHBSLOT10ENABLE
int M0_AHBSLOT11ENABLE
int M0_AHBSLOT12ENABLE
int M0_AHBSLOT13ENABLE
int M0_AHBSLOT14ENABLE
int M0_AHBSLOT15ENABLE
int M0_AHBSLOT16ENABLE
int M1_AHBSLOT0ENABLE
int M1_AHBSLOT1ENABLE
int M1_AHBSLOT2ENABLE
int M1_AHBSLOT3ENABLE
int M1_AHBSLOT4ENABLE
int M1_AHBSLOT5ENABLE
int M1_AHBSLOT6ENABLE
int M1_AHBSLOT7ENABLE
int M1_AHBSLOT8ENABLE
int M1_AHBSLOT9ENABLE
int M1_AHBSLOT10ENABLE
int M1_AHBSLOT11ENABLE
int M1_AHBSLOT12ENABLE
int M1_AHBSLOT13ENABLE
int M1_AHBSLOT14ENABLE
int M1_AHBSLOT15ENABLE
int M1_AHBSLOT16ENABLE
int M2_AHBSLOT0ENABLE
int M2_AHBSLOT1ENABLE
int M2_AHBSLOT2ENABLE
int M2_AHBSLOT3ENABLE
int M2_AHBSLOT4ENABLE
int M2_AHBSLOT5ENABLE
int M2_AHBSLOT6ENABLE
int M2_AHBSLOT7ENABLE
int M2_AHBSLOT8ENABLE
int M2_AHBSLOT9ENABLE
int M2_AHBSLOT10ENABLE
int M2_AHBSLOT11ENABLE
int M2_AHBSLOT12ENABLE
int M2_AHBSLOT13ENABLE
int M2_AHBSLOT14ENABLE
int M2_AHBSLOT15ENABLE
int M2_AHBSLOT16ENABLE
int M3_AHBSLOT0ENABLE
int M3_AHBSLOT1ENABLE
int M3_AHBSLOT2ENABLE
int M3_AHBSLOT3ENABLE
int M3_AHBSLOT4ENABLE
int M3_AHBSLOT5ENABLE
int M3_AHBSLOT6ENABLE
int M3_AHBSLOT7ENABLE
int M3_AHBSLOT8ENABLE
int M3_AHBSLOT9ENABLE
int M3_AHBSLOT10ENABLE
int M3_AHBSLOT11ENABLE
int M3_AHBSLOT12ENABLE
int M3_AHBSLOT13ENABLE
int M3_AHBSLOT14ENABLE
int M3_AHBSLOT15ENABLE
int M3_AHBSLOT16ENABLE
int SC[16]
int M0_AHBSLOTENABLE[17]
int M1_AHBSLOTENABLE[17]
int M2_AHBSLOTENABLE[17]
int M3_AHBSLOTENABLE[17]

// GP_OUT bits that can be set/cleared from the BFM
constant REMAP_M0_BIT			0

// GP_OUT bits that can be set/cleared from the BFM - also connecting to
// GP_IN bits in testbench that can be monitored
constant M0_REQ_BIT				16
constant M0_ACK_BIT				17
constant M1_REQ_BIT				18
constant M1_ACK_BIT				19


//---------------------------------------------------------------------------
// print line of underscores
//---------------------------------------------------------------------------
procedure pr_underscores
	print "____________________________________________________________________"
	print " "
return

//---------------------------------------------------------------------------
// initialize local variables from the ARGVALUE* BFM parameters passed
// down from the testbench HDL
//---------------------------------------------------------------------------
//procedure init_parameter_vars_temp
procedure init_parameter_vars
	int i0
	int d0
	set FAMILY                      $ARGVALUE0
	set MEMSPACE                    $ARGVALUE1
	set HADDR_SHG_CFG               $ARGVALUE2
	set SC_0                        $ARGVALUE3
	set SC_1                        $ARGVALUE4
	set SC_2                        $ARGVALUE5
	set SC_3                        $ARGVALUE6
	set SC_4                        $ARGVALUE7
	set SC_5                        $ARGVALUE8
	set SC_6                        $ARGVALUE9
	set SC_7                        $ARGVALUE10
	set SC_8                        $ARGVALUE11
	set SC_9                        $ARGVALUE12
	set SC_10                       $ARGVALUE13
	set SC_11                       $ARGVALUE14
	set SC_12                       $ARGVALUE15
	set SC_13                       $ARGVALUE16
	set SC_14                       $ARGVALUE17
	set SC_15                       $ARGVALUE18
	set M0_AHBSLOT0ENABLE           $ARGVALUE19
	set M0_AHBSLOT1ENABLE           $ARGVALUE20
	set M0_AHBSLOT2ENABLE           $ARGVALUE21
	set M0_AHBSLOT3ENABLE           $ARGVALUE22
	set M0_AHBSLOT4ENABLE           $ARGVALUE23
	set M0_AHBSLOT5ENABLE           $ARGVALUE24
	set M0_AHBSLOT6ENABLE           $ARGVALUE25
	set M0_AHBSLOT7ENABLE           $ARGVALUE26
	set M0_AHBSLOT8ENABLE           $ARGVALUE27
	set M0_AHBSLOT9ENABLE           $ARGVALUE28
	set M0_AHBSLOT10ENABLE          $ARGVALUE29
	set M0_AHBSLOT11ENABLE          $ARGVALUE30
	set M0_AHBSLOT12ENABLE          $ARGVALUE31
	set M0_AHBSLOT13ENABLE          $ARGVALUE32
	set M0_AHBSLOT14ENABLE          $ARGVALUE33
	set M0_AHBSLOT15ENABLE          $ARGVALUE34
	set M0_AHBSLOT16ENABLE          $ARGVALUE35
	set M1_AHBSLOT0ENABLE           $ARGVALUE36
	set M1_AHBSLOT1ENABLE           $ARGVALUE37
	set M1_AHBSLOT2ENABLE           $ARGVALUE38
	set M1_AHBSLOT3ENABLE           $ARGVALUE39
	set M1_AHBSLOT4ENABLE           $ARGVALUE40
	set M1_AHBSLOT5ENABLE           $ARGVALUE41
	set M1_AHBSLOT6ENABLE           $ARGVALUE42
	set M1_AHBSLOT7ENABLE           $ARGVALUE43
	set M1_AHBSLOT8ENABLE           $ARGVALUE44
	set M1_AHBSLOT9ENABLE           $ARGVALUE45
	set M1_AHBSLOT10ENABLE          $ARGVALUE46
	set M1_AHBSLOT11ENABLE          $ARGVALUE47
	set M1_AHBSLOT12ENABLE          $ARGVALUE48
	set M1_AHBSLOT13ENABLE          $ARGVALUE49
	set M1_AHBSLOT14ENABLE          $ARGVALUE50
	set M1_AHBSLOT15ENABLE          $ARGVALUE51
	set M1_AHBSLOT16ENABLE          $ARGVALUE52
	set M2_AHBSLOT0ENABLE           $ARGVALUE53
	set M2_AHBSLOT1ENABLE           $ARGVALUE54
	set M2_AHBSLOT2ENABLE           $ARGVALUE55
	set M2_AHBSLOT3ENABLE           $ARGVALUE56
	set M2_AHBSLOT4ENABLE           $ARGVALUE57
	set M2_AHBSLOT5ENABLE           $ARGVALUE58
	set M2_AHBSLOT6ENABLE           $ARGVALUE59
	set M2_AHBSLOT7ENABLE           $ARGVALUE60
	set M2_AHBSLOT8ENABLE           $ARGVALUE61
	set M2_AHBSLOT9ENABLE           $ARGVALUE62
	set M2_AHBSLOT10ENABLE          $ARGVALUE63
	set M2_AHBSLOT11ENABLE          $ARGVALUE64
	set M2_AHBSLOT12ENABLE          $ARGVALUE65
	set M2_AHBSLOT13ENABLE          $ARGVALUE66
	set M2_AHBSLOT14ENABLE          $ARGVALUE67
	set M2_AHBSLOT15ENABLE          $ARGVALUE68
	set M2_AHBSLOT16ENABLE          $ARGVALUE69
	set M3_AHBSLOT0ENABLE           $ARGVALUE70
	set M3_AHBSLOT1ENABLE           $ARGVALUE71
	set M3_AHBSLOT2ENABLE           $ARGVALUE72
	set M3_AHBSLOT3ENABLE           $ARGVALUE73
	set M3_AHBSLOT4ENABLE           $ARGVALUE74
	set M3_AHBSLOT5ENABLE           $ARGVALUE75
	set M3_AHBSLOT6ENABLE           $ARGVALUE76
	set M3_AHBSLOT7ENABLE           $ARGVALUE77
	set M3_AHBSLOT8ENABLE           $ARGVALUE78
	set M3_AHBSLOT9ENABLE           $ARGVALUE79
	set M3_AHBSLOT10ENABLE          $ARGVALUE80
	set M3_AHBSLOT11ENABLE          $ARGVALUE81
	set M3_AHBSLOT12ENABLE          $ARGVALUE82
	set M3_AHBSLOT13ENABLE          $ARGVALUE83
	set M3_AHBSLOT14ENABLE          $ARGVALUE84
	set M3_AHBSLOT15ENABLE          $ARGVALUE85
	set M3_AHBSLOT16ENABLE          $ARGVALUE86

	// aggregate parameters
	set SC[0]			SC_0
	set SC[1]			SC_1
	set SC[2]			SC_2
	set SC[3]			SC_3
	set SC[4]			SC_4
	set SC[5]			SC_5
	set SC[6]			SC_6
	set SC[7]			SC_7
	set SC[8]			SC_8
	set SC[9]			SC_9
	set SC[10]		    SC_10
	set SC[11]		    SC_11
	set SC[12]		    SC_12
	set SC[13]		    SC_13
	set SC[14]		    SC_14
	set SC[15]		    SC_15

	set M0_AHBSLOTENABLE[0]			M0_AHBSLOT0ENABLE
	set M0_AHBSLOTENABLE[1]			M0_AHBSLOT1ENABLE
	set M0_AHBSLOTENABLE[2]			M0_AHBSLOT2ENABLE
	set M0_AHBSLOTENABLE[3]			M0_AHBSLOT3ENABLE
	set M0_AHBSLOTENABLE[4]			M0_AHBSLOT4ENABLE
	set M0_AHBSLOTENABLE[5]			M0_AHBSLOT5ENABLE
	set M0_AHBSLOTENABLE[6]			M0_AHBSLOT6ENABLE
	set M0_AHBSLOTENABLE[7]			M0_AHBSLOT7ENABLE
	set M0_AHBSLOTENABLE[8]			M0_AHBSLOT8ENABLE
	set M0_AHBSLOTENABLE[9]			M0_AHBSLOT9ENABLE
	set M0_AHBSLOTENABLE[10]		M0_AHBSLOT10ENABLE
	set M0_AHBSLOTENABLE[11]		M0_AHBSLOT11ENABLE
	set M0_AHBSLOTENABLE[12]		M0_AHBSLOT12ENABLE
	set M0_AHBSLOTENABLE[13]		M0_AHBSLOT13ENABLE
	set M0_AHBSLOTENABLE[14]		M0_AHBSLOT14ENABLE
	set M0_AHBSLOTENABLE[15]		M0_AHBSLOT15ENABLE
	set M0_AHBSLOTENABLE[16]		M0_AHBSLOT16ENABLE

	set M1_AHBSLOTENABLE[0]			M1_AHBSLOT0ENABLE
	set M1_AHBSLOTENABLE[1]			M1_AHBSLOT1ENABLE
	set M1_AHBSLOTENABLE[2]			M1_AHBSLOT2ENABLE
	set M1_AHBSLOTENABLE[3]			M1_AHBSLOT3ENABLE
	set M1_AHBSLOTENABLE[4]			M1_AHBSLOT4ENABLE
	set M1_AHBSLOTENABLE[5]			M1_AHBSLOT5ENABLE
	set M1_AHBSLOTENABLE[6]			M1_AHBSLOT6ENABLE
	set M1_AHBSLOTENABLE[7]			M1_AHBSLOT7ENABLE
	set M1_AHBSLOTENABLE[8]			M1_AHBSLOT8ENABLE
	set M1_AHBSLOTENABLE[9]			M1_AHBSLOT9ENABLE
	set M1_AHBSLOTENABLE[10]		M1_AHBSLOT10ENABLE
	set M1_AHBSLOTENABLE[11]		M1_AHBSLOT11ENABLE
	set M1_AHBSLOTENABLE[12]		M1_AHBSLOT12ENABLE
	set M1_AHBSLOTENABLE[13]		M1_AHBSLOT13ENABLE
	set M1_AHBSLOTENABLE[14]		M1_AHBSLOT14ENABLE
	set M1_AHBSLOTENABLE[15]		M1_AHBSLOT15ENABLE
	set M1_AHBSLOTENABLE[16]		M1_AHBSLOT16ENABLE

	set M2_AHBSLOTENABLE[0]			M2_AHBSLOT0ENABLE
	set M2_AHBSLOTENABLE[1]			M2_AHBSLOT1ENABLE
	set M2_AHBSLOTENABLE[2]			M2_AHBSLOT2ENABLE
	set M2_AHBSLOTENABLE[3]			M2_AHBSLOT3ENABLE
	set M2_AHBSLOTENABLE[4]			M2_AHBSLOT4ENABLE
	set M2_AHBSLOTENABLE[5]			M2_AHBSLOT5ENABLE
	set M2_AHBSLOTENABLE[6]			M2_AHBSLOT6ENABLE
	set M2_AHBSLOTENABLE[7]			M2_AHBSLOT7ENABLE
	set M2_AHBSLOTENABLE[8]			M2_AHBSLOT8ENABLE
	set M2_AHBSLOTENABLE[9]			M2_AHBSLOT9ENABLE
	set M2_AHBSLOTENABLE[10]		M2_AHBSLOT10ENABLE
	set M2_AHBSLOTENABLE[11]		M2_AHBSLOT11ENABLE
	set M2_AHBSLOTENABLE[12]		M2_AHBSLOT12ENABLE
	set M2_AHBSLOTENABLE[13]		M2_AHBSLOT13ENABLE
	set M2_AHBSLOTENABLE[14]		M2_AHBSLOT14ENABLE
	set M2_AHBSLOTENABLE[15]		M2_AHBSLOT15ENABLE
	set M2_AHBSLOTENABLE[16]		M2_AHBSLOT16ENABLE

	set M3_AHBSLOTENABLE[0]			M3_AHBSLOT0ENABLE
	set M3_AHBSLOTENABLE[1]			M3_AHBSLOT1ENABLE
	set M3_AHBSLOTENABLE[2]			M3_AHBSLOT2ENABLE
	set M3_AHBSLOTENABLE[3]			M3_AHBSLOT3ENABLE
	set M3_AHBSLOTENABLE[4]			M3_AHBSLOT4ENABLE
	set M3_AHBSLOTENABLE[5]			M3_AHBSLOT5ENABLE
	set M3_AHBSLOTENABLE[6]			M3_AHBSLOT6ENABLE
	set M3_AHBSLOTENABLE[7]			M3_AHBSLOT7ENABLE
	set M3_AHBSLOTENABLE[8]			M3_AHBSLOT8ENABLE
	set M3_AHBSLOTENABLE[9]			M3_AHBSLOT9ENABLE
	set M3_AHBSLOTENABLE[10]		M3_AHBSLOT10ENABLE
	set M3_AHBSLOTENABLE[11]		M3_AHBSLOT11ENABLE
	set M3_AHBSLOTENABLE[12]		M3_AHBSLOT12ENABLE
	set M3_AHBSLOTENABLE[13]		M3_AHBSLOT13ENABLE
	set M3_AHBSLOTENABLE[14]		M3_AHBSLOT14ENABLE
	set M3_AHBSLOTENABLE[15]		M3_AHBSLOT15ENABLE
	set M3_AHBSLOTENABLE[16]		M3_AHBSLOT16ENABLE

	# print some variable values
	call pr_underscores

	print "MEMSPACE:%0d" MEMSPACE
	print "HADDR_SHG_CFG:%0d" HADDR_SHG_CFG

	loop i0 0 15 1
		set d0 SC[i0]
		print "SC bit:%0d is:%0d" i0 d0
	endloop
	loop i0 0 16 1
		set d0 M0_AHBSLOTENABLE[i0]
		print "M0_AHBSLOTENABLE bit:%0d is:%0d" i0 d0
	endloop
	loop i0 0 16 1
		set d0 M1_AHBSLOTENABLE[i0]
		print "M1_AHBSLOTENABLE bit:%0d is:%0d" i0 d0
	endloop
	loop i0 0 16 1
		set d0 M2_AHBSLOTENABLE[i0]
		print "M2_AHBSLOTENABLE bit:%0d is:%0d" i0 d0
	endloop
	loop i0 0 16 1
		set d0 M3_AHBSLOTENABLE[i0]
		print "M3_AHBSLOTENABLE bit:%0d is:%0d" i0 d0
	endloop

	call pr_underscores

return
