Forum Discussion
Altera_Forum
Honored Contributor
16 years agoI´m afraid you forgot to implement the Avalon interface and it´s combinational logig. At least the entity looks somehing like that
module xyz(CLK, RST, READDATA, WRITEDATA, READ, WRITE, ADRESS);
input CLK;
input RST;
input READDATA;
input READ;
output WRITEDATA;
input WRITE;
input ADRESS;
At SOPC Builder you conect these signals as Avalon slave to the signals. I think they have the same name or sounds simular. You also need some logig to put data on the Avalon inteface if you want to read it from your c-code.
always@ (posedge CLK)
beginif(WRITE == 1'b1)
begincase(ADRESS)
begin
...
end
end
else
begin
if(READ == 1'b1)
begincase(ADRESS)
beginresult_adress: READDATA <= result;
end
end
end
end
In your c-Code you can then write:
result = IORD_32DIRECT(XYZ_BASE,result_adress);
I´m not sure if that´s all. I´m afraid there is something missing but I think the basics get clear. And I hope it is that what you like to do ;).