Forum Discussion
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- I got My code from tutorial "Altera JTAG-to-Avalon-MM Tutorial" --- Quote End --- Yeah, I know, I recognize the code (I wrote it). What I don't understand is why you decided you had to create the task avalon_GCD_write and change the data line `BFM.set_command_data(data, index1); What are you trying to do with index1 - that is the source of your error. You are indicating to the BFM that the data is a burst, and at index1 here is the data. If index1 is 0, then its fine, but any other value is wrong, since your BFM is not configured for bursts. For example, what are you trying to do here?
avalon_GCD_write('h20, 2,1);
avalon_GCD_write('h20, 25,2);
avalon_GCD_write('h20, 5,3);
avalon_GCD_write('h20, 1,1);
If you are trying to address different registers, relative to the base address of 'h20, then simply change the address by the number of bytes the addresses are spaced, eg. assuming 32-bit registers for each location you would write
avalon_write('h24, 2);
avalon_write('h28, 25);
avalon_write('h2C, 5);
avalon_write('h24, 1);
or if you prefer
int gcd_base = 'h20;
avalon_write(gcd_base + 'h04, 2);
avalon_write(gcd_base + 'h08, 25);
avalon_write(gcd_base + 'h0C, 5);
avalon_write(gcd_base + 'h04, 1);
Hopefully that makes a little more sense now. Cheers, Dave