mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	radix 4 files removed from srt and divlen modified for sqrt
This commit is contained in:
		
							parent
							
								
									b1906399aa
								
							
						
					
					
						commit
						97a1548356
					
				@ -103,7 +103,7 @@
 | 
			
		||||
// division constants
 | 
			
		||||
`define RADIX 32'h4
 | 
			
		||||
`define DIVCOPIES 32'h4
 | 
			
		||||
`define DIVLEN ((`NF < `XLEN) ? (`XLEN) : (`NF))
 | 
			
		||||
`define DIVLEN ((`NF < `XLEN) ? (`XLEN) : (`NF + 1))
 | 
			
		||||
`define DIVRESLEN ((`NF>`XLEN) ? `DIVLEN+2 : `DIVLEN)
 | 
			
		||||
`define LOGR ((`RADIX==2) ? 32'h1 : 32'h2)
 | 
			
		||||
// FPDUR = ceil(DIVRESLEN/(LOGR*DIVCOPIES))
 | 
			
		||||
 | 
			
		||||
@ -1,2 +1 @@
 | 
			
		||||
verilator --lint-only --top-module srt srt.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv
 | 
			
		||||
verilator --lint-only --top-module srtradix4 srt-radix4.sv qsel4.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv
 | 
			
		||||
 | 
			
		||||
@ -1,198 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
  Program:      qslc_r4a2.c
 | 
			
		||||
  Description:  Prints out Quotient Selection Table (assumes CPA is utilized to reduce memory)
 | 
			
		||||
  User:         James E. Stine
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#define DIVISOR_SIZE 3
 | 
			
		||||
#define CARRY_SIZE 7
 | 
			
		||||
#define SUM_SIZE 7
 | 
			
		||||
#define TOT_SIZE 7
 | 
			
		||||
 | 
			
		||||
void disp_binary(double, int, int);
 | 
			
		||||
 | 
			
		||||
struct bits {
 | 
			
		||||
  unsigned int divisor : DIVISOR_SIZE;
 | 
			
		||||
  int tot : TOT_SIZE;
 | 
			
		||||
} pla;
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 | 
			
		||||
   Function:      disp_binary
 | 
			
		||||
   Description:   This function displays a Double-Precision number into
 | 
			
		||||
   four 16 bit integers using the global union variable 
 | 
			
		||||
   dp_number
 | 
			
		||||
   Argument List: double x            The value to be converted
 | 
			
		||||
   int bits_to_left    Number of bits left of radix point
 | 
			
		||||
   int bits_to_right   Number of bits right of radix point
 | 
			
		||||
   Return value:  none
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
void disp_binary(double x, int bits_to_left, int bits_to_right) {
 | 
			
		||||
  int i; 
 | 
			
		||||
  double diff;
 | 
			
		||||
 | 
			
		||||
  if (fabs(x) <  pow(2.0, ((double) -bits_to_right)) ) {
 | 
			
		||||
    for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
      printf("0");
 | 
			
		||||
    }
 | 
			
		||||
    if (i == bits_to_right+1) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (x < 0.0) 
 | 
			
		||||
    x = pow(2.0, ((double) bits_to_left)) + x;
 | 
			
		||||
 | 
			
		||||
  for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
    diff = pow(2.0, ((double) -i) );
 | 
			
		||||
    if (x < diff) 
 | 
			
		||||
      printf("0");
 | 
			
		||||
    else {
 | 
			
		||||
      printf("1");
 | 
			
		||||
      x -= diff;
 | 
			
		||||
    }
 | 
			
		||||
    if (i == 0) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
  int m;
 | 
			
		||||
  int n;
 | 
			
		||||
  int o;
 | 
			
		||||
  pla.divisor = 0;
 | 
			
		||||
  pla.tot = 0;
 | 
			
		||||
  printf("\tcase({D[5:3],Wmsbs})\n");
 | 
			
		||||
  for (o=0; o < pow(2.0, DIVISOR_SIZE); o++) {
 | 
			
		||||
    for (m=0; m < pow(2.0, TOT_SIZE); m++) {
 | 
			
		||||
      printf("\t\t10'b");
 | 
			
		||||
      disp_binary((double) pla.divisor, DIVISOR_SIZE, 0);
 | 
			
		||||
      printf("_");
 | 
			
		||||
      disp_binary((double) pla.tot, TOT_SIZE, 0);
 | 
			
		||||
      printf(": q = 4'b");
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
	4 bits for Radix 4 (a=2)
 | 
			
		||||
	1000 = +2
 | 
			
		||||
	0100 = +1
 | 
			
		||||
	0000 =  0
 | 
			
		||||
	0010 = -1
 | 
			
		||||
	0001 = -2		
 | 
			
		||||
      */
 | 
			
		||||
      switch (pla.divisor) {
 | 
			
		||||
      case 0:
 | 
			
		||||
	if ((pla.tot) >= 12)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -4)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -13)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 1:
 | 
			
		||||
	if ((pla.tot) >= 14)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -15)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 2:
 | 
			
		||||
	if ((pla.tot) >= 15)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -16)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 3:
 | 
			
		||||
	if ((pla.tot) >= 16)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -18)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 4:
 | 
			
		||||
	if ((pla.tot) >= 18)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 6)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -20)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 5:
 | 
			
		||||
	if ((pla.tot) >= 20)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 6)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -20)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 6:
 | 
			
		||||
	if ((pla.tot) >= 20)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -22)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 7:
 | 
			
		||||
	if ((pla.tot) >= 24)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -24)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      default: printf ("XXX");
 | 
			
		||||
			
 | 
			
		||||
      }
 | 
			
		||||
			
 | 
			
		||||
      printf(";\n");
 | 
			
		||||
      (pla.tot)++;
 | 
			
		||||
    }
 | 
			
		||||
    (pla.divisor)++;
 | 
			
		||||
  }
 | 
			
		||||
  printf("\tendcase\n");
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							@ -1,190 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
  Program:      qslc_r4a2.c
 | 
			
		||||
  Description:  Prints out Quotient Selection Table (assumes CPA is utilized to reduce memory)
 | 
			
		||||
  User:         James E. Stine
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#define DIVISOR_SIZE 3
 | 
			
		||||
#define CARRY_SIZE 7
 | 
			
		||||
#define SUM_SIZE 7
 | 
			
		||||
#define TOT_SIZE 7
 | 
			
		||||
 | 
			
		||||
void disp_binary(double, int, int);
 | 
			
		||||
 | 
			
		||||
struct bits {
 | 
			
		||||
  unsigned int divisor : DIVISOR_SIZE;
 | 
			
		||||
  int tot : TOT_SIZE;
 | 
			
		||||
} pla;
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 | 
			
		||||
   Function:      disp_binary
 | 
			
		||||
   Description:   This function displays a Double-Precision number into
 | 
			
		||||
   four 16 bit integers using the global union variable 
 | 
			
		||||
   dp_number
 | 
			
		||||
   Argument List: double x            The value to be converted
 | 
			
		||||
   int bits_to_left    Number of bits left of radix point
 | 
			
		||||
   int bits_to_right   Number of bits right of radix point
 | 
			
		||||
   Return value:  none
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
void disp_binary(double x, int bits_to_left, int bits_to_right) {
 | 
			
		||||
  int i; 
 | 
			
		||||
  double diff;
 | 
			
		||||
 | 
			
		||||
  if (fabs(x) <  pow(2.0, ((double) -bits_to_right)) ) {
 | 
			
		||||
    for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
      printf("0");
 | 
			
		||||
    }
 | 
			
		||||
    if (i == bits_to_right+1) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (x < 0.0) 
 | 
			
		||||
    x = pow(2.0, ((double) bits_to_left)) + x;
 | 
			
		||||
 | 
			
		||||
  for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
    diff = pow(2.0, ((double) -i) );
 | 
			
		||||
    if (x < diff) 
 | 
			
		||||
      printf("0");
 | 
			
		||||
    else {
 | 
			
		||||
      printf("1");
 | 
			
		||||
      x -= diff;
 | 
			
		||||
    }
 | 
			
		||||
    if (i == 0) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
  int m;
 | 
			
		||||
  int n;
 | 
			
		||||
  int o;
 | 
			
		||||
  pla.divisor = 0;
 | 
			
		||||
  pla.tot = 0;
 | 
			
		||||
  for (o=0; o < pow(2.0, DIVISOR_SIZE); o++) {
 | 
			
		||||
    for (m=0; m < pow(2.0, TOT_SIZE); m++) {
 | 
			
		||||
      /*
 | 
			
		||||
	4 bits for Radix 4 (a=2)
 | 
			
		||||
	1000 = +2
 | 
			
		||||
	0100 = +1
 | 
			
		||||
	0000 =  0
 | 
			
		||||
	0010 = -1
 | 
			
		||||
	0001 = -2		
 | 
			
		||||
      */
 | 
			
		||||
      switch (pla.divisor) {
 | 
			
		||||
      case 0:
 | 
			
		||||
	if ((pla.tot) >= 12)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -4)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -13)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 1:
 | 
			
		||||
	if ((pla.tot) >= 14)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -15)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 2:
 | 
			
		||||
	if ((pla.tot) >= 15)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -16)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 3:
 | 
			
		||||
	if ((pla.tot) >= 16)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 4)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -6)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -18)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 4:
 | 
			
		||||
	if ((pla.tot) >= 18)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 6)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -20)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 5:
 | 
			
		||||
	if ((pla.tot) >= 20)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 6)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -20)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 6:
 | 
			
		||||
	if ((pla.tot) >= 20)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -22)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      case 7:
 | 
			
		||||
	if ((pla.tot) >= 24)
 | 
			
		||||
	  printf("8");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("4");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0");
 | 
			
		||||
	else if ((pla.tot) >= -24)
 | 
			
		||||
	  printf("2");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("1");
 | 
			
		||||
	break;
 | 
			
		||||
      default: printf ("X");
 | 
			
		||||
			
 | 
			
		||||
      }
 | 
			
		||||
			
 | 
			
		||||
      printf("\n");
 | 
			
		||||
      (pla.tot)++;
 | 
			
		||||
    }
 | 
			
		||||
    (pla.divisor)++;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1,198 +0,0 @@
 | 
			
		||||
/*
 | 
			
		||||
  Program:      qslc_r4a2.c
 | 
			
		||||
  Description:  Prints out Quotient Selection Table (assumes CPA is utilized to reduce memory)
 | 
			
		||||
  User:         James E. Stine
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#define DIVISOR_SIZE 3
 | 
			
		||||
#define CARRY_SIZE 7
 | 
			
		||||
#define SUM_SIZE 7
 | 
			
		||||
#define TOT_SIZE 7
 | 
			
		||||
 | 
			
		||||
void disp_binary(double, int, int);
 | 
			
		||||
 | 
			
		||||
struct bits {
 | 
			
		||||
  unsigned int divisor : DIVISOR_SIZE;
 | 
			
		||||
  int tot : TOT_SIZE;
 | 
			
		||||
} pla;
 | 
			
		||||
 | 
			
		||||
/* 
 | 
			
		||||
 | 
			
		||||
   Function:      disp_binary
 | 
			
		||||
   Description:   This function displays a Double-Precision number into
 | 
			
		||||
   four 16 bit integers using the global union variable 
 | 
			
		||||
   dp_number
 | 
			
		||||
   Argument List: double x            The value to be converted
 | 
			
		||||
   int bits_to_left    Number of bits left of radix point
 | 
			
		||||
   int bits_to_right   Number of bits right of radix point
 | 
			
		||||
   Return value:  none
 | 
			
		||||
 | 
			
		||||
*/
 | 
			
		||||
void disp_binary(double x, int bits_to_left, int bits_to_right) {
 | 
			
		||||
  int i; 
 | 
			
		||||
  double diff;
 | 
			
		||||
 | 
			
		||||
  if (fabs(x) <  pow(2.0, ((double) -bits_to_right)) ) {
 | 
			
		||||
    for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
      printf("0");
 | 
			
		||||
    }
 | 
			
		||||
    if (i == bits_to_right+1) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (x < 0.0) 
 | 
			
		||||
    x = pow(2.0, ((double) bits_to_left)) + x;
 | 
			
		||||
 | 
			
		||||
  for (i = -bits_to_left + 1; i <= bits_to_right; i++) {
 | 
			
		||||
    diff = pow(2.0, ((double) -i) );
 | 
			
		||||
    if (x < diff) 
 | 
			
		||||
      printf("0");
 | 
			
		||||
    else {
 | 
			
		||||
      printf("1");
 | 
			
		||||
      x -= diff;
 | 
			
		||||
    }
 | 
			
		||||
    if (i == 0) 
 | 
			
		||||
      ;
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
  int m;
 | 
			
		||||
  int n;
 | 
			
		||||
  int o;
 | 
			
		||||
  pla.divisor = 0;
 | 
			
		||||
  pla.tot = 0;
 | 
			
		||||
  printf("\tcase({D[5:3],Wmsbs})\n");
 | 
			
		||||
  for (o=0; o < pow(2.0, DIVISOR_SIZE); o++) {
 | 
			
		||||
    for (m=0; m < pow(2.0, TOT_SIZE); m++) {
 | 
			
		||||
      printf("\t\t11'b");
 | 
			
		||||
      disp_binary((double) pla.divisor, DIVISOR_SIZE, 0);
 | 
			
		||||
      printf("_");
 | 
			
		||||
      disp_binary((double) pla.tot, TOT_SIZE, 0);
 | 
			
		||||
      printf(": q = 4'b");
 | 
			
		||||
 | 
			
		||||
      /*
 | 
			
		||||
	4 bits for Radix 4 (a=2)
 | 
			
		||||
	1000 = +2
 | 
			
		||||
	0100 = +1
 | 
			
		||||
	0000 =  0
 | 
			
		||||
	0010 = -1
 | 
			
		||||
	0001 = -2		
 | 
			
		||||
      */
 | 
			
		||||
      switch (pla.divisor) {
 | 
			
		||||
      case 0:
 | 
			
		||||
	if ((pla.tot) >= 24)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -8)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -26)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 1:
 | 
			
		||||
	if ((pla.tot) >= 28)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -10)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -28)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 2:
 | 
			
		||||
	if ((pla.tot) >= 32)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -12)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -32)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 3:
 | 
			
		||||
	if ((pla.tot) >= 32)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 8)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -12)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -34)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 4:
 | 
			
		||||
	if ((pla.tot) >= 36)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 12)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -12)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -36)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 5:
 | 
			
		||||
	if ((pla.tot) >= 40)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 12)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -16)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -40)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 6:
 | 
			
		||||
	if ((pla.tot) >= 40)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 16)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -16)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -44)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      case 7:
 | 
			
		||||
	if ((pla.tot) >= 44)
 | 
			
		||||
	  printf("1000");
 | 
			
		||||
	else if ((pla.tot) >= 16)
 | 
			
		||||
	  printf("0100");
 | 
			
		||||
	else if ((pla.tot) >= -16)
 | 
			
		||||
	  printf("0000");
 | 
			
		||||
	else if ((pla.tot) >= -46)
 | 
			
		||||
	  printf("0010");
 | 
			
		||||
	else
 | 
			
		||||
	  printf("0001");
 | 
			
		||||
	break;
 | 
			
		||||
      default: printf ("XXX");
 | 
			
		||||
			
 | 
			
		||||
      }
 | 
			
		||||
			
 | 
			
		||||
      printf(";\n");
 | 
			
		||||
      (pla.tot)++;
 | 
			
		||||
    }
 | 
			
		||||
    (pla.divisor)++;
 | 
			
		||||
  }
 | 
			
		||||
  printf("\tendcase\n");
 | 
			
		||||
  
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -30,7 +30,7 @@
 | 
			
		||||
 | 
			
		||||
`include "wally-config.vh"
 | 
			
		||||
`define EXTRAFRACBITS ((`NF<(`XLEN)) ? (`XLEN - `NF) : 0)
 | 
			
		||||
`define EXTRAINTBITS ((`NF<(`XLEN)) ? 0 : (`NF - `XLEN))
 | 
			
		||||
`define EXTRAINTBITS ((`NF<(`XLEN)) ? 0 : (`NF - `XLEN + 1))
 | 
			
		||||
 | 
			
		||||
module srt (
 | 
			
		||||
  input  logic clk,
 | 
			
		||||
@ -164,7 +164,7 @@ module srtpreproc (
 | 
			
		||||
  assign intSign = Signed & (SrcA[`XLEN - 1] ^ SrcB[`XLEN - 1]);
 | 
			
		||||
 | 
			
		||||
  // Number of cycles of divider
 | 
			
		||||
  assign dur = Int ? (intExp & {7{~intExp[6]}}) : (`DIVLEN + 2);
 | 
			
		||||
  assign dur = Int ? (intExp & {7{~intExp[6]}}) : (7)'(`DIVLEN + 2);
 | 
			
		||||
endmodule
 | 
			
		||||
 | 
			
		||||
/////////////////////////////////
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user