cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Andres2460
Observer
Observer
287 Views
Registered: ‎11-12-2020

Write on FPGA from PC

Hi there. I want to do a simple aplication in which I can set a value (1 or 0 ) in any input of my system by typing a comand in tcl console while FPGA is working. Do you know how can I do that? ...

 

 

 

Tags (2)
0 Kudos
3 Replies
dgisselq
Scholar
Scholar
177 Views
Registered: ‎05-21-2015

I usually handle inputs via serial ports, rather than TCL, since I can't normally ship a design with Vivado's infrastructure and TCL attached.  Would a serial port interface work for you?

That's question #1.  Question #2 would be, tell me more about what you mean by "set a value in any input in my design"?  Because this often requires logic, and overriding every FF within a design can become very expensive very quickly.

Dan

Andres2460
Observer
Observer
141 Views
Registered: ‎11-12-2020

Yes, serial port interface would work for me. What I wanted to say is to control some inputs of my system via serial port. For example set reset.

Thanks in advance

Jerson

pd: could you explain me how to do that?

0 Kudos
dgisselq
Scholar
Scholar
129 Views
Registered: ‎05-21-2015

@Andres2460 ,

I wrote several blog articles on this in the past.  You can find a list to most of them here.

In general, I have (roughly) one of four approaches I use for this task:

  1. The quickest, easiest, and simplest is just to use the serial port as an input and to split the input word into two parts: an address and a piece of data.  Then, always @(posedge clk) if (serial_port_data_read) serial_controlled_data[serial_data[7:4] *4 +: 4] <= serial_data[3:0] -- or something like that.
  2. The next several methods control a 32-bit bus.  That allows you to read and write peripherals, whether Wishbone (my favorite) or AXI-lite (or AXI).  With such a bus-based control capability, you can test the environment a CPU will use long before you place the CPU into that environment.  Of these, I have two implementations and I'm working on a third.  The first of the two is what I call a "hexbus", since all the data is passed using a hexadecimal representation.  That makes it easy (easier) to read by eye if you are inspecting the bus.  For example, "A" followed by a hexadecimal number would set the address to that value.  Following that with an "R" and a newline would then read from that address and return the result.  Likewise a "W" might prefix a piece of write data which, when followed by a newline, would write that data to the previously given address.
  3. The next method I have an use is one I call my "wbubus" (Wishbone control over Uart .. Bus).  This one is fancier, because it includes compression and decompression.  It's also fancier because it uses 6 bytes instead of 10 to transmit 32-bits of data together with a command.  So, it gets closer to a 53% efficiency (worst case) rather than the 32% efficiency the hexbus provides.  Just for reference, here's an picture outlining the basic components used in the wbubus.  It's used in the overview article which describes the components in more detail.wb-uart-ovw.png
  4. The last one is one I'm still working on.  It involves using 7-bits of data across 5 bytes to transmit 32-bits of data plus three control bits.  It should be able to get up to 71% efficiency (worst case)--but like I said, it's still something I'm working on.  Why not use 8-bits?  Well ... I'm known for stealing one of the bits so that I can share the serial port channel with the console port of my CPU.  I don't do this in all of my designs, but for those that require it, that console port can be quite valuable.

All of the hexbus design components are posted on-line (same link as above).  Feel free to download it and try it out.

Dan

 

0 Kudos