Altera_Forum
Honored Contributor
14 years agoMove data from NIOS to hardware and then back to NIOS
I am trying to do a little calculation in hardware but I'm stuck on how to get started. I'm a complete newbie, but after reading a lot of manuals and demos, I figured out that I could have a soft processor NIOS that could accept C code. So using a basic computer configuration of the the DE2 (it comes with the University Program), I then created a NIOS BSP project. After trying many times, I managed to get everything compiled and the code below to run on the target hardware.
void main(void) { int line1[] = {1, 2, 3, 4, 5, 6, 7}; int line2[] = {1, 2, 3, 4, 5, 6, 7}; //--- Do this in verilog! int i; int store_val = 0; for(i=0; i<7; i++) { store_val = store_val + (line1*line2); } //--- verilog_end } Now the next step is that I want to do the calculation in the for-loop section in hardware using verilog rather than C. I have three main queries: 1) How to write that for-loop function in verilog? 2) Where do I save the verilog module? 3) When I have the verilog equivalent, how do I move the values contained in the two C arrays to the verilog module to do the calculation and then send back 'store_val' to the BSP project? I read about DMA in other posts but I don't know how to do that process. This is confusing me. Any help is greatly appreciated. Thank you very much