apb_vip_user_manual.pdf

download apb_vip_user_manual.pdf

of 18

Transcript of apb_vip_user_manual.pdf

  • 8/14/2019 apb_vip_user_manual.pdf

    1/18

    SysWip APB Verification IP User Manual

    SysWipAlternative Verification

    AMBA Peripheral Bus Verification IP

    User ManualRelease 1.0

    Page 1 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    2/18

  • 8/14/2019 apb_vip_user_manual.pdf

    3/18

  • 8/14/2019 apb_vip_user_manual.pdf

    4/18

    SysWip APB Verification IP User Manual

    2. APB Master

    The APB Master Verification IP(VIP) is generating transactions on the APB bus. It can also beconsidered as a AHB/APB bridge replacement used in real designs. Please note that it does not have

    AHB/APB bridge functionality and can only be considered bridge replacement from APB side.

    The APB VIP supports only one slave device. For connecting more slaves external decoder is

    needed.

    Features

    The APB Master VIP has the following features:

    Configurable data bus width 8, 16 and 32 bits wide

    Misaligned transfers

    Fixed and random transfer delay insertion

    Configurable pready time out

    Slave error detection and configurable error messages

    Complete data packet transaction read/wite

    Bus idle cycle insertion

    Address polling

    Failed transaction buffer

    Configuration Commands

    All configuration commands listed bellow have zero cycle execution time and executingimmediately without waiting in the queue.

    APB data bus width: Can be set only during APB object creation and cannot be changed

    during simulation.

    setPreadyTimeOut():

    setPollTimeOut():

    setDelay():

    rndDelayEn():

    setErrMsgs():

    Data Transfer Commands

    Commands marked as a queuedwill be put in the one queue and executed sequentially.

    Commands marked as a blocking will block other commands execution until finishing own process.

    Page 4 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    5/18

    SysWip APB Verification IP User Manual

    writeData(): - queued,

    writeWord(): - queued, non blocking

    readData(): - queued, blocking

    readWord(): - queued, blocking

    pollWord(): - queued, blocking

    busIdle(): - queued, non blocking

    Other Commands

    startEnv(): - non queued, blocking, should be called only once for current object

    EnvReset(): - non queued, blocking

    printFailedTrInfo(): - non queued, non blocking

    Commands Description

    All commands areABP_m_envclass methods and will be accessed only via class objects.

    setPreadyTimeOut()

    Syntax

    setPreadyTimeOut(timeOutCycles)

    Arguments

    timeOutCycles: An intvariable that specifypreadysignal waiting clock

    cycles.

    Description

    Sets the maximum number of wait clock cycles forpready signal. After

    activatingpselVIP waits valid pready signal. If pready is not valid during

    specified clock cycles than VIP will generate error message and continue with

    next transaction.

    setPollTimeOut()

    Syntax

    setPollTimeOut(timeOutCycles)

    Arguments

    timeOutCycles: An intvariable that specify maximum poll clock cycles.

    Description

    Sets the maximum number of poll clock cycles after which poll task will be

    stopped and poll time out error message generated. The only task in APB

    Master VIP where poll time out is used ispollWord().

    Page 5 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    6/18

    SysWip APB Verification IP User Manual

    setDelay()

    Syntax setDelay(burstLength, waitCycle)

    Arguments

    burstLengt: An intvariable that specify the maximum number of transactions

    whenpsel signal can be continuously high. For disabling delays put this value

    to 0.

    waitCycle: An intvariable that specify the number of wait cycles. When

    burstLengt is 0 waitCycle willbe ignored.

    Description

    Sets APB bus timing delay. Which means to set some constraints to psel

    signal. The value specified in the burstLengt argument is the maximum

    number of transactions whenpsel signal can be continuously high. Then psel

    will go to low and wait several clock cycles specified in the waitCycle

    argument. For disabling delay call this function with 0 as a first argument.The second one will be ignored.

    rndDelayEn()

    Syntax

    rndDelayEn(minBurst, maxBurst, minWaitCycle, maxWaitCycle) Arguments

    minBurst: An intvariable that specify the minimum value for burstLengt

    maxBurst: An intvariable that specify the maximum value for burstLengt

    minWaitCycle: An intvariable that specify the minimum value for waitCycle

    maxWaitCycle: An intvariable that specify the maximum value for waitCycle

    Description

    Enables APB bus timing random delays. After each transaction new randomvalue will be generated for burstLengt andwaitCycle. The generated random

    value will be in the range specified in the function arguments. For disablingrandom delays call setDelay() function with 0 value in the first argument.

    setErrMsgs()

    Syntax

    setErrMsgs(timeOutMsg, slaveErrorMsg)

    Arguments

    timeOutMsg: A string variable that specify the message which will be

    displayed during time out error.

    Page 6 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    7/18

    SysWip APB Verification IP User Manual

    SlaveErrorMsg: A stringvariable that specify the message which will be

    displayed during APB bus slave error detection.

    Description

    Setspready time out and slave error messages. The message will be displayedin you terminal if corresponding error ocured.

    writeWord()

    Syntax

    writeWord(address, dataWord)

    Arguments

    address: A 32 bit vector that specifies APB address.

    dataWord: A 32 bit vector that specifies APB write data word.

    Description

    Writes one data word on specified address. If APB data width is less then 32

    bits then only corresponding least bits will be used as a data. This task createsonly one write transaction even APB data width is less then 32 bits. So if

    data bus is 8 bits and this task was called then only dataWord[7:0] will be

    written.

    writeData()

    Syntax

    writeData(address, dataInBuff, addrIncr)

    Arguments

    address: A 32 bit vector that specifies APB write start address

    dataInBuff: A 8 bit vector queue that contains data buffer which should be

    transferred

    addrIncr: An int variable that specify will address be incremented or noduring complete data buffer transfer. If you don't specify this argument it will

    be considered as 1.

    Description

    Writes complete data buffer on specified address. If addrIncr is 0 then all data

    will be written on the same address. It can be useful if you want to write

    FIFO. If addrIncr is 1 or not specified then address will be incremented after

    each transaction. Incremented value depends on APB data bus width.

    readWord()

    Syntax

    readWord(address, dataWord)

    Arguments

    Page 7 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    8/18

  • 8/14/2019 apb_vip_user_manual.pdf

    9/18

  • 8/14/2019 apb_vip_user_manual.pdf

    10/18

    SysWip APB Verification IP User Manual

    apb_vip/verification_ip/masterfolder.

    For usage the following steps should be done:

    1. ImportAPB_Mpackage into your test.

    Syntax: import APB_M::*;

    2. CreateABP_m_envclass object

    Syntax: ABP_m_env apb = new(apb_ifc, 4);

    Description: apb_ifc is the reference to the APB Master interface instance name.The second argument is APB bus data width in bytes.

    3. Start APB Master Environment.

    Syntax: apb.startEnv();

    This is the all you need for integration. Now you can configure the VIP and start data transfers.

    Page 10 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    11/18

    SysWip APB Verification IP User Manual

    3. APB Slave

    The APB Slave Verification IP does not initiate any transfers and only responds to transactionsinitiated by the APB Master. The APB Slave VIP has a memory element to hold transfer data. It also

    has FIFO mode support. In FIFO mode all read data words will be popped from output FIFO and all

    write data words will be pushed to input FIFO.

    Features

    The APB Slave VIP has the following features:

    Configurable data bus width 8, 16 and 32 bits wide

    Misaligned transfers

    Fixed and random delay insertion for pready signal

    Configurable poll time out

    Slave error insertion for specified addresses

    Input and Output FIFO mode

    Failed transaction buffer

    Configuration Commands

    All configuration commands listed bellow have zero cycle execution time and executingimmediately without waiting in the queue.

    APB data bus width: Can be set only during APB object creation and cannot be changed

    during simulation.

    setPollTimeOut():

    setDelay():

    rndDelayEn():

    setFifoAddr():

    disableFifoMode():

    setSlaveErrAddr():

    disableSlaveErr():

    Data Processing Commands

    Commands marked as a queuedwill be put in the one queue and executed sequentially.

    Commands marked as a blocking will block other commands execution until finishing own process.

    putWord(): - non blocking

    putData(): - non blocking

    Page 11 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    12/18

    SysWip APB Verification IP User Manual

    getWord(): - non blocking

    getData(): - non blocking

    pollWord(): - blocking

    writeFifoWord(): - non blocking

    writeFifo(): - non blocking

    readFifoWord(): - blocking

    readFifo(): - blocking

    Other Commands

    startEnv(): - non blocking, should be called only once for current object

    fifoReset(): - non blocking

    printFailedTrInfo():- non blocking

    Commands Description

    All commands areABP_s_envclass methods and will be accessed only via class objects.

    setPollTimeOut()

    Syntax

    setPollTimeOut(pollTimeOut)

    Arguments

    pollTimeOut: An intvariable that specify maximum poll clock cycles.

    Description

    Sets the maximum number of poll clock cycles after which poll task will be

    stopped and poll time out error message generated. If set to zero time out

    never occurs.

    setDelay()

    Syntax

    setDelay(preadyDelay)

    Arguments

    preadyDelay: An intvariable that specify thepready delay cycles after valid

    psel signal.

    Description

    Setspreadytiming delay. After validpsel signal thepready will be delayed

    specified amount of clock cycles. If set to zero then thepreadywill alwaysbe valid.

    rndDelayEn()

    Page 12 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    13/18

    SysWip APB Verification IP User Manual

    Syntax

    rndDelayEn(minPready, maxPready)

    Arguments

    minPready: An intvariable that specify the minimum value forpreadyDelay

    maxPready: An intvariable that specify the maximum value forpreadyDelay

    Description

    Enables preadytiming random delays. After each transaction new random

    value will be generated forpreadyDelay. The generated random value will be

    in the range specified in the function arguments. For disabling random delays

    call setDelay() function.

    setFifoAddr()

    Syntax

    setFifoAddr(inFifoAddr, outFifoAddr)

    Arguments

    inFifoAddr: A32 bit vector that specify the input FIFO address.

    outFifoAddr: A32 bit vector that specify the output FIFO address.

    Description

    Sets addresses for in/out FIFOs and enables FIFO mode. Data word written

    by master at inFifoAddr address will be pushed to the input FIFO. Data wordread by master at outFifoAddr address will be popped from the output FIFO.

    disableFifoMode()

    Syntax

    disableFifoMode()

    Arguments

    non

    Description

    Disables FIFO mode. Input and output FIFO addresses will be switched to

    memory addresses.

    setSlaveErrAddr()

    Syntax

    setSlaveErrAddr(startAddr, endAddr)

    Arguments

    startAddr: A32 bit vector that specify the start address for slave error space.

    endAddr: A32 bit vector that specify the end address for slave error space.

    Page 13 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    14/18

    SysWip APB Verification IP User Manual

    Description

    Sets address space for APB slave error generation. All read or write

    transactions initiated by master inside this space will generate slave errorpslverrsignal will be set.

    disableSlaveErr()

    Syntax

    disableSlaveErr()

    Arguments

    non

    Description

    Disables APB slave error generation.

    putWord()

    Syntax

    putWord(address, dataWord)

    Arguments

    address: A 32 bit vector that specifies internal memory address.

    dataWord: A 32 bit vector that specifies memory write data word.

    Description

    Writes one data word to the internal memory on specified address. Data word

    size depends on APB data width. It can be 1, 2 and 4 bytes.

    putData()

    Syntax

    putData(address, dataInBuff)

    Arguments

    address: A 32 bit vector that specifies internal memory address.

    dataInBuff: A 8 bit vector queue that contains data buffer which will bewritten to the internal memory. First byte will be written at address.

    Description

    Writes data buffer to the internal memory starting from specified address.

    Each next byte will be written after address increment.

    getWord()

    Syntax

    dataWord = getWord(address)

    Arguments

    Page 14 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    15/18

    SysWip APB Verification IP User Manual

    address: A 32 bit vector that specifies internal memory address.

    dataWord: A 32 bit vector that contains memory read data word.

    Description

    Reads one data word from the internal memory on specified address

    getData()

    Syntax

    getData(startAddr, dataOutBuff, lenght)

    Arguments

    startAddr: A 32 bit vector that specifies internal memory address.

    dataOutBuff: A 8 bit vector queue that contains output data buffer which is

    read from the internal memory.

    length: Anint variable that specifies the amount of data (in bytes) which will

    be read from the internal memory.

    Description

    Reads length bytes data from the internal memory starting from specifiedaddress and put them into dataOutBuff output buffer.

    pollWord()

    Syntax

    pollWord(pollAddr, pollData)

    Arguments

    pollAddr: A 32 bit vector that specifies internal memory address.

    pollData: A 32 bit vector that contains expected value which will be

    compared with memory data.

    Description

    Reads internal memory specified address until the read data word is equal to

    expected pollData data. If time out occurred generates error message and

    returns

    writeFifoWord()

    Syntax

    writeFifoWord(dataWord)

    Arguments

    dataWord: A 32 bit vector data word.

    Description

    Pushes one data word to the output FIFO.

    Page 15 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    16/18

  • 8/14/2019 apb_vip_user_manual.pdf

    17/18

    SysWip APB Verification IP User Manual

    printFailedTrInfo()

    Syntax

    printFailedTrInfo()

    Arguments

    non, returns number of failed transactions

    Description

    Displays all time out errors occurred during full simulation time. This

    function returns the number of all errors in the buffer. Please not that this

    function clears failed transactions buffer.

    fifoReset()

    Syntax

    fifoReset()

    Arguments

    non

    Description

    Removes all data words from input and output FIFOs.

    Integration and Usage

    The APB Slave Verification IP integration into your environment is very easy. Instantiate theapb_s_if interface in you testbench top file and connect interface ports to your DUT. Then during

    compilation don't forget to compile apb_s.sv and apb_s_if.sv files located inside the

    apb_vip/verification_ip/slave folder.

    For usage the following steps should be done:

    1. ImportAPB_Spackage into your test.

    Syntax: import APB_S::*;

    2. CreateABP_s_envclass object

    Syntax:ABP_s_env apb = new(apb_ifc, 4); Description: apb_ifc is the reference to the APB Slave interface instance name. The

    second argument is APB bus data width in bytes.

    3. Start APB Slave Environment

    Syntax: apb.startEnv();

    This is the all you need for integration. Now you can configure the VIP and start data processing.

    Page 17 of 18 Release 1.0

  • 8/14/2019 apb_vip_user_manual.pdf

    18/18

    SysWip APB Verification IP User Manual

    4. Important Tips

    In this section some important tips will be described to help you to avoid VIP wrong behavior.

    Master Tips

    1. CallstartEnv() task as soon as you createdABP_m_envobject before any other commands.

    You should call it not more then once for current object.

    2. Before using Data Transfer Commands be sure that external hardware reset is done. As

    current release does not support external reset detection feature so the best way is to wait

    several clock cycles before DUT reset is done.

    3. CallprintFailedTrInfo() at the end of the test. As this function will empty error buffer so you

    will loss error information calling it in the middle of test. Error messages will be lost in youterminal and it will be difficult to find them after test is done.

    4. If you want to use rndDelayEn() function be sure that arguments are correct. The argumentspecifying minimum value should not be more then the argument specifying maximum

    value.

    5. As all configuration commands are non queued and all Data Transfer Commands are

    queued so you will have synchronization issues if want to apply specific configuration to

    current transaction. Here one working around for that. Be sure that transaction buffer is

    empty. For that you can use readWord() command with dummy address. After this commandchange configuration and then write your data. After writing data you should wait for write

    transaction done. Use readWord() command again with dummy address.

    Slave Tips

    1. CallstartEnv() task as soon as you createdABP_s_envobject before any other commands.

    You should call it not more then once for current object. Also be sure that this task was

    called before first valid transaction initiated by APB master.

    2. CallprintFailedTrInfo() at the end of the test. As this function will empty error buffer so youwill loss error information calling it in the middle of test. Error messages will be lost in you

    terminal and it will be difficult to find them after test is done.

    3. If you want to use rndDelayEn() function be sure that arguments are correct. The argumentspecifying minimum value should not be more then the argument specifying maximum

    value.

    4. For the commands which processing words (putWord, getWord and pollWord) the word size

    is equal to the APB bus data size. It is set during APB VIP object creation. If data size is 2

    bytes (16 bits) then putWord function will write only 2 bytes to the internal memory. First

    byte will be written at address provided by argument and the second byte to the incremented

    address. When you are using pollWord command be sure that polling data is not more thanallowed maximum value. The allowed maximum value depends on APB bus data size.

    When APB bus data size is 8 bits the allowed maximum value is 255, if 16 bits then it is

    0xffff.

    Page 18 of 18 Release 1.0