Forum Discussion
Altera_Forum
Honored Contributor
14 years agoConnecting an 8-bit peripheral to a 32-bit avalon bus
Hello,
I am connecting an I2C core to a ColdFire V1 IP Core using the Avalon Bus in SOPC. I get a warning about the slave (I2C core), which has 8-bit registers, not having byteenables. Then it says Narrow (less than 32-bit) writes from the cpu core will result in spurious writes to the I2C slave. I also notice that when I write to addresses in memory (RAM), they get written to correctly whether writing using a 32-bit int or a 4 successive writes with char type (8-bit), but when writing to the I2C core, I have to write all 4 registers (are at 4 successive address in the I2C Core) at once, but if I try to write them as bytes, things get hosed. :confused: Salman11 Replies
- Altera_Forum
Honored Contributor
I think I made a mistake when I suggested a solution to you. There are actually 4 byteenable bits in the byteenable bus. One for each byte within the word. You probably need to do the following.
input [3:0] byteenable; wire [2:0] address_int; always (*) begin case(byteenable) 4'b0001: address_int = {address[2], 2'b00}; 4'b0010: address_int = {address[2], 2'b01}; 4'b0100: address_int = {address[2], 2'b10}; 4'b1000: address_int = {address[2], 2'b11}; default: address_int = {address[2], 2'b00}; endcase end Please check out the avalon specification for more information on how byteenables work. /Boris