URL
https://opencores.org/ocsvn/ion/ion/trunk
[/] [ion/] [trunk/] [tools/] [slite/] [src/] [slite.c] - Diff between revs 7 and 11
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 7 |
Rev 11 |
Line 44... |
Line 44... |
* IMPORTANT: Assumes host is little endian.
|
* IMPORTANT: Assumes host is little endian.
|
*-----------------------------------------------------------------------------*/
|
*-----------------------------------------------------------------------------*/
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
#include <string.h>
|
#include <string.h>
|
#include <ctype.h>
|
#include <ctype.h>
|
#include <assert.h>
|
#include <assert.h>
|
|
|
/** Set to !=0 to disable file logging */
|
/** Set to !=0 to disable file logging */
|
Line 509... |
Line 510... |
void mult_big_signed(int a,
|
void mult_big_signed(int a,
|
int b,
|
int b,
|
unsigned int *hi,
|
unsigned int *hi,
|
unsigned int *lo)
|
unsigned int *lo)
|
{
|
{
|
unsigned int ahi, alo, bhi, blo;
|
int64_t xa, xb, xr, temp;
|
unsigned int c0, c1, c2;
|
int32_t rh, rl;
|
unsigned int c1_a, c1_b;
|
|
|
|
ahi = a >> 16;
|
xa = a;
|
alo = a & 0xffff;
|
xb = b;
|
bhi = b >> 16;
|
xr = xa * xb;
|
blo = b & 0xffff;
|
|
|
temp = (xr >> 32) & 0xffffffff;
|
c0 = alo * blo;
|
rh = temp;
|
c1_a = ahi * blo;
|
temp = (xr >> 0) & 0xffffffff;
|
c1_b = alo * bhi;
|
rl = temp;
|
c2 = ahi * bhi;
|
|
|
|
c2 += (c1_a >> 16) + (c1_b >> 16);
|
*hi = rh;
|
c1 = (c1_a & 0xffff) + (c1_b & 0xffff) + (c0 >> 16);
|
*lo = rl;
|
c2 += (c1 >> 16);
|
|
c0 = (c1 << 16) + (c0 & 0xffff);
|
|
*hi = c2;
|
|
*lo = c0;
|
|
}
|
}
|
|
|
/** Load data from memory (used to simulate load delay slots) */
|
/** Load data from memory (used to simulate load delay slots) */
|
void start_load(State *s, int rt, int data){
|
void start_load(State *s, int rt, int data){
|
if(s->load_delay_slot){
|
if(s->load_delay_slot){
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.