I am working on a project for school that will involve an input from a push button or related device. We have only a few Spartan boards available, but we have access to Xlinx Vivado to simulate an FPGA instead. The goal is to analyze data on differing lengths of time that the button is held down.

I want to know if I can program the simulation to accept input from the keyboard attached to the computer in place of the push button.

If not, is there another simulation software I could use? Or is there a way to log the output on the Spartan board so I can download it later and analyze the results.


Edit: How do I do this in the testbench?


The simulation is not running at real-time speed, so even if you could use the keyboard as an input to the simulation you would not be able to reliably determine how long a key was pressed.

You need to create a testbench for your project, and simulate a key press in the testbench. This will allow you to precisely control the length of the key press signal while observing all of the important signals inside your design.

  • \$\begingroup\$ Can the testbench accept keyboard input directly, or do I program it to pretend a key was pressed for an arbitrary length of time? \$\endgroup\$ Nov 20 '18 at 20:27
  • \$\begingroup\$ You add statements to the testbench that simulate the press of a key for a specific amount of time. You seem to be missing the point...even if the testbench could accept keyboard input it would not be in real time. \$\endgroup\$ Nov 20 '18 at 22:22
  • \$\begingroup\$ Thank you for your answer. From what I was finding I didn't know if a simulation could take real time input or not. If I did get an actual board and connected a button to it, is there an easy way to log the input data so that I could grab if from the board later for analysis? \$\endgroup\$ Nov 20 '18 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.