Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20803 Discussions

HW multipler custom instruction

Altera_Forum
Honored Contributor II
1,781 Views

Maybe following is too easy or too small to give the name IP http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

 

 

Custom instruction that implements aprrox the same algorithm as the nios library for processors without dedicated multiplier. 

 

Some benchmarks I did with : 

 

int r; volatile int* pr = &r; //prevent optimalisations for (int a = -1000; a < 1000; a++)  for (int b = 1000; b >-1000; b--)  //count backwards : prevent optimalisations     *pr = a*b; 

 

 

1. Without cutom instruction : this takes about 22.4 seconds at 50Mc with the standard NiosII 

 

2. With the custominstruction in the mulsi function : 4.3 seconds (without frame pointer stuff)  

 

The compiler made this :  

__mulsi3:     custom 13, r2, r4, r5     ret  

 

 

3. With the custominstruction inlined (without the additinal function call and ret instruction) : 2.4 seconds. 

 

Unforunatly, I had to inline it inside the loop, I was not able to get the mulsi function inlined by the compiler.  

If someone has suggestions, let me know 

 

 

I think it is approx 280 LE&#39;s ( this was the difference when I added to an already existand custom instruction), maybe there is some extra overhead somewhere. 

 

 

See also top of the verilog file for info. 

 

 

Stefaan
0 Kudos
9 Replies
Altera_Forum
Honored Contributor II
1,074 Views

Usefull for somebody? Any comments or improvements? 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

Hello Stefaan, 

 

I’m interested in your code but until now I hadn’t enough time to evaluate it. 

 

Thanks for your work, 

niosIIuser
0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

good boy !

0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

custom_mul.v can not download now? 

Where can I to found it? 

Thanks!
0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

 

--- Quote Start ---  

originally posted by chenm001@Jul 4 2006, 03:44 PM 

custom_mul.v can not download now? 

where can i to found it? 

thanks! 

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

--- quote end ---  

 

--- Quote End ---  

 

 

It seems to be a problem with the forum, I can&#39;t also. 

Maybe some forum supervisor can? 

 

Stefaan
0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

 

--- Quote Start ---  

originally posted by svhb@Jul 5 2006, 02:29 AM 

it seems to be a problem with the forum, i can&#39;t also. 

maybe some forum supervisor can? 

 

stefaan 

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

--- quote end ---  

 

--- Quote End ---  

 

 

Thanks! 

Can you send it to me with email(chenm003@163.com)? 

I&#39;m interest for this small multipler, it is the smallest than my found.
0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

It would be interesting to see how this holds up agains the Cyclone II embedded mult.

0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

how do i set a darn avatar on this board? ...i&#39;ll keep on traveling as always

0 Kudos
Altera_Forum
Honored Contributor II
1,074 Views

 

--- Quote Start ---  

originally posted by jdhar@Jul 5 2006, 08:49 PM 

it would be interesting to see how this holds up agains the cyclone ii embedded mult. 

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

--- quote end ---  

 

--- Quote End ---  

 

 

It will show up rather slow. Never tried to beat internal multipliers.
0 Kudos
Reply