I am new to VHDL, but I have managed to create a processor in VHDL with some help (it has ALU, multiplier, and a bus architecture to access SRAM memory). The processor decodes 32-bit instructions (which contains the type of operations and the memory addresses).
How do I write the following C code in the processor?
int i = 0;
int c = 0;
int a[10] = "0,1,2,3,4,5,6,7,8,9";
int b[10] = "1,0,-1,0,1,0,2,1,-1,1";
for (i = 0; i < 9; i++) c += (a[i]*b[i]);
I'm guessing I would write a list of instructions for this C code in the testbench:
1st instruction: multiply a[0] with b[0]
2nd instruction: add the result to c
and repeat for 9 times.
Is this the right way? Is there a better way to implement the for-loop? Is there a way to write C-code directly in my tb_top.vhd?