Forum Discussion
Altera_Forum
Honored Contributor
14 years agoTutorial: Using the USB-Blaster as an SOPC/Qsys Avalon-MM master
Hi all,
I've put together a tutorial on how to use the Altera JTAG-to-Avalon-MM master and Altera Verification IP Avalon-MM BFM Master under both SOPC builder and Qsys. http://www.ovro.caltech.edu/~dwh/correlator/pdf/altera_jtag_to_avalon_mm_tutorial.pdf (http://www.ovro.caltech.edu/%7edwh/correlator/pdf/altera_jtag_to_avalon_mm_tutorial.pdf) http://www.ovro.caltech.edu/~dwh/correlator/pdf/altera_jtag_to_avalon_mm_tutorial.zip (http://www.ovro.caltech.edu/%7edwh/correlator/pdf/altera_jtag_to_avalon_mm_tutorial.zip) The tutorial walks the user through the creation of an SOPC or Qsys system design, and provides scripts that automate the re-generation of the system. The tutorial shows how to simulate using Modelsim-ASE, and shows how to communicate with the hardware using System Console, quartus_stp, and then how to run a TCP/IP server under System Console or quartus_stp, and then communicate with that server from client code written in Tcl/Tk (a simple GUI) and a command-line C interface. Let me know if you like it, or have feedback/suggestions on how to improve the document. Cheers, Dave119 Replies
- Altera_Forum
Honored Contributor
Hi Kimberley,
Glad to read that you managed to figure out how to get the tutorial to compile in 10.1. The errors you see from executing the .do file are due to the path changes in the component heirarchy. You can probably fix these errors; in the tutorial on page 18 there is a picture of the Modelsim hierarchy window showing the path to the JTAG node. Use the Modelsim GUI to look at this path name in the version you are using - it will be slightly different - edit the .do file and change the names of the signals that have an incorrect path. Re-run the script a couple of times until you have the names correct, i.e., until Modelsim does not generate a warning. Altera changes the hierarchy of some components between versions, so its difficult to write a tutorial that works under all versions :) Another way to use the tutorial, is as a method for learning how to create your own custom SOPC systems. You can use the tutorial and Quartus 11.1sp1 to learn how to create a system, and then use Quartus 10.0 to create your own systems. Let me know if you have any troubles and I'll try to help. Cheers, Dave - Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
Hi Dave,
Another question I have is the following: On page 37 I read the sentences: --- Quote Start --- “The Tcl fileevent command is critical to the implementation of a Tcl TCP/IP server. Versions of Systems Console earlier than Quartus II version 11.1sp1 did not support the Tcl filevent procedure…” --- Quote End --- This would mean that the program won’t run in my quartus 10.1 version? Do you have a solution for this? For example is it possible to split this up? Meaning, if I install also quartus 11.1sp1 and run this tcl server/client program from a 11.1sp1 quartus_sh terminal, can I then still communicate to my sopc system generated in quartus 10.1? Rgds, Kimberley - Altera_Forum
Honored Contributor
Hi Kimberley,
--- Quote Start --- See attached my modelsim image. It's quite different then the image in the document. Where can I find the similair signals? --- Quote End --- Look back at the code you just edited - line 45
When you edited the VHDL to change the VTAP path, all you needed to do was edit the .do file to change the same path. I didn't tell you this earlier, as I wanted you to look at the Modelsim hierarchy window so that you would see the correspondence. Problem solving is how you begin to understand these tools. Cheers, Daveline 40: // Quartus 10.0 line 41: // ------------ line 42: // The component hierarchy is slightly different for Quartus versions line 43: // earlier than 11.1sp1. The sopc_system_jtag_master_tb.do script line 44: // JTAG master nodes also change names. line 45: //`define VTAP dut.the_jtag_master.jtag_master.normal.altera_jtag_avalon_master_pli_off_inst.the_altera_jtag_avalon_master_jtag_interface_pli_off.altera_jtag_avalon_master_jtag_interface_pli_off.normal.jtag_dc_streaming.jtag_streaming.node - Altera_Forum
Honored Contributor
--- Quote Start --- Another question I have is the following: On page 37 I read the sentences: This would mean that the program won’t run in my quartus 10.1 version? Do you have a solution for this? --- Quote End --- Of course :) Read the source code (jtag_server.tcl) ...
Note that this applies to SystemConsole, whereas quartus_stp (another tool) works fine. --- Quote Start --- For example is it possible to split this up? Meaning, if I install also quartus 11.1sp1 and run this tcl server/client program from a 11.1sp1 quartus_sh terminal, can I then still communicate to my sopc system generated in quartus 10.1? --- Quote End --- Yes, you can use a newer version of Quartus to communicate with the design after it has been downloaded. The JTAG protocol has not changed between Quartus versions. Cheers, Dave# SystemConsole (prior to Quartus 11.1sp1) # # * There is no support for fileevent, so SystemConsole# has to busy loop on one client at a time.# # * If the client closes its connection cleanly via# client_close, then the socket generates an EOF# and the server will wait for the next client.# # * However, if the client disconnection is not cleanm,# eg., the client uses exit or ctrl-C to exit, then# the server does not receive an eof, and it remains# blocked on the dead client connection. New clients,# will not be handled!# # In constrast, when the server is run under# quartus_stp, the server log indicates that a ctrl-C# from a client quartus_stp generates an # 'empty command' followed by 'disconnected'# puts "Handle the client via a blocked read on the socket" while {!} { client_handler $client } - Altera_Forum
Honored Contributor
Hi Dave,
Thanks for the information. But I think you are a few steps further then I am. In the post of "November 2nd, 2012, 09:22 AM" I reported that ModelSIM is giving error's on the signals of the JTAG master. I think I solved them by changes the "sopc_system_jtag_master_tb.do" file into
When I compare the bfm simulation and this jtag simulation they are comparable. See also the attached modelsim files of the jtag simulation. It shows the complete names as well as the values. Your hint to look at the VTAP location points me in the exact location to see the similar picture of figure 7 on page 18 of your document, for quartus 10.1. Thanks for that. However...sorry for being such a newbie... I'm missing the point your are trying to make in par 3.5.3. on page 17 and the figure on page 18. I try to understand the text, but this is higher science for me. Rgds, Kimberleyadd wave -noupdate -divider {JTAG Master}# add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/master_write# add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/master_read# add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/master_address# add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/master_byteenable# add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/master_writedata# add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/master_readdata# add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/master_waitrequest# add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/master_readdatavalid add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/write_from_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/read_from_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/address_from_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/byteenable_from_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/writedata_from_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate -radix hexadecimal /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/readdata_to_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/waitrequest_to_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate /sopc_system_jtag_master_tb/dut/the_jtag_master/jtag_master/readdatavalid_to_the_altera_jtag_avalon_master_packets_to_transactions_converter add wave -noupdate -divider {LED PIO} - Altera_Forum
Honored Contributor
--- Quote Start --- Your hint to look at the VTAP location points me in the exact location to see the similar picture of figure 7 on page 18 of your document, for quartus 10.1. Thanks for that. --- Quote End --- You're welcome. --- Quote Start --- However...sorry for being such a newbie... I'm missing the point your are trying to make in par 3.5.3. on page 17 and the figure on page 18. I try to understand the text, but this is higher science for me. --- Quote End --- No need to apologize. The best way to learn is to try to understand why and how things work. The purpose of the comment at the start of that section: “Test what you fly, and fly what you test” Is that you should simulate exactly what you plan on testing in hardware. If you simulate a different IP block, than the you use in hardware (synthesize), then what's the point of your simulation? Altera recommends using a BFM for simulation, and then expects you to trust them that a completely different component, the JTAG-to-Avalon-MM bridge "Just works" - there is no official simulation support for that component. So when you test your Avalon-MM slave IP using a BFM and then synthesize hardware and use a JTAG-to-Avalon-MM bridge, although your slave IP is common, the master IP is not, so you are not testing what you fly. Your slave component might have bugs that only show up in the hardware test and not in simulation, because the masters generate different Avalon-MM transactions. The JTAG-to-Avalon-MM analysis document that the tutorial links to has a deeper analysis of that component, and there are minor errors in its design. Cheers, Dave - Altera_Forum
Honored Contributor
Hi Dave,
Thanks for explaining. Now it's more clear. Rgds, Kimberley - Altera_Forum
Honored Contributor
Hi Dave,
I'm trying to compile the design. And in the past I never had trouble in adding my sopc file to a quartus project. I looked at your synthese scripts but didn't use them. I get two error messages on the bfm_master and the jtag_master. --- Quote Start --- Error: Node instance "bfm_master" instantiates undefined entity "altera_avalon_mm_master_bfm" Error: Node instance "jtag_master" instantiates undefined entity "altera_jtag_avalon_master" [/QOUTE]I'm wondering if a specific file needs to be added to my project? See also the attached image and the qar file. Rgds, Kimberley - Altera_Forum
Honored Contributor
Hi Kimberley,
--- Quote Start --- I'm trying to compile the design. And in the past I never had trouble in adding my sopc file to a quartus project. I looked at your synthese scripts but didn't use them. I get two error messages on the bfm_master and the jtag_master. Error: Node instance "bfm_master" instantiates undefined entity "altera_avalon_mm_master_bfm" Error: Node instance "jtag_master" instantiates undefined entity "altera_jtag_avalon_master" I'm wondering if a specific file needs to be added to my project? --- Quote End --- These files are listed in the .qip file. You should be able to use "Project->Add/remove files in project" to add the .qip file to the project. Try synthesizing the project after you've added the .qip. If you still cannot get it to work, try running my synthesis script and see if that builds correctly. If it does not, let me know, and I'll install version 10.1 and see if I can figure it out. Cheers, Dave