CoreAMBA BFM UG
CoreAMBA BFM UG
User’s Guide
Actel Corporation, Mountain View, CA 94043
© 2008 Actel Corporation. All rights reserved.
Printed in the United States of America
Part Number: 5-02-00141-0
Release: December 2008
No part of this document may be copied or reproduced in any form or by any means without prior written
consent of Actel.
Actel makes no warranties with respect to this documentation and disclaims any implied warranties of
merchantability or fitness for a particular purpose. Information in this document is subject to change
without notice. Actel assumes no responsibility for any errors that may appear in this document.
This document contains confidential proprietary information that is not to be disclosed to any
unauthorized person without prior written consent of Actel Corporation.
Trademarks
Actel and the Actel logo are registered trademarks of Actel Corporation.
Adobe and Acrobat Reader are registered trademarks of Adobe Systems, Inc.
All other products or brand names mentioned are trademarks or registered trademarks of their respective
holders.
Table of Contents
1 Instantiating and Using the BFMs . . . . . . . . . . . . . . . . . . . . . . . . 5
APB Master BFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
AHB-Lite Master Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
APB Slave Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7
AHB Slave Cores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
2 BFM Master . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 BFM_APBSLAVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Interface Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
B Known Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
C Product Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Customer Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Actel Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Actel Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Website . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Contacting the Customer Technical Support Center . . . . . . . . . . . . . . . . . . . . . . . . 67
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
This document describes how to use the AMBA BFM Models that may be included with Actel DirectCores as part of
the verification environment.
The AMBA BFM's support both master and slave bus functional models.
The following section outlines how the BFM models described in this document can be used for verification. There are
three master BFM models and four slave BFM models as listed in Table 1-1 and Table 1-2.
BFM
Script
BFM_APB UUT
BFM_MAIN Bridge
APB Backend
AHB IF AHB APB
GP IO
EXT IF
In Figure 1-1 we can see that the UUT is connected to the BFM_APB BFM. The BFM drives the APB input of the
UUT and also has the ability to set and monitor signals on the backend of the UUT through the GP I/O interface on
the BFM.
This setup allows the BFM to write to the APB register set and to verify that the backend behaves as expected, or vice
versa to set a backend input and verify that the core responds correctly in it APB register set.
BFM
Script
BFM_AHBL
BFM_MAIN UUT
AHB_IF AHB Backend
GP IO
EXT IF
In the above figure we can see that the UUT is connected to the BFM_AHBL BFM. The BFM drives the AHB input
of the UUT and also has the ability to set and monitor signals on the backend of the UUT through the GP I/O interface
on the BFM.
The operation is identical to the previous APB example.
BFM
Script
BFM_AHBL
BFM_MAIN UUT BFM-APBSlaveEXT
AHB_IF AHB APB APB EXT IF
GP IO
EXT IF
In Figure 1-3 we can see that the UUT has an AHB slave and an APB master interface. The AHB master interface is
driven as shown previously by the BFM_AHBL BFM. The APB master interface of the UUT is connected to an APB
slave BFM.
This setup allows the BFM-AHB to perform read/writes through the UUT to the APB slave BFM. The APB slave
BFM looks like a memory but has advanced features that allow it to vary its response rates, etc.
In this case the BFM_APBSlaveEXT model is used allowing the AHB master BFM to verify or modify the contents of
the slave memory array
BFM
Script
BFM_AHBLAPB UUT
BFM_MAIN Bridge Ethernet
APB Backend Packet
AHB IF AHB APB
Engine
AHB IF
GP IO
EXT IF BFM-AHBSLAVE
AHB IF
In Figure 1-4 we can see that the UUT has an AHB-Lite master interface that is connected via an AHB-lite arbitration
and multiplexer function to the BFM-AHBSLAVE block. This allows both the BFM_AHBLAPB BFM and the UUT
to read and write to the AHB slave BFM.
This setup also includes an Ethernet packet engine connected to the external interface on the AMBA BFM, allowing
the BFM script to generate and verify Ethernet data packets. The external interface provides an address/data type
interface rather than simple general purpose IO.
The BFM script would initially write known data frames to the BFM-AHBSLAVE, then program the UUT through
its APB interface to transmit the data frame, and then wait for an interrupt event. Once started the UUT would read the
BFM-AHBSlave and transmit the data frame, which would be captured by the Ethernet packet engine. When the UUT
generates it completion interrupt the BFM script would continue and verify the expected data frame has been received
by the packet engine.
The AMBA BFM by writing to special locations in the BFM-AHBSlave can cause it to vary its response rates etc. to
allow extended testing the AHB Interface on the UUT.
This lists the top level ports of the BFM-AHBAPL BFM, other BFM's have a subset of these signals.
Table 2-1 lists the BFM Master Interface signals.
This is a simple AHB based slave core; its function is similar to CoreAHBSRAM. There are two versions of this slave
model (Figure 3-1):
• BFM_AHBSLAVE - provides an AHB interface
• BFM_AHBSLAVEEXT - provides a backdoor interface using the EXT* interface
BFM-AHBSlave
APB
BFM-AHBSlaveEXT
AHB EXT IF
Parameters
Table 3-1 lists the BFM_AHBSLAVE parameters.
Interface Signals
Table 3-1 lists the BFM_AHBSLAVE interface signals.
FIFO Mode
The AHB slave model has the ability to emulate FIFO as well as normal memory behavior. This is enabled by the
ENFIFO generic. When enabled a TXFIFO and RXFIFO are created in the model in addition to the normal memory
array. These FIFO's are at a fixed address controlled by the ENFUNC generic (see “BFM Commands - Slave Cores” on
page 39).
The TXFIFO is set up to emulate a transmit FIFO in a device such as UART, data is intended to be written into the
FIFO by the AHB side and read by the external interface, and the TXREADY flag indicates that the FIFO is not full.
The RXFIFO is set up to emulate a receive FIFO in a device such as UART, data is intended to be written into the
FIFO by the external interface and read by the AHB interface, and the RXREADY flag indicates that the FIFO is not
empty.
The FIFO models also supports special flag control logic to force empty/full conditions and to add latency to the
READY signals to model latency caused posted writes within a system. Two counters are provided:
• LATCNT - sets the latency that the model will de-assert the READY signal
• FEMCNT - sets the duration that the FIFO will signal a full or empty after each data cycle.
CLOCK
HREADY
LATCNT
TXREADY
FEMCNT
In Figure 3-2 the HREADY signal indicates the data transfer cycle. LATCNT delays the de-assertion of the
TXREADY (or RXREADY) signal, TXREADY will de-assert if the FIFO becomes full or of FEMCNT is greater
that LATCNT. TXREADY will then be reasserted when the FIFO is no longer full or when FEMCNT count expires
assuming that the FIFO is not full. The same system applies to RXREADY. Should a second data transfer be attempted
within the LATCNT or FEMCNT period the BFM will detect an error and stop the simulation.
This is a simple APB based slave core (Figure 4-1). There are two version of this slave model:
• BFM_APBSLAVE - Provides an APB interface
• BFM_APBSLAVEEXT - Provides a backdoor interface using the EXT* interface
BFM-APBSlave
APB
BFM-APBSlaveEXT
AHB EXT IF
WARNING: The APB Slave is modelled as per the Actel APB byte handling guidelines with APB, the lowest two bits
of the address bus are ignored and all transfers assume 32-bit data writes. This model correctly models 8-bit and 16-bit
APB devices by setting the DWIDTH generic.
Parameters
Table 4-1 lists the BFM_AHBSLAVE parameters.
Interface Signals
Table 4-1 lists the BFM_APBSLAVE interface signals.
Note: The PWDATA and PRDATA bus widths can be modified by the DWIDTH generic.
The INITFILE is not reloaded when PRESETN is asserted.
The EXT_EN, EXT_RD, EXT_WR, EXT_ADDR, EXT_DATA ports and EXT_SIZE generic are only on
the BFM_APBSLAVEXT model, the BFM_APBSLAVE does not support the external interface
Only WORD aligned read and write cycles should be performed through the external interface
If an APB write and External write to the same location occur at the same time the extension write will win.
Master Models
The BFM-AMBA is scripted through a text file containing a list of bus cycles. The BFM supports BFM scripts similar
to those used with the CoreMP7 and Cortex-M1 processors.
The BFM script is converted to a binary sequence by the BFM Compiler; it also verifies the syntax of the script. The
binary file (*.vec) contains a sequence of 32-bit values, each represented by an 8 digit hexadecimal value. Libero IDE is
configured to automatically compile the BFM script when ModelSim is invoked.
HAL Based
C Scripting
BFM Script
BFM
Compiler
BFM
Vectors
Simulation
procedure main
print "Memory Test"
write w MEMBASE 0x0000 0x12345678
readcheck w MEMBASE 0x0000 0x12345678
readcheck h MEMBASE 0x0000 0x5678
readcheck h MEMBASE 0x0002 0x1234
readcheck b MEMBASE 0x0000 0x78
readcheck b MEMBASE 0x0001 0x56
readcheck b MEMBASE 0x0002 0x34
readcheck b MEMBASE 0x0003 0x12
return
In this example the base address of the memory device is set by the memmap command. Then a word write is used to
write the test data, and it read and checked using word, half word and byte transfers.
The BFM also supports a memory test command that can be used to verify memory access rather than having to create a
list of write and read operations as above
memmap MEMBASE 0x20000000
procedure main
print "Automatic Memory Test"
memtest MEMBASE 0x0000 1024 0 4000 566
return
In this example the BFM will test a block of memory at MEMBASE+0x0000 whose size is 1024 bytes, 4000 random
memory write and read cycles will be performed. The additional 0 parameter allows the memtest to be configured for
some special conditions, see the full memtest command description.
“Simple BFM Script” on page 43 contains a complete example BFM master script.
Slave Models
The AHB and APB slave models are simple memory based core, write cycles write data and read cycles provide the same
data back.
The model enables the memory locations to be initialized as well as some special control functions to vary response times
etc.
WARNING: The APB Slave is modelled as per the Actel APB byte handling guidelines with APB, the lowest two bits
of the address bus are ignored and all transfers assume 32-bit data writes. This model correctly models 8-bit and 16-bit
APB devices by setting the DWIDTH generic.
When the write, read, readcheck, or readmask and all the following burst commands are used the AHB BFM pipelines
the AHB bus operation, i.e. it starts the next command in the following clock cycle, and checks the read data in a
following clock cycle. A wait or flush command can be inserted to cause AHB idle cycles to be inserted between cycles.
The poll, pollmask, pollbit and readstore instructions are not pipelined, the AHB master inserts idle bus operations until
the read operation completes and the read data has been checked.
Burst Support
Table 6-3 lists commands that enable you to create AMBA burst instructions. They also simplify memory filling and
creating data tables.
External Interface
Table 6-5 lists the set of interfaces that enables the connection of external functions to the BFM. For instance, there may
be an Ethernet packet generator used in the testbench that the BFM script can control.
Flow Control
Table 6-6 lists the BFM flow control commands.
Flow
Description Clocks
Control
Set a label in the BFM script, used to label instructions for jumps within a procedure. A label's scope is
label labelid 0
limited to the procedure it is used in.
procedure
labelid para1
Set a label in the BFM script for a call and name its parameters. 0
para3 …
para8
jump labelid Jump to the specified label within the current procedure 0
jumpz labelid
Jump if the specified data value is zero. 0
data
jumpnz labelid
Jump if the specified data value is non zero. 0
data
Flow
Description Clocks
Control
call procedure
Call the routine at the specified procedure in the BFM script. Up to eight parameters may be passed to the
para1 para2 0
called routine. Calls can be recursive
para3 para4 etc
return Return from the routine 0
Return from the routine returning the data value or variable. Return value is accessed using the
return data 0
$RETVALUE variable.
Repeat the instructions between loop and end loop. Para1 must have been declared using the int command.
If not all the parameters are specified then the command is interpreted as below
loop para 8 => loop para 1 8 1
loop para1 loop para 1 5 => loop para 1 5 1
0
start end inc loop para 5 1 => loop para 5 1 -1
loop para 1 5 1 => loop para 1 5 1
The loop parameter can be used and modified within the loop. To exit a loop early set the loop variable to the
termination value using the set command
endloop End of loop. 0
The instructions between if and the following else or endif will be performed if variable is non zero. If/else/
if variable 0
endif can be nested. Supported operators are listed in Table 6-8 on page 30.
if variable op The instructions between if and the following else or endif will be performed if the expression is true e.g. a >=
0
variable b. If/else/endif can be nested
The instructions between if and the following else or endif will be performed if variable is zero. Ifnot/else/
Ifnot variable 0
endif can be nested.
Ifnot variable The instructions between if and the following else or endif will be performed if the expression is false e.g. a >=
0
op variable b. Ifnot/else/endif can be nested. Supported operators are listed in Table 6-8 on page 30.
else May be inserted between the if and endif statements
endif End of if. 0
case variable Specifies the variable to use in the case/when sequence 0
If the preceding case statement variable matches the data value then the following set of instructions will be
when data 0
executed. (See notes below)
default If non of the when clauses are true then the default is executed in a case statement 0
endcase End of the case statement
The instructions between while and endwhile will be performed as long as variable is non zero. While/
while variable 0
endwhile can be nested
endwhile End of while loop 0
compare
Compares variable to the specified data value. The mask value is optional. If the compare fails then an error
variable data 0
will be recorded
mask
Flow
Description Clocks
Control
nop Do nothing for a clock cycle (same as wait 1) 1
Stop the simulation. N specifies the VHDL assertion level or the Verilog generated message.
stop N 0
0:Note 1:Warning, 2:Error, 3:Failure
wait N Pause the BFM script operation for N clock cycles V
Pause the BFM script operation for N nano seconds
waitns N V
Note. The BFM will wait for the specified time to expire and then restart at the next clock edge,
Pause the BFM script operation for N micro seconds
waitus N V
Note. The BFM will wait for the specified time to expire and then restart at the next clock edge,
Wait for any pending read or write cycles to complete, and then wait for N additional clock cycles.
flush N The BFM is pipelined and it can start processing following instructions before the current one has completed, V
especially when AMBA read cycles are in progress.
quit Terminate the BFM and assert the FINISHED output 1
When processing case statements the BFM will compare the case value to EVERY when value and if equal execute the
following set of statements until it finds the next when. In the above example when i=1 both the first and last set of when
statements are executed. If no match is found then the default is executed.
A subroutine is declared using the procedure command then the passed parameters may be referred to by the declared
name.
procedure example address data;
write b UART address data
return
Up to eight parameters may be passed.
Variables
The commands in Table 6-7 allow a BFM script to use variables, etc. If variables are declared within a procedure they are
local to the procedure, if declared outside a procedure then they are global. Variables may only be assigned (set) within a
procedure.
Table 6-8 lists the supported operators for the set command; these are evaluated during run time by the BFM.
Operator Function
None
+ A+B
- A-B
* A*B
/ A / B (integer division)
MOD Modulus (remainder)
** A ** B
AND A and B
OR A or B
XOR A xor B
& A and B
| A or B
^ A xor B
CMP A == B (uses XOR operator - result will be zero if A==B)
<< A shifted left by B bits (infill is 0)
>> A shifted right by B bits (infill is 0)
== Equal (result is 1 if true else 0)
!= Not Equal (result is 1 if true else 0)
> Greater than (result is 1 if true else 0)
< Less than (result is 1 if true else 0)
>= Greater than or equal (result is 1 if true else 0)
<= Less than or equal (result is 1 if true else 0)
SETB Sets bit B in A
CLRB Clears bit B in A
INVB Inverts bit B in A
TSTB Tests bit B in A (result is 1 if bit set else 0)
BFM Control
Table 6-9 lists extended control functions for corner testing, etc.
Compiler
Description
Directives, etc.
include filename Include the C header files. The filename should be double quoted when filenames are case
include "filename” sensitive.
#define symbol value Define a constant value. Value should be simple integer value typically 1234 or 0x1234
Compiler
Description
Directives, etc.
#define symbol Define a constant and default its value to 1
#ifndef symbol If the symbol has not already been defined include following lines until #endif statement
#ifdef symbol If the symbol has already been defined include following lines until #endif statement
#endif Restart including
Parameter Formats
Table 6-12 describes the parameter formats used in the preceding Command Descriptions.
$ Variables
The BFM supports some special integer values that may be specified rather than immediate data or variables. The
supported $ variables are listed in Table 6-13.
$ Variable Description
$RETVALUE Is the value from the last executed return instruction
$ARGVALUEn Is the value of the ARGVALUEn generic, n is 0 to 99. e.g. $ARGVALUE4
$TIME Current Simulation time in ns
$DEBUG Current DEBUG level
$LINENO Current script line number
$ERRORS Current internal error counter value
$TIMER Returns the current timer value, see starttimer instruction
$LASTTIMER Returns the timer value from the last checktimer instruction
$LASTCYCLES Returns the number of clocks from the last checktime instruction
Returns a pseudo random number. The number is a 32-bit value; the random function is a simple
$RAND
CRC implementation.
$RANDSET Returns a pseudo random number, and remembers the seed value
Returns a pseudo random number after first resetting the seed value to that when the
$RANDRESET
$RANDSET variable was used. This causes the same random sequence to be regenerated.
$RANDn As above but the random number is limited to n bits
$RANDSETn As above but the random number is limited to n bits
$RANDRESETn As above but the random number is limited to n bits.
If $RAND is specified for the data increment field of the fill and fillcheck instructions then the data sequence will
increment by the same random value for each word.
Setup Commands
Table 6-14 details the setup mode commands.
Command N X Y Description
Sets the behavior of the 'X' memory access mode.
Size specifies the HSIZE value
0:B
widthX 1 Size Ainc
1:H
2:W
ainc specifies the Address increment on bursts.
When set the BFM stops pipelining AHB transactions, IDLE cycles will be inserted
autoflush 2 0|1
until the current read/write completes.
Sets the transfer rate using during bursts, when non-zero the specified number of
xrate 3 Rate clock cycles are inserted as BUSY cycles between data transfers by controlling
HTRANS
When set all burst operations are converted into consecutive NONSEQ transactions
noburst 4 0|1
on the AHB bus.
Sets the AHB data alignment mode
0: Data is correctly aligned for a 32-bit AHB bus based on the address and size
specified
align 5 Mode
1: Reserved
2: Reserved
8: No data alignment is performed. The data is written/read from the bus as provided
Controls what the BFM does on completion (VHDL Only)
0: Stops in an IDLE state with simulation running (default)
1: Executes an assert with severity NOTE
endsim 6 0 to 4
2: Executes an assert with severity WARNING
3: Executes an assert with severity ERROR
4: Executes an assert with severity FAILURE
Controls what the BFM does on completion (Verilog Only)
0: Stops in an IDLE state with simulation running (default)
endsim 7 0 to 2
1: Executes a $stop
2: Executes a $finish
Note: It is recommended that constants are use for the N value to enhance readability i.e.
Constant C_WidthX 1
Constant C_Xrate 3
Setup C_WidthX 0 4
Setup 2 1 -- enable autoflush
This decoding is a simple decode of the upper eight address lines. If different decoding is required then separate HSEL
and PSEL decode logic can be created leaving the HSEL and PSEL outputs unconnected. Internally HSEL(1)
"0x1xxxxxxx" is used to select the internal APB bridge on the APB and AHBLAPB models.
On the APB only BFM Model the complete address range is mapped to APB. The default PSEL decoding will ignore
the upper four address bits.
The slave cores (AHB and APB) by default respond with zero wait state cycles. When ENFUNC is greater than 0 the
slave core allows its behavior to be varied for corner case testing. The slave model catches AHB or APB writes to a 256
byte address space located at the address specified by ENFUNC and uses the written data to alter its behavior, as shown
in Table 7-1.
Address Description
ENFUNC+0x00 Set the HRESP ERROR or PSLVERR response on the Nth access after this one.
Bits 7:0: Set the number of wait cycles i.e. HREADY/PREADY timing, values 0 to 255
may be used.
ENFUNC+0x04
Bit 8: If this bit is set then the number of inserted wait cycles will be random up to the
value specified in bits 7:0, these bits must be a power of 2 i.e., 1,2,4,8,16….,128
ENFUNC+0x08 Set the debug level
ENFUNC+0x0C (12) Zero the memory
Write test pattern to memory. Pattern is a decrementing sequence starting at 255, i.e. byte
ENFUNC+0x10 (16)
values 0xff 0xfe etc., or viewed as words 0xFCFDFEFF 0xF8F9FAFB etc.
The return data value contains the HTRANS, HSIZE, HPROT and HBURST values
from the previous access cycle.
[1:0] HTRANS[1:0]
[6:4] HSIZE[2:0]
ENFUNC+0x14 (20) [11:8] HPROT[3:0]
[14:12] HBURST[2:0]
[16] HWRITE
[17] HMASTLOCK
AHB Slave Only is Reserved on APB slave.
Sets the slaves response to misaligned transfers. The default mode is "0001", i.e. the
AHBSLAVE will cause a simulation ERROR on a misaligned transfer occurring
Bit 0: Generate Simulation ERROR
ENFUNC+0x18 (24) Bit 1: Generate a HRESP error
Bit 2: Make the device read only, writes are treated as errors
Bit 3: Allow write on misalignment
AHB Slave Only is Reserved on APB slave.
Data writes to this address will be delayed by the number off clocks specified at
ENFUNC+0x1C (28)
ENFUNC+0x20
ENFUNC+0x20 (32) Clock cycle delay until reads from ENFUNC+0x1c contains the last written value.
Reinitialize the memory from the vector file. A FLUSH 2 command should be used after
ENFUNC+0x24 (36)
this command is issued.
Dump the memory file to a vector file in a format that can reloaded. Log file will be
ENFUNC+0x28 (40)
"imageX.txt" where X is ID generic value
Address Description
Last Read or Write address, can be used to check that another master accessed as expected.
ENFUNC+0x2C (44)
Address will be word aligned
Last Read or Write data value, can be used to check that another master accessed as
ENFUNC+0x30 (48)
expected
Special Mode Enables
ENFUNC+0x34 (52) Bit 0: When 0 the slave behaves in AMBA compliant way returning 0's on the databus
when not being read. When 1 X values are provided on the RDATA bus when not being
read.
ENFUNC+0x38 to
Reserved
ENFUNC+0x7C
ENFUNC+0x80 (128) Transmit FIFO Data In port. (written by AHB)
ENFUNC+0x84 (132) Transmit FIFO Data Out port (read by external)
Transmit FIFO count.
ENFUNC+0x88 (136) Reads provide current count
Writes 0x00000000 will reset the FIFO to zero count
Transmit FIFO HREADY to TXREADY latency time (LATCNT). When 0 the
TXREADY will be de-asserted immediately after the data cycle. When >0 i.e.N then
ENFUNC+0x8C (140)
TXREADY will be de-asserted N clock cycles after the data cycle. This is to model latency
on the TXREADY deassertion
Transmit FIFO force FULL. (FEMCNT) When non zero this will force the FIFO to
ENFUNC+0x90 (144)
signal that it is full for N clock cycles after data cycle. This value must be greater than 0x8c
Swap TXREADY and RXREADY outputs
ENFUNC+0x94 (148) Bit 0: 0: Normal Operation
Bit 0:1: RXREADY and TXREADY swapped
ENFUNC+0x98 to
Reserved
ENFUNC+0xBC
ENFUNC+0xA0 (160) Receive FIFO Data In port. (written by external)
ENFUNC+0xA4 (164) Receive FIFO Data Out port (read by AHB)
Receive FIFO count.
ENFUNC+0xA8 (168) Reads provide current count
Writes 0x00000000 will reset the FIFO to zero count
Receive FIFO HREADY to RXREADY latency time (LATCNT). When 0 the
ENFUNC+0xAC (172) RXREADY will be de-asserted immediately after the data cycle. When >0 i.e.N then
RXREADY will be de-asserted N clock cycles after the data cycle.
Address Description
Receive FIFO force EMPTY (FEMCNT). When non zero this will force the FIFO to
ENFUNC+0xB0 (176) signal that it is empty for N clock cycles after data cycle. This value must be greater than
0xAC. This is to model latency on the RXREADY de-assertion
ENFUNC+0xB4 to
Reserved
ENFUNC+0xFC
The control space above can only be read or written through the main AHB/APB interface. The external interface
backdoor access supports read and write cycles to the main memory array only. Should an AHB/APB write access to the
same location occur at the same time the external backdoor access takes precedence.
The following shows an example BFM script that for testing a APB core.
#############################################
# Core1553BRT APB Test Harness
#############################################
# Global Variables
# These are inherited from the Parameters set in CC
int FAMILY
int CLKSPD
int CLKSYNC
int LOCKRT
int BCASTEN
int LEGMODE
int SA30LOOP
int INTENBBR
int TESTTXTOUTEN
int INT_POLARITY
int VERIF
int TBNRTS
# Registers
constant R_CONTROL 0x1F80
constant R_INTERRUPT 0x1F84
constant R_VWORD 0x1F88
constant R_LEGREG0 0x1FC0
constant NRTS 4
int READBACK
int CWORD
----------------------------------------------------------------------------------
procedure main
int doall
int vw;
int RT;
int SA;
int WC;
int base;
int isrtl
set READBACK FAMILY >= 16 # AX/APA versions do not allow RAM readback
set ISRTL FAMILY == 0
if ISRTL # Also if RTL code the readback allowed
set READBACK 1
endif
set CWORD 1 # Initial transmissions on Bus A
if READBACK
print " RAM Readback Allowed "
endif
ifnot READBACK
print " RAM Readback Not Allowed "
endif
#---------------------------------------------------------------------------------
# Simple Test Example using RT1
# Cause the 1553B BC BFM to transmit the message and wait for completion
extwrite 0 0x0001 0x0100
extwait
#---------------------------------------------------------------------------------
# Verification Tests
if verif
header "Running More Complex Set of Verification Tests"
call setup_legal_mode base_RT0
call setup_legal_mode base_RT1
call setup_legal_mode base_RT2
call setup_legal_mode base_RT3
call testmemory base_RT1 0000 64
call test_rxtx;
call test_control
call test_interrupt
call test_legality_mode
call test_bcbfm
endif;
return
###########################################################################
# Test 1553B message Support in BC BFM
procedure test_bcbfm
extwrite 0x0200 1 2 3 4 5 6 7 8 9 10
extwrite 0x0500 9 8 7 6 5 4
###########################################################################
# Test Control Register
procedure test_control
int sw;
int bit;
#No Bits
write x base_rt0 R_CONTROL 0x8000
call rx_message 0 8 1 0x0000 1
set sw $RETVALUE;
compare sw 0x0000
#SREQUEST
#RTBUSY
write x base_rt0 R_CONTROL 0x8002
call rx_message 0 8 1 0x0000 1
set sw $RETVALUE;
compare sw 0x0008
#SSFLAG
write x base_rt0 R_CONTROL 0x8004
call rx_message 0 8 1 0x0000 1
set sw $RETVALUE;
compare sw 0x0004
#TFLAG
write x base_rt0 R_CONTROL 0x8008
call rx_message 0 8 1 0x0000 1
set sw $RETVALUE;
compare sw 0x0001
#TESTORUN
if TESTTXTOUTEN ! If this is disabled then we cant test
call use_busA
write x base_rt0 R_CONTROL 0x8010
call rx_message 0 8 32 0x0000 1
call tx_message_nochk 0 8 30 0x0000 1
write x base_rt0 R_CONTROL 0x8000
call use_busB
call get_bit 0
compare $RETVALUE 0xA989 # Expected Return BIT Value
call use_busA
call get_bit 0
compare $RETVALUE 0x2189 # Expected Return BIT Value now
endif
#TESTORUN
ifnot TESTTXTOUTEN ! tests will not overflow!
call use_busA
write x base_rt0 R_CONTROL 0x8010
call rx_message 0 8 32 0x0000 1
call tx_message_nochk 0 8 30 0x0000 1
write x base_rt0 R_CONTROL 0x8000
call use_busB
call get_bit 0
#BUSY bit
readmask x base_rt0 R_CONTROL 0x0000 0x0080 # should be non busy
call get_bit_nowait 0 # Should cause RT to busy
waitus 30 # after CW received
readmask x base_rt0 R_CONTROL 0x0080 0x0080 # should be busy now
pollbit x base_rt0 R_CONTROL 7 0 # wait for bit to zero
readmask x base_rt0 R_CONTROL 0x0000 0x0080 # should be non busy now
waitus 60 # Allow BC to recover
if LOCKRT
#RTADDR Bits RT0 has LOCK generic set
write x base_rt0 R_CONTROL 0x0908 # Try and change to RT9 plus terminal
flag
readcheck x base_rt0 R_CONTROL 0xA008 # Should fail to set, bit 15 always
set + parity
call sync_nodata 0 # Returns SW
compare $RETVALUE 0x0001 # Should Return SW from RT 0
call sync_nodata 9 # Returns SW
compare $RETVALUE 0xFFFF # No SW as no RT9
iosetbit 0
# make sure RT legalizes CW
#RTADDR Bits RT1 has LOCK set
write x base_rt1 R_CONTROL 0x8800 # Try and change to RT8 with lock on
readcheck x base_rt1 R_CONTROL 0x8100 # Should fail to set, bit 15 always
set + parity
call sync_nodata 1 # Returns SW
compare $RETVALUE 0x0800 # Should Return SW from RT 1
call sync_nodata 8 # Returns SW
compare $RETVALUE 0xFFFF # No SW as no RT8
endif
ifnot LOCKRT
#RTADDR Bits RT1 has LOCK not set
write x base_rt1 R_CONTROL 0x0800 # Try and change to RT8 with lock on
readcheck x base_rt1 R_CONTROL 0x0800 # Should now be set
call sync_nodata 1 # Returns SW
compare $RETVALUE 0xFFFF # Should not Return SW from RT 1
call sync_nodata 8 # Returns SW
compare $RETVALUE 0x4000 # RT8 returns status
return
###########################################################################
# Test Interrupt Register
procedure test_interrupt
return
###########################################################################
if readback
memtest RTbase 0x0100 256 2 500 0x23494579
endif
return
###########################################################################
###########################################################################
procedure test_rxtx;
int RT;
int SA;
int WC;
int base;
wait 6
header "Testing RX TX"
# Set up RTs
loop RT 0 (NRTS-1)
set base RT * 0x01000000 + 0x10000000
write h base R_CONTROL 0x8000
write h base R_INTERRUPT 0x0000
endloop
return
###########################################################################
-- 0: Internal to RT core
-- 1: External Input
-- 2: APB Registers
-- 3: APB RAM block
return
###########################################################################
# test Legality logic
# Mode 0
procedure test_legality_mode
int cmp;
return
procedure test_legality_mode0
int sw;
return
procedure test_legality_mode1
int sw;
return
procedure test_legality_mode2
int sw;
return
procedure test_legality_mode3
return
###########################################################################
# THESE ARE THE LOW LEVEL DRIVERS TO THE 1553B BUS CONTROLLER TEST MODULE
---------------------------------------------------------------------
-- Extension Bus Register Set for 1553B BC
--------------------------------------------------------------------
procedure use_busA
set CWORD 0x0001
return
procedure use_busB
procedure sync_nodata RT
int sw;
int cw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 1
waitus 10
extwait
extread 11 sw
return sw;
procedure get_lastsw RT
int sw;
int cw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 1
waitus 10
extwait
extread 11 sw
return sw;
procedure get_vw RT
int vw;
int cw;
extwrite 8 CWORD
return vw;
procedure get_bit RT
int bit;
int cw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 0
extwrite 1 8
extwrite 0 1
extwait
extread 13 bit
return bit;
procedure get_bit_nowait RT
int vw;
int cw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 1
return;
int edata;
int i;
int base;
int addr;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 3
waitus 10
extwait
extread 11 sw
return sw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 3
waitus 10
extwait
extread 11 sw
return sw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
extwrite 1 8
extwrite 0 3
waitus 10
extwait
extread 11 sw
return sw;
extwrite 8 CWORD
extwrite 9 CW
extwrite 13 16
return sw;
Actel backs its products with various support services including Customer Service, a Customer Technical Support
Center, a web site, an FTP site, electronic mail, and worldwide sales offices. This appendix contains information about
contacting Actel and using these support services.
Customer Service
Contact Customer Service for non-technical product support, such as product pricing, product upgrades, update
information, order status, and authorization.
From Northeast and North Central U.S.A., call 650.318.4480
From Southeast and Southwest U.S.A., call 650. 318.4480
From South Central U.S.A., call 650.318.4434
From Northwest U.S.A., call 650.318.4434
From Canada, call 650.318.4480
From Europe, call 650.318.4252 or +44 (0) 1276 401 500
From Japan, call 650.318.4743
From the rest of the world, call 650.318.4743
Fax, from anywhere in the world 650.318.8044
Website
You can browse a variety of technical and non-technical information on Actel’s home page, at www.actel.com.
Email
You can communicate your technical questions to our email address and receive answers back by email, fax, or phone.
Also, if you have design problems, you can email your design files to receive assistance. We constantly monitor the email
account throughout the day. When sending your request to us, please be sure to include your full name, company name,
and your contact information for efficient processing of your request.
The technical support email address is tech@actel.com.
Phone
Our Technical Support Center answers all calls. The center retrieves information, such as your name, company name,
phone number and your question, and then issues a case number. The Center then forwards the information to a queue
where the first available application engineer receives the data and returns your call. The phone hours are from 7:00 A.M.
to 6:00 P.M., Pacific Time, Monday through Friday. The Technical Support numbers are:
650.318.4460
800.262.1060
Customers needing assistance outside the US time zones can either contact technical support via email (tech@actel.com)
or contact a local sales office. Sales office listings can be found at www.actel.com/contact/offices/index.html.
P
product support 21–22
A customer service 21
Actel electronic mail 21
electronic mail 21 technical support 21
telephone 22 telephone 22
web-based technical support 21 website 21
website 21
T
C technical support 21
contacting Actel
customer service 21 W
electronic mail 21 web-based technical support 21
telephone 22
web-based technical support 21
customer service 21
5-02-00141-0/12.08