System Console File IO Example

Showing results for 
Search instead for 
Did you mean: 

System Console File IO Example

System Console File IO Example


This wiki page is dedicated towards users that want to use system console to read files and write to files. Many users leverage System console to write manufacturing test programs or other programs that require some sort of stimulus. Rather than manually enter via System console GUI or command line, an input file can be used as stimulus. Similarly, some users may want to dump large amounts of data to a file and do some post-processing work. This article demonstrates file IO using system console. It contains a read file example and a write file example.

The input and output tcl file examples can be downloaded below and adjusted to fit your specific application. To run the demonstration, you will need a BeMicro SDK development kit.

BeMicro SDK

As of 1/25/19, it looks like the Cyclone III based BeMicro SDK is no longer for sale. The project should be easily adaptable via IP conversion to many other development kits or even your custom board.

Example Project

The tcl files included in this article go with the following design:

System Console Demo 16.1.2.tar.gz

This same design and related description can be found here:

BeMicro SDK System Console Demo

Example Tcl Script for file input and associated input txt file

File input example.tcl


Example Tcl Script for file output

File output example.tcl

Steps to run the example input and output tcl files

If you have access to the BeMicro SDK, the following steps will run the input and output tcl file demos. Quartus 16.1.2 was used for the example.

* Download the System_Console_Demo_16.1.2.tar.gz file

*Download the file input and file output example files

*Open a NIOSII command shell



*Do a tar -xzvf on the file, System_Console_Demo_16.1.2.tar.gz, to expand it

*Plug in the BeMicro SDK board into a USB port on your computer

*cd to the tcl_src directory from the project directory

*run the file



*The BeMicro SDK board should load, a system console window should come up and show that the system is up and running.



*Go to the OCRAM tab



*Source the File_input_example.tcl file



*Source the File_output_example.tcl file



*Inspect the output file, testoutput.txt file.



Version history
Last update:
‎12-27-2022 01:56 PM
Updated by: