Jump to content
  • 0

How to read numbers in a file to Basys 3 board?


zzzhhh

Question

Assume there is a file in host Windows 10 PC which contains only a byte. A Basys 3 Artix-7 FPGA Developer Board is connected to the host through a micro-USB cable. I would like to program FPGA so that it can read the byte in the file in host (since micro-USB cable is the only connection between host and Basys 3, FPGA will read through this micro-USB cable), and then display its value in decimal form on LED. Is there any way to do it? I know Verilog has system task functions for file I/O, but not sure if they are applicable in this scenario. Thanks for your help.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @zzzhhh

Verilog file I/O is not applicable, it's only for use in simulation and for defining the initial states of signals and memories, not for dynamic loading and transfer of files - Verilog describes hardware and doesn't touch anything outside of the FPGA unless you explicitly describe a way to do so. Data transfer between a PC and FPGA hardware can be a big topic, however, for the simplest approach, I'd point to designing a UART receiver, implementing it in the FPGA, and sending data to it using a serial port on the host computer. USBUART hardware on the board provides an interface that lets this controller be relatively simple, and drivers that get installed with Vivado can be used to connect to a serial port from apps like Tera Term (or from stuff like Python with the pyserial module). In addition to the UART controller, you'd also need to design something to convert from the UART's 8-bit data to whatever your LED representation is and to control the LEDs. A project like this is a pretty good early thing for getting your hands dirty.

Thanks,

Arthur

Link to comment
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
×
×
  • Create New...