Forum Discussion
Altera_Forum
Honored Contributor
21 years agoHW multipler custom instruction
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'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. Stefaan9 Replies
- Altera_Forum
Honored Contributor
--- 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.
- Altera_Forum
Honored Contributor
how do i set a darn avatar on this board? ...i'll keep on traveling as always
- Altera_Forum
Honored Contributor
It would be interesting to see how this holds up agains the Cyclone II embedded mult.
- Altera_Forum
Honored Contributor
--- Quote Start --- originally posted by svhb@Jul 5 2006, 02:29 AM it seems to be a problem with the forum, i can'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([email protected])? I'm interest for this small multipler, it is the smallest than my found.
- Altera_Forum
Honored Contributor
--- 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't also. Maybe some forum supervisor can? Stefaan
- Altera_Forum
Honored Contributor
custom_mul.v can not download now?
Where can I to found it? Thanks! - Altera_Forum
Honored Contributor
good boy !
- Altera_Forum
Honored Contributor
Hello Stefaan,
I’m interested in your code but until now I hadn’t enough time to evaluate it. Thanks for your work, niosIIuser - Altera_Forum
Honored Contributor
Usefull for somebody? Any comments or improvements?
Stefaan