Forum Discussion
Question about defining a Custom component in Sopc builder
Hi,
I'm trying to build a custom component in Sopc builder to insert it in a Nios2 system...but whole procedure is not completely clear for me...!!! I don't understand if the registers to map on memory for component managing by processor have to be created by me in my custom logic block or SopC builder does that. in many application notes as AN333 I found that it needs to insert a "register file" among with the other project VHDL files...but I don't understand how this register file is done. Anyone for helping??? Regards9 Replies
- Altera_Forum
Honored Contributor
I'm not sure if this is exactly what you want
this is a document for custom IP construction. http://www.akiron.com/fpga/customipinstruction.pdf you can create one easy custom IP by following this document. - Altera_Forum
Honored Contributor
Thanks Akira...more or less...it is a starting point...but Is the communication between Nios2 and the custom component opened using only the printf() function ??? Does not It use IORD() and IOWR() macros to read and write from/on peripherals???
- Altera_Forum
Honored Contributor
I forgot....but in the pdf you send me...in component verilog code where are the registers to map??? how Is it done the mapping??
- Altera_Forum
Honored Contributor
in the document, NiosII and customIP are not comunicating by printf().
they are comunicating by the address. when you access to 0x000000 customIP gets those signals offsett address -> avs_address valid signal -> avs_write data -> avs_writedata when you get avs_write high, you can choose what to do with the address and data. in this example, what to do is store data of address 0 and return the value when address 0 is called. you can select what to do with the address number, this is the register mapping. you can communicate from NiosII into native hard ware language(HDL). try it anyway. - Altera_Forum
Honored Contributor
ok...It's clear now on customIP side....but on nios side.....from the C code:
# include <stdio.h> int main() { int *customAddress = 0x00000000; customAddress[0] = x010; printf(“my IP has value %d\m”,customAddress[0]); } if using prinf NiosII and CustomIP don't communicate, meaning that NiosII does not send data to CustomIP by printf.....in this context...what does printf() function serve to??? and for reading what command does it need??? - Altera_Forum
Honored Contributor
printf() is showing result what is in customAddress[0] to YOU.
printf() sends the text to stdout which normally be JTAG-uart. it just make sure how custom IP works. are you clear now? - Altera_Forum
Honored Contributor
Forgive me...but I don't get it.....I know printf() is used to send debug messages to jtag console as in helloworld example....but you said.. printf () function sends what is in customaddress[0] to jtag console...as helloworld style....so in which point there is the nios/customip data communication...????
- Altera_Forum
Honored Contributor
hey, sorry for leaving you alone.
actually, customaddress[0] is not memory, this is customIP itself. as long as you don't do anything in customaddress[0], it returns unstable value(normally zero). but it returns 0x10 which means this customIP stores value and returns the value again as HDL logic. printf shows the value to your console. once you get how to send / receive data to customIP, you can send data to your hardware logic. also get result from it as easy as writing C-source. but also you get result as fast as FPGA's limitation. do you think my description get what you want? - Altera_Forum
Honored Contributor
Dear akira,
I learned your customIPinstruction.pdf, very clear. However, do you know how to associate my own HAL driver with the custom component? similar as the components located at C:\altera\11.1\ip\altera\sopc_builder_ip? as you know, when I inst a altera component within sopc, then niosii-ide will automatically generate a bsp project combining all the device drivers used in the sopc design. For example, based on your custom design, how can you add your own HAL driver and this can be discovered by niosii-IDE? thank you very much. David.