+ Post New Thread
Results 1 to 8 of 8
  1. #1
    Junior Member level 1
    Points: 517, Level: 4

    Join Date
    Jul 2017
    Posts
    17
    Helped
    0 / 0
    Points
    517
    Level
    4

    Using a BFM in system verification code.

    Hi all,
    I am new to system Verilog and learning to write a test bench for already existing code.
    I have a master.sv file which has the code for SPI master. I have written a basic testbench
    (master_tb.sv)to test the master, but to simulate the SPI bus I wanted to use a verification IP already provided by sysWip.
    The VIP has an interface file and a master_spi.sv file.
    How do I use it in my code?
    where do I instantiate the interface, start the spi environment and the connection?
    do I need to change anything in my master.sv file?

    •   AltAdvertisement

        
       

  2. #2
    Advanced Member level 4
    Points: 8,605, Level: 22
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,284
    Helped
    278 / 278
    Points
    8,605
    Level
    22
    Blog Entries
    1

    Re: Using a BFM in system verification code.

    It should be possible to instantiate the BFM in your master testbench. The syswip IP should have some doc on that.
    Years ago I used the syswip axi4lite BFM is my master SV testbench and was successful.

    You need to do some 'import' of the BFM and later instantiate the master and/or salve interface/s.
    I don't remember the exact steps. All I can say is that it was not easy-peesy and straightforward in the beginning, but after playing with it for a couple of days and Googling, I could successfully connect the BFM and it was generating and monitoring data on the axi4lite bus.
    Last edited by dpaul; 15th November 2019 at 10:03.
    FPGA enthusiast!


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  3. #3
    Junior Member level 1
    Points: 517, Level: 4

    Join Date
    Jul 2017
    Posts
    17
    Helped
    0 / 0
    Points
    517
    Level
    4

    Re: Using a BFM in system verification code.

    Thanks for your reply..i went through the user manual..it is okay to understand that...the example for spi looked really scary..

    Quote Originally Posted by dpaul View Post
    You need to do some 'import' of the BFM and later instantiate the master and/or salve interface/s.
    I don't remember the exact steps. .
    Just a clarification here, to test my master.sv file..i will have to import the slave interface right?
    Do the connections of my master port with the slave?

    I had first done the DUT port connections in my testbench, but since I am using this interface I will have to do it in my master.sv file like how they have shown in their examples...Am I right?
    All confused:(



    •   AltAdvertisement

        
       

  4. #4
    Junior Member level 1
    Points: 517, Level: 4

    Join Date
    Jul 2017
    Posts
    17
    Helped
    0 / 0
    Points
    517
    Level
    4

    Re: Using a BFM in system verification code.

    Hi...explaining my doubt again..incase there is anybody who has used the IP before do help..

    I have a master.sv file which has the code for SPI master. I have written a basic testbench
    (master_tb.sv)to test the master, but to simulate the SPI bus I wanted to use a verification IP already provided by sysWip(http://syswip.com).
    The VIP has an interface file and a package file.
    How do I use it in my code?
    where do I instantiate the interface, start the spi environment and the connection?
    do I need to change anything in my master.sv file?

    my master.sv file is given below
    module master
    (
    input clk,
    output sdi,
    input sdo,
    output sclk,
    output [2:0] slave_select
    );

    i have just typed the code for the test bench.

    module master_tb();
    wire sclk;
    reg clk;
    reg sdo;
    wire sdi;
    wire [2:0] slave_select;

    master_tb dut(
    .sclk(sclk),
    .sdo(sdo),
    .......
    and so on

    where do i do the import of the interface?
    do i need master interface too? or just the slave interfcae is needed to test my code?
    Is there any simple sample code availbale?



  5. #5
    Advanced Member level 4
    Points: 8,605, Level: 22
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    1,284
    Helped
    278 / 278
    Points
    8,605
    Level
    22
    Blog Entries
    1

    Re: Using a BFM in system verification code.

    Did you consult the *_user_manual.pdf that comes with the download?

    You have written the master module, so you need to use the BFM as a slave.

    See the section "3. SPI Slave" @ Page6. Then follow the instructions given @ the Integration and Usage section.
    FPGA enthusiast!


    1 members found this post helpful.

  6. #6
    Super Moderator
    Points: 31,889, Level: 43
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    7,382
    Helped
    1731 / 1731
    Points
    31,889
    Level
    43

    Re: Using a BFM in system verification code.

    It seems to me your problem has to do with not understanding SV interfaces. Maybe reading a tutorial on interfaces will help.


    1 members found this post helpful.

  7. #7
    Junior Member level 1
    Points: 517, Level: 4

    Join Date
    Jul 2017
    Posts
    17
    Helped
    0 / 0
    Points
    517
    Level
    4

    Re: Using a BFM in system verification code.

    thanks for the reply..the tutorial did help me understand the interfaces in sv..but when i check the example codes provided by syswip and the tutorials...the connections and instantiation of the interface seems different.
    What I understand by now is...my master.sv file will be the top level file...instantiate the interface here...
    also make the connections here..
    I hope my understanding is correct..



    •   AltAdvertisement

        
       

  8. #8
    Junior Member level 1
    Points: 517, Level: 4

    Join Date
    Jul 2017
    Posts
    17
    Helped
    0 / 0
    Points
    517
    Level
    4

    Re: Using a BFM in system verification code.

    Hi...I could do connections to the slave VIP.
    I could see the data that the master writes on the sdi line...
    Now my next task is to use the functions in available in the slave environment and get the data that is written by the master.
    The SysWip(http://syswip.com/) has two functions for the slave- putdata and getdata..
    I am not sure how to use these functions to read the data from the slave side.
    Do I have to assign the serial data of sdi line somewhere?



--[[ ]]--