Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHi,
The answer to your problem lies in the interconnect fabric geberated by the SoPC builder. To quote form the Avlaon Spec (where it describes the address port of an Avalon Slave, Table 3.1): "Specifies an offset into the slave address space. Each slave address value selects a word of slave data. For example, address= 0 selects the first <slave data width> bits of slave data; address=1 selects the second <slave data width> bits of slave data." Therefore, in your Avalon Slave, your address port should contain enough bits to address all the words in your address space - irrespective of the width of the word. So if you have 512 8 bit words or 512 64 bit words, your address port will still be 9 bits. When SoPC builds your system, it looks at the word width and the address width and then generates the required logic to connect to the Avalon bus master. The Avalon Bus master always addresses bytes. To qute from tabel 4.3 in the spec (The Master address port): "The address signal represents a byte address regardless of the data-width of the master. The value of the address must be aligned to the data width. To write to specific bytes within a data word, the master must use the byteenable signal. Masters always issue byte addresses, regardless of the data width of the master or slave port. The system interconnect fabric translates this address into a word address in the slave’s address space so that each slave access is for a word of data from the perspective of the slave. " So your 512 x 64 bit slave, will aways occupy 4096 bytes, or 12 bits, in the master address space. If the Avalon bus master is 32 bits wide (as is the case when using Nios), you will need to do two consecutive accesses to write to your slave. You may need to use the byteenable lines so that the interconnect fabric can show you when it is writing to the upper 32 bits and when it is writing to the lower 32 bits. Also look at table 3.3 of the Avalon spec. for an example for a 32 bit master writing to a 64 bit slave. Regards, Niki