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++

Custom instruction woes

Altera_Forum
Honored Contributor II
983 Views

Hi all, and thanks for reading this, 

I've built a nios(1) cpu identical to the one in the tutorial, however when I come to add custom instructions, I always get an incorrect result. 

 

For example, if I have a bdf design with dataa, datab, clk, clk_en, start and reset IN, and result OUT, result set to vcc, the rest grounded, calling that custom instruction instead of giving me all 1s as the result, simply gives me -1 x (data + 1). E.g. if I say: 

 

myresult = nm_test(123, 456); 

 

Instead of getting myresult = 4294967295 (the int value of 32 1s) I get myresult = -124. 

 

Similarly, if I have vhdl that is to simply return the smaller of dataa and datab: 

 

IF(dataa(31 downto 0) < datab(31 downto 0)) THEN  

result <= dataa; 

ELSE 

result <= datab; 

END IF; 

 

The code calling that custom instruction will always be returned -1 x (dataa +1). 

 

Any ideas?
0 Kudos
0 Replies
Reply