Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Using a BFM in system verification code.

Status
Not open for further replies.

dipk11

Junior Member level 2
Joined
Jul 27, 2017
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
245
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?
 

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:
  • Like
Reactions: dipk11

    dipk11

    Points: 2
    Helpful Answer Positive Rating
Thanks for your reply..i went through the user manual..it is okay to understand that...the example for spi looked really scary..

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:(
 

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?
 

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.
 
  • Like
Reactions: dipk11

    dipk11

    Points: 2
    Helpful Answer Positive Rating
It seems to me your problem has to do with not understanding SV interfaces. Maybe reading a tutorial on interfaces will help.
 
  • Like
Reactions: dipk11

    dipk11

    Points: 2
    Helpful Answer Positive Rating
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..
 

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?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top