OpenCores
URL https://opencores.org/ocsvn/plasma/plasma/trunk

Subversion Repositories plasma

[/] [plasma/] [tags/] [V3_0/] [tools/] [mlite.c] - Diff between revs 43 and 52

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 43 Rev 52
Line 126... Line 126...
 
 
void mult_big(unsigned long a,unsigned long b,
void mult_big(unsigned long a,unsigned long b,
              unsigned long *hi,unsigned long *lo)
              unsigned long *hi,unsigned long *lo)
{
{
   unsigned long ahi,alo,bhi,blo;
   unsigned long ahi,alo,bhi,blo;
   unsigned long answer[3];
   unsigned long c0,c1,c2,c3;
 
   unsigned long c1_a,c1_b,c2_a,c2_b;
   ahi=a>>16;
   ahi=a>>16;
   alo=a&0xffff;
   alo=a&0xffff;
   bhi=b>>16;
   bhi=b>>16;
   blo=b&0xffff;
   blo=b&0xffff;
   answer[0]=alo*blo;
 
   answer[1]=ahi*blo+bhi*alo+(answer[0]>>16);
   c0=alo*blo;
   answer[0]&=0xffff;
   c1_a=ahi*blo;
   answer[2]=ahi*bhi+(answer[1]>>16);
   c1_b=alo*bhi;
   answer[1]&=0xffff;
   c2=ahi*bhi;
   *hi=answer[2];
 
   *lo=(answer[1]<<16)+answer[0];
 
 
   c2+=(c1_a>>16)+(c1_b>>16);
 
   c1=(c1_a&0xffff)+(c1_b&0xffff)+(c0>>16);
 
   c0&=0xffff;
 
   c2+=(c1>>16);
 
   c1&=0xffff;
 
   *hi=c2;
 
   *lo=(c1<<16)+c0;
}
}
 
 
//execute one cycle of a Plasma CPU
//execute one cycle of a Plasma CPU
void cycle(State *s,int show_mode)
void cycle(State *s,int show_mode)
{
{

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.