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

Nios2 1.01 hadware multiply instruction

Altera_Forum
Honored Contributor II
1,569 Views

Hi everyone  

 

In my nios folder i see C:\altera\kits\nios2\components\altera_nios_multiply\ this component  

 

I want use multiply instruction in my Cyclone based board 

But with NIOS2 1.01 sp1  

 

And i don&#39;t understand how to implement this component http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

please help me
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
618 Views

Hello All  

 

I make multicycle multiplication instruction and for implementation this instruction need ~ 110 LE&#39;s - it work up to 3 times faster then usual multiplication without hardware support  

and it not decrease Fmax - because it have verry little LE&#39;s amount  

A -32 bitwidth  

B -32 bitwidth  

result - 32 bitwidth  

almost all elements used for data latching  

 

But it work only in my program where i directly call this instruction http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

 

Is it possible to use my mul instruction in C C++ compliator like in NIOS5.1 when i select hardware multiply by Logic elements ? 

 

I menan if i write in C++ Y=X*Z; - my intruction calc this. 

If i do it my program will work murch more faster then before  

 

The same for division - i can make very little multicycle instuction but using in standart compilator will not be able.  

 

I think if name of my Mul instruction will be the same like in standart SOPC support  

may be possible to just enable somehow compilation with using hardware multiply  

 

It will speed up any nios2 system without big growing numberic of LE&#39;s  

 

In my opinion it must be very easy 

need to correct some parameters in NIOS2 generation scripts to eable using hardware support of multiplication in C++ compilation  

 

If some one know how to do it - help with it, please
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

I wrote a utility that let&#39;s you patch your ELF. One use of this program is to let you replace calls to the multiply and divide instructions (omitted by the compiler) with your own custom instructions that implement multiply and divide. Maybe I should get around to posting this utility to this web site? I&#39;ll make a note to do this (although it may be a while since I&#39;m working on getting Nios II 6.0 ready for release).

0 Kudos
Altera_Forum
Honored Contributor II
618 Views

 

--- Quote Start ---  

originally posted by james@Apr 16 2006, 10:31 PM 

i wrote a utility that let&#39;s you patch your elf.  one use of this program is to let you replace calls to the multiply and divide instructions (omitted by the compiler) with your own custom instructions that implement multiply and divide.  maybe i should get around to posting this utility to this web site?  i&#39;ll make a note to do this (although it may be a while since i&#39;m working on getting nios ii 6.0 ready for release). 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14416) 

--- quote end ---  

 

--- Quote End ---  

 

 

James - it&#39;s just incredible !!! 

Give me please this patch !!! 

 

please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please  

 

I can give to you my mul instruction:) if you wish  

It need me like an air !!!!! - i want to test this in my projects  

 

please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please please
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

The ELF patching utility is able to change MUL, MULXUU, MULXSU, and MULXSS instructions to use your custom instruction. However, it is not able to change the MULI instructions; they have a 16-bit immediate field which custom instructions don&#39;t support. The MULI instructions are used when your source code multiples a number by a constant. 

 

So, is this patch still going to meet your needs? 

 

BTW, I&#39;m curious about why you don&#39;t upgrade to a new version of Nios II that includes support for multiply instructions using logic elements (and take multiple cycles to compute).
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

 

--- Quote Start ---  

originally posted by james@Apr 17 2006, 09:12 AM 

so, is this patch still going to meet your needs? 

 

btw, i&#39;m curious about why you don&#39;t upgrade to a new version of nios ii that includes support for multiply instructions using logic elements (and take multiple cycles to compute). 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14433) 

--- quote end ---  

 

--- Quote End ---  

 

 

Hello James 

 

Yes - i will make my own instructions and implement they.  

With this patch i will solve speed problem http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif ) 

 

I can&#39;t use NIOS5.1 because  

 

1. Modelsim simulation is not wokring -!!!!! very very very bad !!!! 

I have complicate hardware project where i have many custom elements and I develop it in verilog in modelsim !!! In NIOS5.1 i lose ability to fixing something because i can&#39;t simulate my changes in code !!! 

I start again Modelsim Topic in this forum - maybe someone answer how to simulate new NIOS5.1  

 

2. Code downloading in NIOS5.1  

In new version for code downloading need DebugLevel1 - 300~400 LE&#39;s  

I aggree it&#39;s useful no custom board need  

BUT FROM OTER SIDE MY PROJECT DON&#39;T MEET TIMING REQUIREMENTS with this addition  

So, in this case to add hardware mul instriction - i must add DEBUG LEVEL1 400 L&#39;ES + HARDWARE MUL (i don&#39;t know how many elemen&#39;ts need but i thing not less than 150) 

So we have 550 LE&#39;S !!!!!!!!! only for multiplacation !!!!!!  

Now my project is work n EP1C6Q240C6 and have 4.590 (77%) LE&#39;s after fitting  

I can add to it additional 200-300 Le&#39;s maximum but not 550 !!! 

after this i got timing degradation ! 

 

Another side - my project now under serial producion - and 7 programers write C++ code for my board - we don&#39;t use IDE because We have SDK for my board where more than 100 different C++ files + each project have about 20-30 files  

Is very very dificault to administrate so big projects in IDE. 

And we use our utilities for compilation and code dowloading they are based on command lines and custom board project. 

 

FimWare flash dowloading in producion also use our utility  

OUR UTILITIES PROTECT US AGNAIST C++ SHOWING IN CODE DOWNLOAD PROCESS 

 

In this situation IS VERY DIFFICULT to change something! 

 

In my opinion  

Disadvantages of NIOS5.1 is  

Updating to new verion of NIOS is inpossible for big projects because it not compatible with previous version(according to text above) and it anyway become bigger (in LE&#39;S) 

 

Important Advantages is  

GOOD Hardware mul and Div instruction  

and software bug fixing with malloc and longjump  

 

Now we fix malloc BUG in NIOS2 1.01 Sp1 (using sources from NIOS5.1 )  

longjump - we will fix later  

I hope to add hardware mul instruction - to speed up system perfomance  

and after this - will no reason for us to upgrade NIOS2 1.01  

 

I hope NIOS6 will be more frendly http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

They will not support sdk in nios2 6.0 .

0 Kudos
Altera_Forum
Honored Contributor II
618 Views

 

--- Quote Start ---  

originally posted by hippo@Apr 19 2006, 02:25 AM 

they will not support sdk in nios2 6.0 . 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=14473) 

--- quote end ---  

 

--- Quote End ---  

 

Hippo 

Yes maybe i use incorrect word http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

When i tell about SDK - i was think about our own C++ liblary for my board  

This library use HAL.
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

Are you saying that the debug core is larger in Nios II 5.1 than Nios II 1.0.1 or just that somehow it is required in Nios II 5.1 but it wasn&#39;t before? 

Either way, this doesn&#39;t match my understanding of changes. The debug core hasn&#39;t been changed much and not in a way that would increase its size. 

 

Are you not able to use GERMS to download your program instead of the debug core? Would a HAL version of GERMS help you?
0 Kudos
Altera_Forum
Honored Contributor II
618 Views

I&#39;ve uploaded the patch_elf utility to the "Post your own IP" section of the forum. Please give it a try.

0 Kudos
Reply