--- Quote Start ---
originally posted by shmueld@Mar 12 2006, 08:27 PM
i have just started to design with the sopc builder. could someone please explain to me how the vhdl code placed in a custom component relates to the outside world and the avalon bus/nios ii microprocessor. specifically - how does the addressing work - if i want, lets say, set a specific signal high at a specific address - do i need a chip select within the vhdl ? do i need to incorporate an address into my vhdl code ? how does the base address of the component relate to my vhdl code and will the following code work without any address decoding within the vhdl :-
ouputsignal <= '1' when cs = '1' and write ='1' else '0';
could this type of functionality be incoporated into the custom component without any vhdl code ?
also could someone please explain to me the purpose of adding the software files to the custom component - does this create an address offset for different signals or is it just used for driver purposes ?
<div align='right'><{post_snapback}> (index.php?act=findpost&pid=13347)
--- quote end ---
--- Quote End ---
1) If You want to placed your custom component to SOPC builder firstly you should read the manual "Quartus II Version 5.1 Handbook
Volume 4: SOPC Builder
5. Component Editor"
and, of course, the manual "Avalon Bus Specification"
2) Address decoding works like that
for example(Sorry for Verilog HDL
http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif )
//regs of custom component
if(chipselect & write)
begin
case(address[2:0])
3'd0:r0<=#1 writedata;
3'd1:r1<=#1 writedata;
3'd2:control0<=#1 writedata;
3'd3:adr0<=#1writedata;
3'd4:size0<=#1writedata;
3'd5:control1<=#1 writedata;
3'd6:adr1<=#1writedata;
3'd7:size1<=#1writedata;
endcase
end
But, if You want component with one output
you should write as like you have already written in your message, I mean:
OUPUTsignal <= datawrite(0) when CS = '1' and WRITE ='1';
this code writes bit 0 from avalon bus to output world.
3) Adding the software files to the custom component is adding functionality to your componets - initializations, calling and etc(drivers :-))
and does not create any an address offset's for it.
An address offset and base address are setting in SOPC Builder only.