Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

direct serial cable to FPGA?

Altera_Forum
Honored Contributor II
938 Views

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif  

Hi this is Yong. 

I am learning about NiosII processor. 

 

I&#39;m just wondering whether I can send data from some Nios terminal to FPGA or not. 

 

Currently, I&#39;ve implement NiosII system with sdram on UP3 board. 

And I am running an application that Matrix differnece which find the difference of two 4x4 Matrixes. 

 

At this stage I inserted the matrix values with hard coding in C application. But I would rather have some direct terminal to FPGA so that I can send some data(matrix entry values) from it to FPGA so that the system can run with the data.  

(For instance, user input or file input rather than hard coding.) 

 

Is this possible? How can I do that? Could you tell me in detail please? 

 

Also, second question is that I would like to measure how long does the system takes to run a certain application. I am going to compare between same system but different NiosII processor.  

How can I measure the time? I would like to know how many clock cycle takes to run an application.  

 

Could you teach me how to do this? I am bit dummy so could you be able to explain little bit more detail?  

 

Thank you very much.  

 

YOng. 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/ph34r.gif
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
236 Views

Hello Yong, 

 

About your questions: 

1) A way that I have to download data directly from host (I supposse it`s what you&#39;ve questioned) it`s through opening files. In the C/C++ Application you simply lead with files through commands like "filePointer = fopen(file_name, "r");". However to lead with them it`s nececessary to change same settings your project in Nios. In the System Library Properties of your project, select &#39;Software Components...&#39; --> &#39;Altera Host Based File System&#39; and mark the box &#39;Add this software component&#39;. Using this resource, however, is only possible in the Debug mode. 

An example of code in C/C++ APlication: 

 

FILE* fp = NULL; 

fp = fopen(\mnt\host\<file_name>,"r"); 

... 

<read data from the file and stores them in a temporary variable, for example> 

... 

fclose(fp); 

 

The path \mnt\host\ is necessary to the system localize the file which may be in the directory of your project. 

 

2) You can use functions as &#39;clock()&#39; in your C file, to measure time in ms. See also the file &#39;leading_zeros.c&#39; avaliable in Altera page. It presents a way to measure time in clocks. 

 

Good Luck.
0 Kudos
Reply