• 0
emrenass

Real Time Simulation basys3

Question

Hi!

 

I'm currently implementing a game with led matrix using basys3. But sometimes it become hard to understand the mistake in the code if there is a problem with the code. I know how to use testbenches but in my case it's not really helpful. So I want to make a simulation with real time physical inputs. I mean the simulation show the results when I press a push button. Is it possible?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1

@emrenass,

Ouch.  What you are asking is a hard thing to do.  Real-time?  The whole purpose of an FPGA board is to be faster than any other solution out there.  FPGA's can be very difficult to beat in "real-time".  I can offer you, however, two classes of solutions that might help.  I've used both.

  1. Verilator.  Are you familiar with it?  It is a Verilog to C++ converter.  Using it, you can create c/C++ simulations of all of your pieces of hardware, and test whether or not things are working as you would like.  I've used it to create simulations of my Basys-3 board, my XuLA2-LX25 board, my CMod-S6 board, and most recently, my Arty board.  While I haven't done much to simulate the LEDs or the 7-segment display, I have simulated a PMod-OLEDrgb and even the Basys-3 VGA display.  Here's the problem with this approach, though: going at full swing, I can get the simulator to operate at a clock of 300kHz--not the 100MHz clock of the Basys3.  Using a GTKmm driver to handle video, I don't even get that rate.
  2. wbscope.  This is my version of a live capture/debug utility.  I hook it up to whatever "bus" the "cpu" within the FPGA is controlling, together my choice of 32-wires and a trigger.  This core works by recording everything it sees into a circular buffer.  Once the "trigger" takes place, the core continues recording for a programmable wait time before halting--allowing you to record everything that happened up to the trigger, until anytime following it.  Further, the "cpu" can set the device, reset the device, set the trigger, adjust the delay, and even read out the values and send them to whatever debugging facility you have.  Personally, I have a second bus master that I control via the UART port that I use to read from this device.  You may even notice that all of the projects listed above have wbscope's within them from where I've most recently been debugging.

I know Xilinx makes a chipscope utility.  You might find that easier to use than the wbscope, I just don't know--I've never used it.

In general, I find Verilator most useful before I know what to look for, and the wbscope most useful when I know when to look.

Hope that helps,

Dan

Share this post


Link to post
Share on other sites
  • 1

Hi Emrenass,

Adding to D@n's post the chipscope utility D@n referenced in vivado is called the integrated logic analyzer(ILA) which is free with newer(vivado 2015.4 and up) webpack license and the user manual is here

cheers,

Jon

Share this post


Link to post
Share on other sites
  • 0
12 hours ago, D@n said:

@emrenass,

Ouch.  What you are asking is a hard thing to do.  Real-time?  The whole purpose of an FPGA board is to be faster than any other solution out there.  FPGA's can be very difficult to beat in "real-time".  I can offer you, however, two classes of solutions that might help.  I've used both.

  1. Verilator.  Are you familiar with it?  It is a Verilog to C++ converter.  Using it, you can create c/C++ simulations of all of your pieces of hardware, and test whether or not things are working as you would like.  I've used it to create simulations of my Basys-3 board, my XuLA2-LX25 board, my CMod-S6 board, and most recently, my Arty board.  While I haven't done much to simulate the LEDs or the 7-segment display, I have simulated a PMod-OLEDrgb and even the Basys-3 VGA display.  Here's the problem with this approach, though: going at full swing, I can get the simulator to operate at a clock of 300kHz--not the 100MHz clock of the Basys3.  Using a GTKmm driver to handle video, I don't even get that rate.
  2. wbscope.  This is my version of a live capture/debug utility.  I hook it up to whatever "bus" the "cpu" within the FPGA is controlling, together my choice of 32-wires and a trigger.  This core works by recording everything it sees into a circular buffer.  Once the "trigger" takes place, the core continues recording for a programmable wait time before halting--allowing you to record everything that happened up to the trigger, until anytime following it.  Further, the "cpu" can set the device, reset the device, set the trigger, adjust the delay, and even read out the values and send them to whatever debugging facility you have.  Personally, I have a second bus master that I control via the UART port that I use to read from this device.  You may even notice that all of the projects listed above have wbscope's within them from where I've most recently been debugging.

I know Xilinx makes a chipscope utility.  You might find that easier to use than the wbscope, I just don't know--I've never used it.

In general, I find Verilator most useful before I know what to look for, and the wbscope most useful when I know when to look.

Hope that helps,

Dan

What I meant by real -time when I push a button on basys3 I want to see the change on variables value. This way I can see the problem on the codes. In testbenches it's hard to find the values in $display method since it can be really big values in sequential logics and hard to understand when the values change in so many row on the output console. I'm looking the solutions you provided right now. Thank you. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now