Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
12748 Discussions

NIOS II Custom Instruction blocks printf

Altera_Forum
Honored Contributor II
1,500 Views

Hi  

 

I am trying to add custom Instruction block to my SOPC Builder Design but i find the printf gets blocked whenever i add custom instruction to my design .I even powered off and powered on by board but still i see that the Printf doesnt print on the console  

 

Custom Instruction is just a combinatorial adder 

 

I am able to see in the registers the addition happening well but the result i am unable to print it on to screen 

 

 

Please help me out  

 

regards  

M Kalyansrinivas
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
464 Views

I´m not shure but the first think which comes into my mind was maybe there is something wrong with your Avalon interface in your custom block. So it would help if you can post your HDL Code and the c-File so that we can see how you want to use it.

0 Kudos
Altera_Forum
Honored Contributor II
464 Views

I´m afraid you forgot to implement the Avalon interface and it´s combinational logig. At least the entity looks somehing like that 

module xyz(CLK, RST, READDATA, WRITEDATA, READ, WRITE, ADRESS); input CLK; input RST; input READDATA; input READ; output WRITEDATA; input WRITE; input ADRESS; At SOPC Builder you conect these signals as Avalon slave to the signals. I think they have the same name or sounds simular. 

You also need some logig to put data on the Avalon inteface if you want to read it from your c-code. 

always@ (posedge CLK) beginif(WRITE == 1'b1) begincase(ADRESS) begin ... end end else begin if(READ == 1'b1) begincase(ADRESS) beginresult_adress: READDATA <= result; end end end end In your c-Code you can then write: 

result = IORD_32DIRECT(XYZ_BASE,result_adress); I´m not sure if that´s all. I´m afraid there is something missing but I think the basics get clear. And I hope it is that what you like to do ;).
0 Kudos
Altera_Forum
Honored Contributor II
464 Views

Hi mki  

Thank you for the reply but i cannot connect the combinatorial logic of dataa and datab to avalon slave as i am trying to make it as a custom instruction 

 

Custom Instruction will directly connect with the alu instead of being as slave for avalon bridge So i think in custom instruction i should not connect to avalon slave rather i should do it as a nios_custom_instruction_slave 

 

 

Thank you  

M Kalyansrinivas
0 Kudos
Reply