Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHmm, i'm not sure i understand - how would i know whether i have register addresses or hardware addresses? Does this depend on how i interface to the avalon?
I really feel stupid regarding this. What i want to do is send multiple 32 bit integers from the C code to the hardware block, to different port inputs, and then also be able to get multiple outputs, which are also 32 bit, by reading the output pins. I know the macros to write and read, and the base address of the hardware block, but i don't know what the "address increment" or second input to the macros should be. I took a look at http://www1.cs.columbia.edu/~sedwards/classes/2007/4840/lab3.pdf figure 11 and figure 16, but i'm still not sure how writing to it works completely. What i'm not sure of right now, is also why only a clock is required for slave avalon-mm blocks as a minimum. Since I would also like to read outputs from and write inputs to it, so i would have to use write, writedata and read, readdata, and a chipselect i guess - i wouldn't expect SOPC Builder to figure it out otherwise. I'm thinking that having a separate process doing the following (not checked it for errors, and probably still missing some) would work:
process (clk)
begin
if clk'event and clk ='1' then
if chipselect ='1' then
if read='1' then
readdata <= take_an_input;
elsif write='1' then
writedata <= output_eg_result_from_another_process;
end if;
end if;
end if;
end process;
In other words, very much like the tutorial linked to above.