From a3a572fe5f86ef1740a1cb6721f34db09f7ab50f Mon Sep 17 00:00:00 2001 From: ushakya22 Date: Mon, 21 Feb 2022 16:04:41 +0000 Subject: [PATCH] Created test vector generation file for exponent and mantissa division --- pipelined/srt/exptestgen | Bin 0 -> 22128 bytes pipelined/srt/exptestgen.c | 121 +++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100755 pipelined/srt/exptestgen create mode 100644 pipelined/srt/exptestgen.c diff --git a/pipelined/srt/exptestgen b/pipelined/srt/exptestgen new file mode 100755 index 0000000000000000000000000000000000000000..0b5085bcb6c9ec2f476716fba8fec66a0110e49f GIT binary patch literal 22128 zcmeHP4{#LMd4IY?APk%i#~9gQYu%W!1m-0EM%1x&CphWkAfO;6vIAZn(n-4bbSK~K z8Nt-G5~0)=1)GV}lw_tY(@s*{WLkG7_As4{k)Ywo)a}S=CUpy)%Bh_>3?2(2V+CWb z-}mRwg((#6to(_dKtJ^lu@i zw@H?;1~FfF#ogjAF&B_I@bO9sQa#6XmRvKfAU!8gv}bAGfGhB^rVs$dj=RGK@3O%U+Ta@jSKwn!LjV*z?o)s-7FD84>5?Yg zZw0jL05;=Bp|-ZSsXd{1s4tw*Lh<&t&5>9%)E?X$2?hdde(Y2$ihR<(*Ll7IAtDl*oVsGA6(BMufQjHXLvsLyzfFD6Usji zl+OoU?#Rifs=H84UIWTxPXEdna6Si7GHt+(=i{sa$G*vlFh z6a$Xu52qRfZoEF$8*uc+slkBf+8%^n0}g@8rGNpyC5OWG%78C4;J>Q8`)Xk1VntxA zJava60;A)aBRd%w`TL4f1}!178@>YK?23c%U0Lmg9P<6BbABodX~hBLG4$srB_Br~ zLvnsx@?S#UiTsO_--|pp$@!y_e-wEP$@#;Q--$dn&G});Ka4zv=KLV=Snf6Nw5DEr zERgy|VC2o|9qp~@@g0l2B9NY#T8JclWge7s$zN3|V&*XFpX&8gR^y2&#Noi92j_#s zz@c&nl1;PP5(vSQpo<}xpPj0#9!AAeL_z;wQFv&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deDMe2sb3bAP$B@dQtKXWv7PyC=}^kExTE4SKa`? zg1(o>upq^B&23=Tx04l#y~VIF?sscQ31Uz=a`Z`*h|X5UH*2p-Pg3$k6z_YI~Z3i_ebsk6iaHbe~(Z@JwYuO|gZDht&74}x* zhQ&>niteO@;WXRn+a;MX;YsWt(1Lq`YH^+Rb51_X3-^;KJY?+gHMOqRf_=pGMU$Sr z$uMl^6^2U{6b1Om-MgsGmB2e-GF)r(5V}fo{Qha2y;6!@ao=Z@lp3kq6M7L6Zp&oR0%=j_Ku+ zmGJ~MEgs&RgtN#ncMXvJ@Gsk?_aJ=gyr**B3M z&o>?+gK>jBu60`Np9Ks%@9MHuEWB@u^plKYm= z9RSDln~*o!^E`>0UX<~3!N>#KvBU3J?0G)46BmIY5z!g=re?|UM*SN!CU}437 E0R>#^_W%F@ literal 0 HcmV?d00001 diff --git a/pipelined/srt/exptestgen.c b/pipelined/srt/exptestgen.c new file mode 100644 index 00000000..2d5cfb86 --- /dev/null +++ b/pipelined/srt/exptestgen.c @@ -0,0 +1,121 @@ +/* testgen.c */ + +/* Written 2/19/2022 by David Harris + + This program creates test vectors for mantissa and exponent components + of an IEEE floating point divider. + Builds upon program that creates test vectors for mantissa component only. + */ + +/* #includes */ + +#include +#include +#include + +/* Constants */ + +#define ENTRIES 17 +#define RANDOM_VECS 500 +// #define BIAS 1023 // Bias is for double precision + +/* Prototypes */ + +void output(FILE *fptr, int e1, double a, int e2, double b, int r_exp, double r_mantissa); +void printhex(FILE *fptr, double x); +double random_input(void); +double random_input_e(void); + +/* Main */ + +void main(void) +{ + FILE *fptr; + // e1 & e2 are exponents + // a & b are mantissas + // r_mantissa is result of mantissa divsion + // r_exp is result of exponent division + double a, b, r_mantissa, r_exp; + int e1, e2; + double mantissa[ENTRIES] = {1, 1.5, 1.25, 1.125, 1.0625, + 1.75, 1.875, 1.99999, + 1.1, 1.2, 1.01, 1.001, 1.0001, + 1/1.1, 1/1.5, 1/1.25, 1/1.125}; + int exponent[ENTRIES] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; + int i, j; + int bias = 1023; + + if ((fptr = fopen("testvectors","w")) == NULL) { + fprintf(stderr, "Couldn't write testvectors file\n"); + exit(1); + } + + for (i=0; i2) m /= 2; + for (i=0; i