Go to the source code of this file.
◆ User_enableIF()
Enable communication between firmware and user project through wishbone
- Warning
- This necessary when reading or writing are needed between wishbone and user project if interface isn't enabled no ack would be receive and the writing or reading command will be stuck
◆ USER_readByte()
unsigned char USER_readByte |
( |
unsigned int |
offset, |
|
|
unsigned char |
byte_num |
|
) |
| |
Read byte at user address space 32 bit register
- Parameters
-
offset | the offset of the register to write. Origin at the user project address |
byte_num | number of the in the 4 bytes register (32 bits) |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
byte_num | - | 0 | 1 | 2 | 3 |
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |
◆ USER_readHalfWord()
unsigned short USER_readHalfWord |
( |
unsigned int |
offset, |
|
|
bool |
is_first_word |
|
) |
| |
Read half word (2 bytes) at user address space 32 bit register
- Parameters
-
offset | the offset of the register to write. Origin at the user project address |
is_first_word | the offset of the register to write. Origin at the user project address |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
is first word | - | 1 | 1 | 0 | 0 |
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |
◆ USER_readWord()
unsigned int USER_readWord |
( |
int |
offset | ) |
|
Read word (4 bytes) at user address space 32 bit register
- Parameters
-
offset | the offset of the register to write. Origin at the user project address |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (4 bytes offset)
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |
◆ USER_writeByte()
void USER_writeByte |
( |
unsigned char |
data, |
|
|
unsigned int |
offset, |
|
|
unsigned char |
byte_num |
|
) |
| |
Write byte at user address space 32 bit register
- Parameters
-
data | byte data to write |
offset | the offset of the register to write. Origin at the user project address |
byte_num | number of the in the 4 bytes register (32 bits) |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
byte_num | - | 0 | 1 | 2 | 3 |
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |
◆ USER_writeHalfWord()
void USER_writeHalfWord |
( |
unsigned short |
data, |
|
|
unsigned int |
offset, |
|
|
bool |
is_first_word |
|
) |
| |
Write half word (2 bytes) at user address space 32 bit register
- Parameters
-
data | half world data to write |
offset | the offset of the register to write. Origin at the user project address |
is_first_word | the offset of the register to write. Origin at the user project address |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
is first word | - | 1 | 1 | 0 | 0 |
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |
◆ USER_writeWord()
void USER_writeWord |
( |
unsigned int |
data, |
|
|
int |
offset |
|
) |
| |
Write word (4 bytes) at user address space 32 bit register
- Parameters
-
data | world data to write |
offset | the offset of the register to write. Origin at the user project address |
- Note
- Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (4 bytes offset)
address | offset | byte0 | byte1 | byte2 | byte3 |
0x0 | 0 | 0 | 1 | 2 | 3 |
0x4 | 1 | 4 | 5 | 6 | 7 |
0x8 | 2 | 8 | 9 | 10 | 11 |
0xC | 3 | 12 | 13 | 14 | 15 |