aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--LICENSE4
-rw-r--r--Makefile12
-rw-r--r--README.md16
-rw-r--r--_CoqProject10
-rwxr-xr-xbenchmarks/CHStone/adpcm/adpcm.c1337
-rwxr-xr-xbenchmarks/CHStone/aes/aes.c749
-rwxr-xr-xbenchmarks/CHStone/gsm/gsm.c523
-rwxr-xr-xbenchmarks/CHStone/gsm2/gsm.c558
-rwxr-xr-xbenchmarks/CHStone/mips/mips.c469
-rwxr-xr-xbenchmarks/CHStone/sha/sha_coqup.c1353
-rwxr-xr-xbenchmarks/CHStone/sha/sha_driver.c1313
-rw-r--r--benchmarks/polybench-syn/data-mining/covariance.c108
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/gemm.c111
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/gemver.c152
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/gesummv.c115
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/symm.c110
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/syr2k.c120
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/syrk.c106
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/trmm.c96
-rw-r--r--benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c144
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/2mm.c128
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/3mm.c141
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/atas.c100
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/bicg.c115
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/doitgen.c100
-rw-r--r--benchmarks/polybench-syn/linear-algebra/kernels/mvt.c117
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c125
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/durbin.c102
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/lu.c148
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c164
-rw-r--r--benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c89
-rw-r--r--benchmarks/polybench-syn/medley/floyd-warshall.c89
-rw-r--r--benchmarks/polybench-syn/medley/nussinov.c104
-rw-r--r--benchmarks/polybench-syn/stencils/adi.c129
-rw-r--r--benchmarks/polybench-syn/stencils/fdtd-2d.c131
-rw-r--r--benchmarks/polybench-syn/stencils/heat-3d.c107
-rw-r--r--benchmarks/polybench-syn/stencils/jacobi-1d.c97
-rw-r--r--benchmarks/polybench-syn/stencils/jacobi-2d.c101
-rw-r--r--benchmarks/polybench-syn/stencils/seidel-2d.c85
-rw-r--r--benchmarks/unit-tests/shr.c11
-rw-r--r--debug/CoqupTest.ml2
-rw-r--r--debug/dune4
-rw-r--r--default.nix2
-rw-r--r--driver/CoqupDriver.ml106
-rw-r--r--driver/dune4
-rw-r--r--dune2
-rw-r--r--scripts/quartus_synth.tcl28
-rw-r--r--src/Compiler.v19
-rw-r--r--src/CoqupClflags.ml2
-rw-r--r--src/Simulator.v6
-rw-r--r--src/common/Coquplib.v6
-rw-r--r--src/common/IntegerExtra.v38
-rw-r--r--src/common/Maps.v2
-rw-r--r--src/common/Monad.v4
-rw-r--r--src/common/Show.v2
-rw-r--r--src/common/Statemonad.v2
-rw-r--r--src/extraction/Extraction.v8
-rw-r--r--src/translation/HTLgen.v116
-rw-r--r--src/translation/HTLgenproof.v4052
-rw-r--r--src/translation/HTLgenspec.v58
-rw-r--r--src/translation/Veriloggen.v4
-rw-r--r--src/translation/Veriloggenproof.v6
-rw-r--r--src/verilog/Array.v2
-rw-r--r--src/verilog/AssocMap.v4
-rw-r--r--src/verilog/HTL.v6
-rw-r--r--src/verilog/PrintHTL.ml6
-rw-r--r--src/verilog/PrintVerilog.ml29
-rw-r--r--src/verilog/PrintVerilog.mli6
-rw-r--r--src/verilog/Value.v4
-rw-r--r--src/verilog/ValueInt.v5
-rw-r--r--src/verilog/Verilog.v90
-rw-r--r--test/array-addr-mask.c6
-rw-r--r--test/array-indirect.c13
-rw-r--r--test/array-out-of-bounds.c9
-rw-r--r--test/array-volatile.c7
-rw-r--r--test/array-write.c12
-rw-r--r--test/matrix2.c23
-rwxr-xr-xtest/test_all.sh2
79 files changed, 3292 insertions, 10996 deletions
diff --git a/.gitignore b/.gitignore
index b2cf595..96ced2e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,7 @@ src/extraction/STAMP
*.exe
*.ini
-bin/coqup
+bin/vericert
# Ocaml
_build
diff --git a/LICENSE b/LICENSE
index 0416644..fd6a7ce 100644
--- a/LICENSE
+++ b/LICENSE
@@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
- CoqUp: Verified high-level synthesis.
+ Vericert: Verified high-level synthesis.
Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
This program is free software: you can redistribute it and/or modify
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
- CoqUp Copyright (C) 2019-2020 Yann Herklotz
+ Vericert Copyright (C) 2019-2020 Yann Herklotz
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
diff --git a/Makefile b/Makefile
index 1303b13..518d4c9 100644
--- a/Makefile
+++ b/Makefile
@@ -9,9 +9,9 @@ endif
COMPCERTRECDIRS := lib common x86_32 x86 backend cfrontend driver flocq exportclight \
MenhirLib cparser
-COQINCLUDES := -R src/common coqup.common -R src/verilog coqup.verilog \
- -R src/extraction coqup.extraction -R src/translation coqup.translation \
- -R src coqup \
+COQINCLUDES := -R src/common vericert.common -R src/verilog vericert.verilog \
+ -R src/extraction vericert.extraction -R src/translation vericert.translation \
+ -R src vericert \
$(foreach d, $(COMPCERTRECDIRS), -R lib/CompCert/$(d) compcert.$(d))
COQEXEC := $(COQBIN)coqtop $(COQINCLUDES) -batch -load-vernac-source
@@ -35,7 +35,7 @@ lib/COMPCERTSTAMP:
install:
install -d $(PREFIX)/bin
install -C _build/default/driver/compcert.ini $(PREFIX)/bin/.
- install -C _build/default/driver/CoqupDriver.exe $(PREFIX)/bin/coqup
+ install -C _build/default/driver/VericertDriver.exe $(PREFIX)/bin/vericert
proof: Makefile.coq
$(MAKE) -f Makefile.coq
@@ -47,9 +47,9 @@ test:
./test/test_all.sh ./test
compile: src/extraction/STAMP
- @echo "OCaml bin/coqup"
+ @echo "OCaml bin/vericert"
@mkdir -p bin
- @dune build driver/CoqupDriver.exe
+ @dune build driver/VericertDriver.exe
@cp lib/CompCert/compcert.ini _build/default/driver/.
src/extraction/STAMP:
diff --git a/README.md b/README.md
index 026266b..0f1041e 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,10 @@
-# Coqup [![Build Status](https://travis-ci.com/ymherklotz/coqup.svg?token=qfBKKGwxeWkjDsy7e16x&branch=master)](https://travis-ci.com/ymherklotz/coqup)
+# Vericert [![Build Status](https://travis-ci.com/ymherklotz/vericert.svg?token=qfBKKGwxeWkjDsy7e16x&branch=master)](https://travis-ci.com/ymherklotz/vericert)
A formally verified HLS tool in Coq, building on top of [CompCert](https://github.com/AbsInt/CompCert).
## Building
-To build coqup, the provided [Makefile](/Makefile) can be used. External dependencies are needed to build the project, which can be pulled in automatically with [nix](https://nixos.org/nix/) using the provided [default.nix](/default.nix) and [shell.nix](/shell.nix) files.
+To build vericert, the provided [Makefile](/Makefile) can be used. External dependencies are needed to build the project, which can be pulled in automatically with [nix](https://nixos.org/nix/) using the provided [default.nix](/default.nix) and [shell.nix](/shell.nix) files.
The project is written in Coq, a theorem prover, which is extracted to OCaml so that it can then be compiled and executed. The dependencies of this project are the following:
@@ -23,7 +23,7 @@ These dependencies can be installed manually, or automatically through Nix.
CompCert is added as a submodule in the `lib/CompCert` directory. It is needed to run the build process below, as it is the one dependency that is not downloaded by nix, and has to be downloaded together with the repository. To clone CompCert together with this project, you can run:
``` shell
-git clone --recursive https://github.com/ymherklotz/coqup
+git clone --recursive https://github.com/ymherklotz/vericert
```
If the repository is already cloned, you can run the following command to make sure that CompCert is also downloaded:
@@ -58,14 +58,14 @@ and installed locally, or under the `PREFIX` location using:
make install
```
-Which will install the binary in `./bin/coqup` by default. However, this can be changed by changing the `PREFIX` environment variable, in which case the binary will be installed in `$PREFIX/bin/coqup`.
+Which will install the binary in `./bin/vericert` by default. However, this can be changed by changing the `PREFIX` environment variable, in which case the binary will be installed in `$PREFIX/bin/vericert`.
## Running
-To test out `coqup` you can try the following examples which are in the test folder using the following:
+To test out `vericert` you can try the following examples which are in the test folder using the following:
``` shell
-./bin/coqup test/loop.c -o loop.v
-./bin/coqup test/conditional.c -o conditional.v
-./bin/coqup test/add.c -o add.v
+./bin/vericert test/loop.c -o loop.v
+./bin/vericert test/conditional.c -o conditional.v
+./bin/vericert test/add.c -o add.v
```
diff --git a/_CoqProject b/_CoqProject
index 7965da9..e86312b 100644
--- a/_CoqProject
+++ b/_CoqProject
@@ -1,8 +1,8 @@
--R src/common coqup.common
--R src/extraction coqup.extraction
--R src/translation coqup.translation
--R src/verilog coqup.verilog
--R src coqup
+-R src/common vericert.common
+-R src/extraction vericert.extraction
+-R src/translation vericert.translation
+-R src/verilog vericert.verilog
+-R src vericert
-R lib/CompCert/MenhirLib compcert.MenhirLib
-R lib/CompCert/backend compcert.backend
diff --git a/benchmarks/CHStone/adpcm/adpcm.c b/benchmarks/CHStone/adpcm/adpcm.c
index bcdc6dd..613b1bd 100755
--- a/benchmarks/CHStone/adpcm/adpcm.c
+++ b/benchmarks/CHStone/adpcm/adpcm.c
@@ -1,21 +1,21 @@
/*
- +--------------------------------------------------------------------------+
- | CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
- | ======================================================================== |
- | |
- | * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
- | H. Takada and K. Ishii |
- | Nagoya University, Japan |
- | |
- | * Remark : |
- | 1. This source code is modified to unify the formats of the benchmark |
- | programs in CHStone. |
- | 2. Test vectors are added for CHStone. |
- | 3. If "main_result" is 0 at the end of the program, the program is |
- | correctly executed. |
- | 4. Please follow the copyright of each benchmark program. |
- +--------------------------------------------------------------------------+
- */
++--------------------------------------------------------------------------+
+| CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
+| ======================================================================== |
+| |
+| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
+| H. Takada and K. Ishii |
+| Nagoya University, Japan |
+| |
+| * Remark : |
+| 1. This source code is modified to unify the formats of the benchmark |
+| programs in CHStone. |
+| 2. Test vectors are added for CHStone. |
+| 3. If "main_result" is 0 at the end of the program, the program is |
+| correctly executed. |
+| 4. Please follow the copyright of each benchmark program. |
++--------------------------------------------------------------------------+
+*/
/*************************************************************************/
/* */
/* SNU-RT Benchmark Suite for Worst Case Timing Analysis */
@@ -62,9 +62,7 @@
/* */
/* */
/*************************************************************************/
-
-#define SIZE 100
-#define IN_END 100
+#include <stdio.h>
int encode (int, int);
void decode (int);
@@ -79,12 +77,162 @@ int uppol1 (int al1, int apl2, int plt, int plt1);
int logsch (int ih, int nbh);
void reset ();
+/* G722 C code */
+
+/* variables for transimit quadrature mirror filter here */
+int tqmf[24];
+
+/* QMF filter coefficients:
+scaled by a factor of 4 compared to G722 CCITT recomendation */
+const int h[24] = {
+ 12, -44, -44, 212, 48, -624, 128, 1448,
+ -840, -3220, 3804, 15504, 15504, 3804, -3220, -840,
+ 1448, 128, -624, 48, 212, -44, -44, 12
+};
+
+int xl, xh;
+
+/* variables for receive quadrature mirror filter here */
+int accumc[11], accumd[11];
+
+/* outputs of decode() */
+int xout1, xout2;
+
+int xs, xd;
+
+/* variables for encoder (hi and lo) here */
+
+int il, szl, spl, sl, el;
+
+const int qq4_code4_table[16] = {
+ 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200,
+ 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0
+};
+
+
+const int qq6_code6_table[64] = {
+ -136, -136, -136, -136, -24808, -21904, -19008, -16704,
+ -14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856,
+ -7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576,
+ -3168, -2776, -2400, -2032, -1688, -1360, -1040, -728,
+ 24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192,
+ 10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456,
+ 4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032,
+ 1688, 1360, 1040, 728, 432, 136, -432, -136
+};
+
+int delay_bpl[6];
+
+int delay_dltx[6];
+
+const int wl_code_table[16] = {
+ -60, 3042, 1198, 538, 334, 172, 58, -30,
+ 3042, 1198, 538, 334, 172, 58, -30, -60
+};
+
+const int ilb_table[32] = {
+ 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383,
+ 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834,
+ 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371,
+ 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008
+};
+
+int nbl; /* delay line */
+int al1, al2;
+int plt, plt1, plt2;
+int dlt;
+int rlt, rlt1, rlt2;
+
+/* decision levels - pre-multiplied by 8, 0 to indicate end */
+const int decis_levl[30] = {
+ 280, 576, 880, 1200, 1520, 1864, 2208, 2584,
+ 2960, 3376, 3784, 4240, 4696, 5200, 5712, 6288,
+ 6864, 7520, 8184, 8968, 9752, 10712, 11664, 12896,
+ 14120, 15840, 17560, 20456, 23352, 32767
+};
+
+int detl;
+
+/* quantization table 31 long to make quantl look-up easier,
+last entry is for mil=30 case when wd is max */
+const int quant26bt_pos[31] = {
+ 61, 60, 59, 58, 57, 56, 55, 54,
+ 53, 52, 51, 50, 49, 48, 47, 46,
+ 45, 44, 43, 42, 41, 40, 39, 38,
+ 37, 36, 35, 34, 33, 32, 32
+};
+
+/* quantization table 31 long to make quantl look-up easier,
+last entry is for mil=30 case when wd is max */
+const int quant26bt_neg[31] = {
+ 63, 62, 31, 30, 29, 28, 27, 26,
+ 25, 24, 23, 22, 21, 20, 19, 18,
+ 17, 16, 15, 14, 13, 12, 11, 10,
+ 9, 8, 7, 6, 5, 4, 4
+};
+
+
+int deth;
+int sh; /* this comes from adaptive predictor */
+int eh;
+
+const int qq2_code2_table[4] = {
+ -7408, -1616, 7408, 1616
+};
+
+const int wh_code_table[4] = {
+ 798, -214, 798, -214
+};
+
+
+int dh, ih;
+int nbh, szh;
+int sph, ph, yh, rh;
+
+int delay_dhx[6];
+
+int delay_bph[6];
+
+int ah1, ah2;
+int ph1, ph2;
+int rh1, rh2;
+
+/* variables for decoder here */
+int ilr, rl;
+int dec_deth, dec_detl, dec_dlt;
+
+int dec_del_bpl[6];
+
+int dec_del_dltx[6];
+
+int dec_plt, dec_plt1, dec_plt2;
+int dec_szl, dec_spl, dec_sl;
+int dec_rlt1, dec_rlt2, dec_rlt;
+int dec_al1, dec_al2;
+int dl;
+int dec_nbl, dec_dh, dec_nbh;
+
+/* variables used in filtez */
+int dec_del_bph[6];
+
+int dec_del_dhx[6];
+
+int dec_szh;
+/* variables used in filtep */
+int dec_rh1, dec_rh2;
+int dec_ah1, dec_ah2;
+int dec_ph, dec_sph;
+
+int dec_sh;
+
+int dec_ph1, dec_ph2;
+
/* G722 encode function two ints in, one 8 bit output */
/* put input samples in xin1 = first value, xin2 = second value */
/* returns il and ih stored together */
- int
+int
abs (int n)
{
int m;
@@ -96,17 +244,347 @@ abs (int n)
return m;
}
+int
+encode (int xin1, int xin2)
+{
+ int i;
+ const int *h_ptr;
+ int *tqmf_ptr, *tqmf_ptr1;
+ long int xa, xb;
+ int decis;
+
+/* transmit quadrature mirror filters implemented here */
+ h_ptr = h;
+ tqmf_ptr = tqmf;
+ xa = (long) (*tqmf_ptr++) * (*h_ptr++);
+ xb = (long) (*tqmf_ptr++) * (*h_ptr++);
+/* main multiply accumulate loop for samples and coefficients */
+ for (i = 0; i < 10; i++)
+ {
+ xa += (long) (*tqmf_ptr++) * (*h_ptr++);
+ xb += (long) (*tqmf_ptr++) * (*h_ptr++);
+ }
+/* final mult/accumulate */
+ xa += (long) (*tqmf_ptr++) * (*h_ptr++);
+ xb += (long) (*tqmf_ptr) * (*h_ptr++);
+
+/* update delay line tqmf */
+ tqmf_ptr1 = tqmf_ptr - 2;
+ for (i = 0; i < 22; i++)
+ *tqmf_ptr-- = *tqmf_ptr1--;
+ *tqmf_ptr-- = xin1;
+ *tqmf_ptr = xin2;
+
+/* scale outputs */
+ xl = (xa + xb) >> 15;
+ xh = (xa - xb) >> 15;
+
+/* end of quadrature mirror filter code */
+
+/* starting with lower sub band encoder */
+
+/* filtez - compute predictor output section - zero section */
+ szl = filtez (delay_bpl, delay_dltx);
+
+/* filtep - compute predictor output signal (pole section) */
+ spl = filtep (rlt1, al1, rlt2, al2);
+
+/* compute the predictor output value in the lower sub_band encoder */
+ sl = szl + spl;
+ el = xl - sl;
+
+/* quantl: quantize the difference signal */
+ il = quantl (el, detl);
+
+/* computes quantized difference signal */
+/* for invqbl, truncate by 2 lsbs, so mode = 3 */
+ dlt = ((long) detl * qq4_code4_table[il >> 2]) >> 15;
+
+/* logscl: updates logarithmic quant. scale factor in low sub band */
+ nbl = logscl (il, nbl);
+
+/* scalel: compute the quantizer scale factor in the lower sub band */
+/* calling parameters nbl and 8 (constant such that scalel can be scaleh) */
+ detl = scalel (nbl, 8);
+
+/* parrec - simple addition to compute recontructed signal for adaptive pred */
+ plt = dlt + szl;
+
+/* upzero: update zero section predictor coefficients (sixth order)*/
+/* calling parameters: dlt, dlt1, dlt2, ..., dlt6 from dlt */
+/* bpli (linear_buffer in which all six values are delayed */
+/* return params: updated bpli, delayed dltx */
+ upzero (dlt, delay_dltx, delay_bpl);
+
+/* uppol2- update second predictor coefficient apl2 and delay it as al2 */
+/* calling parameters: al1, al2, plt, plt1, plt2 */
+ al2 = uppol2 (al1, al2, plt, plt1, plt2);
+
+/* uppol1 :update first predictor coefficient apl1 and delay it as al1 */
+/* calling parameters: al1, apl2, plt, plt1 */
+ al1 = uppol1 (al1, al2, plt, plt1);
+
+/* recons : compute recontructed signal for adaptive predictor */
+ rlt = sl + dlt;
+
+/* done with lower sub_band encoder; now implement delays for next time*/
+ rlt2 = rlt1;
+ rlt1 = rlt;
+ plt2 = plt1;
+ plt1 = plt;
+
+/* high band encode */
+
+ szh = filtez (delay_bph, delay_dhx);
+
+ sph = filtep (rh1, ah1, rh2, ah2);
+
+/* predic: sh = sph + szh */
+ sh = sph + szh;
+/* subtra: eh = xh - sh */
+ eh = xh - sh;
+
+/* quanth - quantization of difference signal for higher sub-band */
+/* quanth: in-place for speed params: eh, deth (has init. value) */
+ if (eh >= 0)
+ {
+ ih = 3; /* 2,3 are pos codes */
+ }
+ else
+ {
+ ih = 1; /* 0,1 are neg codes */
+ }
+ decis = (564L * (long) deth) >> 12L;
+ if (abs (eh) > decis)
+ ih--; /* mih = 2 case */
+
+/* compute the quantized difference signal, higher sub-band*/
+ dh = ((long) deth * qq2_code2_table[ih]) >> 15L;
+
+/* logsch: update logarithmic quantizer scale factor in hi sub-band*/
+ nbh = logsch (ih, nbh);
+
+/* note : scalel and scaleh use same code, different parameters */
+ deth = scalel (nbh, 10);
+
+/* parrec - add pole predictor output to quantized diff. signal */
+ ph = dh + szh;
+
+/* upzero: update zero section predictor coefficients (sixth order) */
+/* calling parameters: dh, dhi, bphi */
+/* return params: updated bphi, delayed dhx */
+ upzero (dh, delay_dhx, delay_bph);
+
+/* uppol2: update second predictor coef aph2 and delay as ah2 */
+/* calling params: ah1, ah2, ph, ph1, ph2 */
+ ah2 = uppol2 (ah1, ah2, ph, ph1, ph2);
+
+/* uppol1: update first predictor coef. aph2 and delay it as ah1 */
+ ah1 = uppol1 (ah1, ah2, ph, ph1);
+
+/* recons for higher sub-band */
+ yh = sh + dh;
+
+/* done with higher sub-band encoder, now Delay for next time */
+ rh2 = rh1;
+ rh1 = yh;
+ ph2 = ph1;
+ ph1 = ph;
+
+/* multiplex ih and il to get signals together */
+ return (il | (ih << 6));
+}
+
+/* decode function, result in xout1 and xout2 */
+
+void
+decode (int input)
+{
+ int i;
+ long int xa1, xa2; /* qmf accumulators */
+ const int *h_ptr;
+ int *ac_ptr, *ac_ptr1, *ad_ptr, *ad_ptr1;
+
+/* split transmitted word from input into ilr and ih */
+ ilr = input & 0x3f;
+ ih = input >> 6;
+
+/* LOWER SUB_BAND DECODER */
+
+/* filtez: compute predictor output for zero section */
+ dec_szl = filtez (dec_del_bpl, dec_del_dltx);
+
+/* filtep: compute predictor output signal for pole section */
+ dec_spl = filtep (dec_rlt1, dec_al1, dec_rlt2, dec_al2);
+
+ dec_sl = dec_spl + dec_szl;
+
+/* compute quantized difference signal for adaptive predic */
+ dec_dlt = ((long) dec_detl * qq4_code4_table[ilr >> 2]) >> 15;
+
+/* compute quantized difference signal for decoder output */
+ dl = ((long) dec_detl * qq6_code6_table[il]) >> 15;
+
+ rl = dl + dec_sl;
+
+/* logscl: quantizer scale factor adaptation in the lower sub-band */
+ dec_nbl = logscl (ilr, dec_nbl);
+
+/* scalel: computes quantizer scale factor in the lower sub band */
+ dec_detl = scalel (dec_nbl, 8);
+
+/* parrec - add pole predictor output to quantized diff. signal */
+/* for partially reconstructed signal */
+ dec_plt = dec_dlt + dec_szl;
+
+/* upzero: update zero section predictor coefficients */
+ upzero (dec_dlt, dec_del_dltx, dec_del_bpl);
+
+/* uppol2: update second predictor coefficient apl2 and delay it as al2 */
+ dec_al2 = uppol2 (dec_al1, dec_al2, dec_plt, dec_plt1, dec_plt2);
+
+/* uppol1: update first predictor coef. (pole setion) */
+ dec_al1 = uppol1 (dec_al1, dec_al2, dec_plt, dec_plt1);
+
+/* recons : compute recontructed signal for adaptive predictor */
+ dec_rlt = dec_sl + dec_dlt;
+
+/* done with lower sub band decoder, implement delays for next time */
+ dec_rlt2 = dec_rlt1;
+ dec_rlt1 = dec_rlt;
+ dec_plt2 = dec_plt1;
+ dec_plt1 = dec_plt;
+
+/* HIGH SUB-BAND DECODER */
+
+/* filtez: compute predictor output for zero section */
+ dec_szh = filtez (dec_del_bph, dec_del_dhx);
+
+/* filtep: compute predictor output signal for pole section */
+ dec_sph = filtep (dec_rh1, dec_ah1, dec_rh2, dec_ah2);
+
+/* predic:compute the predictor output value in the higher sub_band decoder */
+ dec_sh = dec_sph + dec_szh;
+
+/* in-place compute the quantized difference signal */
+ dec_dh = ((long) dec_deth * qq2_code2_table[ih]) >> 15L;
+
+/* logsch: update logarithmic quantizer scale factor in hi sub band */
+ dec_nbh = logsch (ih, dec_nbh);
+
+/* scalel: compute the quantizer scale factor in the higher sub band */
+ dec_deth = scalel (dec_nbh, 10);
+
+/* parrec: compute partially recontructed signal */
+ dec_ph = dec_dh + dec_szh;
+
+/* upzero: update zero section predictor coefficients */
+ upzero (dec_dh, dec_del_dhx, dec_del_bph);
+
+/* uppol2: update second predictor coefficient aph2 and delay it as ah2 */
+ dec_ah2 = uppol2 (dec_ah1, dec_ah2, dec_ph, dec_ph1, dec_ph2);
+
+/* uppol1: update first predictor coef. (pole setion) */
+ dec_ah1 = uppol1 (dec_ah1, dec_ah2, dec_ph, dec_ph1);
+
+/* recons : compute recontructed signal for adaptive predictor */
+ rh = dec_sh + dec_dh;
+
+/* done with high band decode, implementing delays for next time here */
+ dec_rh2 = dec_rh1;
+ dec_rh1 = rh;
+ dec_ph2 = dec_ph1;
+ dec_ph1 = dec_ph;
+
+/* end of higher sub_band decoder */
+
+/* end with receive quadrature mirror filters */
+ xd = rl - rh;
+ xs = rl + rh;
+
+/* receive quadrature mirror filters implemented here */
+ h_ptr = h;
+ ac_ptr = accumc;
+ ad_ptr = accumd;
+ xa1 = (long) xd *(*h_ptr++);
+ xa2 = (long) xs *(*h_ptr++);
+/* main multiply accumulate loop for samples and coefficients */
+ for (i = 0; i < 10; i++)
+ {
+ xa1 += (long) (*ac_ptr++) * (*h_ptr++);
+ xa2 += (long) (*ad_ptr++) * (*h_ptr++);
+ }
+/* final mult/accumulate */
+ xa1 += (long) (*ac_ptr) * (*h_ptr++);
+ xa2 += (long) (*ad_ptr) * (*h_ptr++);
+
+/* scale by 2^14 */
+ xout1 = xa1 >> 14;
+ xout2 = xa2 >> 14;
+
+/* update delay lines */
+ ac_ptr1 = ac_ptr - 1;
+ ad_ptr1 = ad_ptr - 1;
+ for (i = 0; i < 10; i++)
+ {
+ *ac_ptr-- = *ac_ptr1--;
+ *ad_ptr-- = *ad_ptr1--;
+ }
+ *ac_ptr = xd;
+ *ad_ptr = xs;
+}
+
+/* clear all storage locations */
+
+void
+reset ()
+{
+ int i;
+
+ detl = dec_detl = 32; /* reset to min scale factor */
+ deth = dec_deth = 8;
+ nbl = al1 = al2 = plt1 = plt2 = rlt1 = rlt2 = 0;
+ nbh = ah1 = ah2 = ph1 = ph2 = rh1 = rh2 = 0;
+ dec_nbl = dec_al1 = dec_al2 = dec_plt1 = dec_plt2 = dec_rlt1 = dec_rlt2 = 0;
+ dec_nbh = dec_ah1 = dec_ah2 = dec_ph1 = dec_ph2 = dec_rh1 = dec_rh2 = 0;
+
+ for (i = 0; i < 6; i++)
+ {
+ delay_dltx[i] = 0;
+ delay_dhx[i] = 0;
+ dec_del_dltx[i] = 0;
+ dec_del_dhx[i] = 0;
+ }
+
+ for (i = 0; i < 6; i++)
+ {
+ delay_bpl[i] = 0;
+ delay_bph[i] = 0;
+ dec_del_bpl[i] = 0;
+ dec_del_bph[i] = 0;
+ }
+
+ for (i = 0; i < 24; i++)
+ tqmf[i] = 0; // i<23
+
+ for (i = 0; i < 11; i++)
+ {
+ accumc[i] = 0;
+ accumd[i] = 0;
+ }
+}
+
/* filtez - compute predictor output signal (zero section) */
/* input: bpl1-6 and dlt1-6, output: szl */
- int
+int
filtez (int *bpl, int *dlt)
{
int i;
- int zl = 0;
- //zl = (int) (*bpl++) * (*dlt++);
- for (i = 1; i < 7; i++)
- zl += (int) (*bpl++) * (*dlt++);
+ long int zl;
+ zl = (long) (*bpl++) * (*dlt++);
+ for (i = 1; i < 6; i++)
+ zl += (long) (*bpl++) * (*dlt++);
return ((int) (zl >> 14)); /* x2 here */
}
@@ -114,61 +592,34 @@ filtez (int *bpl, int *dlt)
/* filtep - compute predictor output signal (pole section) */
/* input rlt1-2 and al1-2, output spl */
- int
+int
filtep (int rlt1, int al1, int rlt2, int al2)
{
- int pl, pl2;
- pl = rlt1 << 1 ;
- pl = (int) al1 *pl;
- pl2 = rlt2 << 1 ;
- pl += (int) al2 *pl2;
+ long int pl, pl2;
+ pl = 2 * rlt1;
+ pl = (long) al1 *pl;
+ pl2 = 2 * rlt2;
+ pl += (long) al2 *pl2;
return ((int) (pl >> 15));
}
/* quantl - quantize the difference signal in the lower sub-band */
- int
+int
quantl (int el, int detl)
{
-
- const int decis_levl[30] = {
- 280, 576, 880, 1200, 1520, 1864, 2208, 2584,
- 2960, 3376, 3784, 4240, 4696, 5200, 5712, 6288,
- 6864, 7520, 8184, 8968, 9752, 10712, 11664, 12896,
- 14120, 15840, 17560, 20456, 23352, 32767
- };
- /* decision levels - pre-multiplied by 8, 0 to indicate end */
- /* quantization table 31 long to make quantl look-up easier,
- last entry is for mil=30 case when wd is max */
- const int quant26bt_pos[31] = {
- 61, 60, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 50, 49, 48, 47, 46,
- 45, 44, 43, 42, 41, 40, 39, 38,
- 37, 36, 35, 34, 33, 32, 32
- };
-
- /* quantization table 31 long to make quantl look-up easier,
- last entry is for mil=30 case when wd is max */
- const int quant26bt_neg[31] = {
- 63, 62, 31, 30, 29, 28, 27, 26,
- 25, 24, 23, 22, 21, 20, 19, 18,
- 17, 16, 15, 14, 13, 12, 11, 10,
- 9, 8, 7, 6, 5, 4, 4
- };
-
-
int ril, mil;
- int wd, decis;
+ long int wd, decis;
- /* abs of difference signal */
+/* abs of difference signal */
wd = abs (el);
- /* determine mil based on decision levels and detl gain */
+/* determine mil based on decision levels and detl gain */
for (mil = 0; mil < 30; mil++)
- {
- decis = (decis_levl[mil] * (int) detl) >> 15L;
- if (wd <= decis)
- break;
- }
- /* if mil=30 then wd is less than all decision levels */
+ {
+ decis = (decis_levl[mil] * (long) detl) >> 15L;
+ if (wd <= decis)
+ break;
+ }
+/* if mil=30 then wd is less than all decision levels */
if (el >= 0)
ril = quant26bt_pos[mil];
else
@@ -179,19 +630,11 @@ quantl (int el, int detl)
/* logscl - update log quantizer scale factor in lower sub-band */
/* note that nbl is passed and returned */
- int
+int
logscl (int il, int nbl)
{
- const int wl_code_table[16] = {
- -60, 3042, 1198, 538, 334, 172, 58, -30,
- 3042, 1198, 538, 334, 172, 58, -30, -60
- };
-
- int wd;
- int tmp = nbl;
- int val = tmp << 7;
- val -= tmp;
- wd = (val) >> 7L; /* leak factor 127/128 */
+ long int wd;
+ wd = ((long) nbl * 127L) >> 7L; /* leak factor 127/128 */
nbl = (int) wd + wl_code_table[il >> 2];
if (nbl < 0)
nbl = 0;
@@ -202,17 +645,10 @@ logscl (int il, int nbl)
/* scalel: compute quantizer scale factor in lower or upper sub-band*/
- int
+int
scalel (int nbl, int shift_constant)
{
- const int ilb_table[32] = {
- 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383,
- 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834,
- 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371,
- 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008
- };
int wd1, wd2, wd3;
-
wd1 = (nbl >> 6) & 31;
wd2 = nbl >> 11;
wd3 = ilb_table[wd1] >> (shift_constant + 1 - wd2);
@@ -222,37 +658,31 @@ scalel (int nbl, int shift_constant)
/* upzero - inputs: dlt, dlti[0-5], bli[0-5], outputs: updated bli[0-5] */
/* also implements delay of bli and update of dlti from dlt */
- void
+void
upzero (int dlt, int *dlti, int *bli)
{
int i, wd2, wd3;
- /*if dlt is zero, then no sum into bli */
+/*if dlt is zero, then no sum into bli */
if (dlt == 0)
- {
- for (i = 0; i < 6; i++)
{
- int tmp = bli[i];
- int val = tmp << 8;
- val -= tmp;
- bli[i] = (int) (val) >> 8L; /* leak factor of 255/256 */
+ for (i = 0; i < 6; i++)
+ {
+ bli[i] = (int) ((255L * bli[i]) >> 8L); /* leak factor of 255/256 */
+ }
}
- }
else
- {
- for (i = 0; i < 6; i++)
{
- if ((int) dlt * dlti[i] >= 0)
- wd2 = 128;
- else
- wd2 = -128;
- int tmp = bli[i];
- int val = tmp << 8;
- val -= tmp;
- wd3 = (int) (val) >> 8L; /* leak factor of 255/256 */
- bli[i] = wd2 + wd3;
+ for (i = 0; i < 6; i++)
+ {
+ if ((long) dlt * dlti[i] >= 0)
+ wd2 = 128;
+ else
+ wd2 = -128;
+ wd3 = (int) ((255L * bli[i]) >> 8L); /* leak factor of 255/256 */
+ bli[i] = wd2 + wd3;
+ }
}
- }
- /* implement delay line for dlt */
+/* implement delay line for dlt */
dlti[5] = dlti[4];
dlti[4] = dlti[3];
dlti[3] = dlti[2];
@@ -264,29 +694,26 @@ upzero (int dlt, int *dlti, int *bli)
/* uppol2 - update second predictor coefficient (pole section) */
/* inputs: al1, al2, plt, plt1, plt2. outputs: apl2 */
- int
+int
uppol2 (int al1, int al2, int plt, int plt1, int plt2)
{
- int wd2, wd4;
+ long int wd2, wd4;
int apl2;
- wd2 = (int) al1 << 2;
- if ((int) plt * plt1 >= 0L)
+ wd2 = 4L * (long) al1;
+ if ((long) plt * plt1 >= 0L)
wd2 = -wd2; /* check same sign */
wd2 = wd2 >> 7; /* gain of 1/128 */
- if ((int) plt * plt2 >= 0L)
- {
- wd4 = wd2 + 128; /* same sign case */
- }
+ if ((long) plt * plt2 >= 0L)
+ {
+ wd4 = wd2 + 128; /* same sign case */
+ }
else
- {
- wd4 = wd2 - 128;
- }
- int tmp = al2;
- int val = tmp << 7;
- val -= tmp;
- apl2 = wd4 + (val >> 7L); /* leak factor of 127/128 */
-
- /* apl2 is limited to +-.75 */
+ {
+ wd4 = wd2 - 128;
+ }
+ apl2 = wd4 + (127L * (long) al2 >> 7L); /* leak factor of 127/128 */
+
+/* apl2 is limited to +-.75 */
if (apl2 > 12288)
apl2 = 12288;
if (apl2 < -12288)
@@ -297,24 +724,21 @@ uppol2 (int al1, int al2, int plt, int plt1, int plt2)
/* uppol1 - update first predictor coefficient (pole section) */
/* inputs: al1, apl2, plt, plt1. outputs: apl1 */
- int
+int
uppol1 (int al1, int apl2, int plt, int plt1)
{
- int wd2;
+ long int wd2;
int wd3, apl1;
- int tmp = al1;
- int val = tmp << 8;
- val -= tmp;
- wd2 = (val) >> 8L; /* leak factor of 255/256 */
- if ((int) plt * plt1 >= 0L)
- {
- apl1 = (int) wd2 + 192; /* same sign case */
- }
+ wd2 = ((long) al1 * 255L) >> 8L; /* leak factor of 255/256 */
+ if ((long) plt * plt1 >= 0L)
+ {
+ apl1 = (int) wd2 + 192; /* same sign case */
+ }
else
- {
- apl1 = (int) wd2 - 192;
- }
- /* note: wd3= .9375-.75 is always positive */
+ {
+ apl1 = (int) wd2 - 192;
+ }
+/* note: wd3= .9375-.75 is always positive */
wd3 = 15360 - apl2; /* limit value */
if (apl1 > wd3)
apl1 = wd3;
@@ -326,18 +750,11 @@ uppol1 (int al1, int apl2, int plt, int plt1)
/* logsch - update log quantizer scale factor in higher sub-band */
/* note that nbh is passed and returned */
- int
+int
logsch (int ih, int nbh)
{
int wd;
- const int wh_code_table[4] = {
- 798, -214, 798, -214
- };
-
- int tmp = nbh;
- int val = tmp << 7;
- val -= tmp;
- wd = (val) >> 7L; /* leak factor 127/128 */
+ wd = ((long) nbh * 127L) >> 7L; /* leak factor 127/128 */
nbh = wd + wh_code_table[ih];
if (nbh < 0)
nbh = 0;
@@ -347,549 +764,119 @@ logsch (int ih, int nbh)
}
/*
- +--------------------------------------------------------------------------+
- | * Test Vectors (added for CHStone) |
- | test_data : input data |
- | test_compressed : expected output data for "encode" |
- | test_result : expected output data for "decode" |
- +--------------------------------------------------------------------------+
- */
-
-/* G722 C code */
++--------------------------------------------------------------------------+
+| * Test Vectors (added for CHStone) |
+| test_data : input data |
+| test_compressed : expected output data for "encode" |
+| test_result : expected output data for "decode" |
++--------------------------------------------------------------------------+
+*/
+#define SIZE 100
+#define IN_END 100
- void
-adpcm_main (const int test_data[SIZE], int compressed[SIZE], int result[SIZE])
+const int test_data[SIZE] = {
+ 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x44, 0x44, 0x44,
+ 0x44, 0x44, 0x43, 0x43, 0x43,
+ 0x43, 0x43, 0x43, 0x43, 0x42,
+ 0x42, 0x42, 0x42, 0x42, 0x42,
+ 0x41, 0x41, 0x41, 0x41, 0x41,
+ 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x3f, 0x3f,
+ 0x3f, 0x3f, 0x3f, 0x3e, 0x3e,
+ 0x3e, 0x3e, 0x3e, 0x3e, 0x3d,
+ 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
+ 0x3b, 0x3b, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c
+};
+int compressed[SIZE], result[SIZE];
+const int test_compressed[SIZE] = {
+ 0xfd, 0xde, 0x77, 0xba, 0xf2,
+ 0x90, 0x20, 0xa0, 0xec, 0xed,
+ 0xef, 0xf1, 0xf3, 0xf4, 0xf5,
+ 0xf5, 0xf5, 0xf5, 0xf6, 0xf6,
+ 0xf6, 0xf7, 0xf8, 0xf7, 0xf8,
+ 0xf7, 0xf9, 0xf8, 0xf7, 0xf9,
+ 0xf8, 0xf8, 0xf6, 0xf8, 0xf8,
+ 0xf7, 0xf9, 0xf9, 0xf9, 0xf8,
+ 0xf7, 0xfa, 0xf8, 0xf8, 0xf7,
+ 0xfb, 0xfa, 0xf9, 0xf8, 0xf8
+};
+const int test_result[SIZE] = {
+ 0, 0xffffffff, 0xffffffff, 0, 0,
+ 0xffffffff, 0, 0, 0xffffffff, 0xffffffff,
+ 0, 0, 0x1, 0x1, 0,
+ 0xfffffffe, 0xffffffff, 0xfffffffe, 0, 0xfffffffc,
+ 0x1, 0x1, 0x1, 0xfffffffb, 0x2,
+ 0x2, 0x3, 0xb, 0x14, 0x14,
+ 0x16, 0x18, 0x20, 0x21, 0x26,
+ 0x27, 0x2e, 0x2f, 0x33, 0x32,
+ 0x35, 0x33, 0x36, 0x34, 0x37,
+ 0x34, 0x37, 0x35, 0x38, 0x36,
+ 0x39, 0x38, 0x3b, 0x3a, 0x3f,
+ 0x3f, 0x40, 0x3a, 0x3d, 0x3e,
+ 0x41, 0x3c, 0x3e, 0x3f, 0x42,
+ 0x3e, 0x3b, 0x37, 0x3b, 0x3e,
+ 0x41, 0x3b, 0x3b, 0x3a, 0x3b,
+ 0x36, 0x39, 0x3b, 0x3f, 0x3c,
+ 0x3b, 0x37, 0x3b, 0x3d, 0x41,
+ 0x3d, 0x3e, 0x3c, 0x3e, 0x3b,
+ 0x3a, 0x37, 0x3b, 0x3e, 0x41,
+ 0x3c, 0x3b, 0x39, 0x3a, 0x36
+};
+
+void
+adpcm_main ()
{
- /* variables for transimit quadrature mirror filter here */
- int tqmf[24];
-
- /* QMF filter coefficients:
- scaled by a factor of 4 compared to G722 CCITT recomendation */
- const int h[24] = {
- 12, -44, -44, 212, 48, -624, 128, 1448,
- -840, -3220, 3804, 15504, 15504, 3804, -3220, -840,
- 1448, 128, -624, 48, 212, -44, -44, 12
- };
-
-
- /* variables for receive quadrature mirror filter here */
- int accumc[11], accumd[11];
-
- const int qq2_code2_table[4] = {
- -7408, -1616, 7408, 1616
- };
-
- const int qq4_code4_table[16] = {
- 0, -20456, -12896, -8968, -6288, -4240, -2584, -1200,
- 20456, 12896, 8968, 6288, 4240, 2584, 1200, 0
- };
- const int qq6_code6_table[64] = {
- -136, -136, -136, -136, -24808, -21904, -19008, -16704,
- -14984, -13512, -12280, -11192, -10232, -9360, -8576, -7856,
- -7192, -6576, -6000, -5456, -4944, -4464, -4008, -3576,
- -3168, -2776, -2400, -2032, -1688, -1360, -1040, -728,
- 24808, 21904, 19008, 16704, 14984, 13512, 12280, 11192,
- 10232, 9360, 8576, 7856, 7192, 6576, 6000, 5456,
- 4944, 4464, 4008, 3576, 3168, 2776, 2400, 2032,
- 1688, 1360, 1040, 728, 432, 136, -432, -136
- };
-
-
- int delay_dhx[6];
-
- int delay_bph[6];
-
- int dec_del_bpl[6];
-
- int dec_del_dltx[6];
-
- /* variables used in filtez */
- int dec_del_bph[6];
-
- int dec_del_dhx[6];
-
- int delay_bpl[6];
-
- int delay_dltx[6];
- /* outputs of decode() */
- int xout1, xout2;
-
- int xs, xd;
-
- /* variables for encoder (hi and lo) here */
-
- int il, szl, spl, sl, el;
-
-
- int nbl; /* delay line */
- int al1, al2;
- int plt, plt1, plt2;
- int dlt;
- int rlt, rlt1, rlt2;
-
- int detl;
-
- int deth;
- int sh; /* this comes from adaptive predictor */
- int eh;
-
- int ah1, ah2;
- int ph1, ph2;
- int rh1, rh2;
-
- int dh, ih;
- int nbh, szh;
- int sph, ph, yh, rh;
-
- /* variables for decoder here */
- int ilr, rl;
- int dec_deth, dec_detl, dec_dlt;
- int dec_plt, dec_plt1, dec_plt2;
- int dec_szl, dec_spl, dec_sl;
- int dec_rlt1, dec_rlt2, dec_rlt;
- int dec_al1, dec_al2;
- int dl;
- int dec_nbl, dec_dh, dec_nbh;
-
- int dec_szh;
- /* variables used in filtep */
- int dec_rh1, dec_rh2;
- int dec_ah1, dec_ah2;
- int dec_ph, dec_sph;
-
- int dec_sh;
-
- int dec_ph1, dec_ph2;
int i, j;
- /* reset, initialize required memory */
+/* reset, initialize required memory */
+ reset ();
- detl = dec_detl = 32; /* reset to min scale factor */
- deth = dec_deth = 8;
- nbl = al1 = al2 = plt1 = plt2 = rlt1 = rlt2 = 0;
- nbh = ah1 = ah2 = ph1 = ph2 = rh1 = rh2 = 0;
- dec_nbl = dec_al1 = dec_al2 = dec_plt1 = dec_plt2 = dec_rlt1 = dec_rlt2 = 0;
- dec_nbh = dec_ah1 = dec_ah2 = dec_ph1 = dec_ph2 = dec_rh1 = dec_rh2 = 0;
-
- for (i = 0; i < 6; i++)
- {
- delay_dltx[i] = 0;
- delay_dhx[i] = 0;
- dec_del_dltx[i] = 0;
- dec_del_dhx[i] = 0;
- }
-
- for (i = 0; i < 6; i++)
- {
- delay_bpl[i] = 0;
- delay_bph[i] = 0;
- dec_del_bpl[i] = 0;
- dec_del_bph[i] = 0;
- }
-
- for (i = 0; i < 24; i++)
- tqmf[i] = 0; // i<23
-
- for (i = 0; i < 11; i++)
- {
- accumc[i] = 0;
- accumd[i] = 0;
- }
+ j = 10;
for (i = 0; i < IN_END; i += 2)
- {
- int xin1 = test_data[i + 0];
- int xin2 = test_data[i + 1];
- const int *h_ptr;
- int *tqmf_ptr, *tqmf_ptr1;
- int xa = 0, xb = 0;
- int decis;
-
- /* transmit quadrature mirror filters implemented here */
- h_ptr = h;
- tqmf_ptr = tqmf;
- /* main multiply accumulate loop for samples and coefficients */
- for (int j = 0; j < 12; j++)
- {
- int opA1, opB1;
- int opA2, opB2;
- if(j==11){
- opA1 = (*tqmf_ptr++);
- opB1 = (*h_ptr++);
- opA2 = (*tqmf_ptr);
- opB2 = (*h_ptr++);
- }
- else{
- opA1 = (*tqmf_ptr++);
- opB1 = (*h_ptr++);
- opA2 = (*tqmf_ptr++);
- opB2 = (*h_ptr++);
- }
- xa += (int) opA1 * opB1;
- xb += (int) opA2 * opB2;
- }
-
- /* update delay line tqmf */
- tqmf_ptr1 = tqmf_ptr - 2;
- for (int j = 0; j < 22; j++)
- *tqmf_ptr-- = *tqmf_ptr1--;
- *tqmf_ptr-- = xin1;
- *tqmf_ptr = xin2;
-
- /* scale outputs */
- int xl = (xa + xb) >> 15;
- int xh = (xa - xb) >> 15;
-
- /* end of quadrature mirror filter code */
-
- /* starting with lower sub band encoder */
-
- /* filtez - compute predictor output section - zero section */
- szl = filtez (delay_bpl, delay_dltx);
-
- /* filtep - compute predictor output signal (pole section) */
- spl = filtep (rlt1, al1, rlt2, al2);
-
- /* compute the predictor output value in the lower sub_band encoder */
- sl = szl + spl;
- el = xl - sl;
-
- /* quantl: quantize the difference signal */
- il = quantl (el, detl);
-
- /* computes quantized difference signal */
- /* for invqbl, truncate by 2 lsbs, so mode = 3 */
- dlt = ((int) detl * qq4_code4_table[il >> 2]) >> 15;
-
- /* logscl: updates logarithmic quant. scale factor in low sub band */
- nbl = logscl (il, nbl);
-
- /* scalel: compute the quantizer scale factor in the lower sub band */
- /* calling parameters nbl and 8 (constant such that scalel can be scaleh) */
- detl = scalel (nbl, 8);
-
- /* parrec - simple addition to compute recontructed signal for adaptive pred */
- plt = dlt + szl;
-
- /* upzero: update zero section predictor coefficients (sixth order)*/
- /* calling parameters: dlt, dlt1, dlt2, ..., dlt6 from dlt */
- /* bpli (linear_buffer in which all six values are delayed */
- /* return params: updated bpli, delayed dltx */
- upzero (dlt, delay_dltx, delay_bpl);
-
- /* uppol2- update second predictor coefficient apl2 and delay it as al2 */
- /* calling parameters: al1, al2, plt, plt1, plt2 */
- al2 = uppol2 (al1, al2, plt, plt1, plt2);
-
- /* uppol1 :update first predictor coefficient apl1 and delay it as al1 */
- /* calling parameters: al1, apl2, plt, plt1 */
- al1 = uppol1 (al1, al2, plt, plt1);
-
- /* recons : compute recontructed signal for adaptive predictor */
- rlt = sl + dlt;
-
- /* done with lower sub_band encoder; now implement delays for next time*/
- rlt2 = rlt1;
- rlt1 = rlt;
- plt2 = plt1;
- plt1 = plt;
-
- /* high band encode */
-
- szh = filtez (delay_bph, delay_dhx);
-
- sph = filtep (rh1, ah1, rh2, ah2);
-
- /* predic: sh = sph + szh */
- sh = sph + szh;
- /* subtra: eh = xh - sh */
- eh = xh - sh;
-
- /* quanth - quantization of difference signal for higher sub-band */
- /* quanth: in-place for speed params: eh, deth (has init. value) */
- if (eh >= 0)
- {
- ih = 3; /* 2,3 are pos codes */
- }
- else
{
- ih = 1; /* 0,1 are neg codes */
+ compressed[i / 2] = encode (test_data[i], test_data[i + 1]);
}
- decis = (564L * (int) deth) >> 12L;
- if (abs (eh) > decis)
- ih--; /* mih = 2 case */
-
- /* compute the quantized difference signal, higher sub-band*/
- dh = ((int) deth * qq2_code2_table[ih]) >> 15L;
-
- /* logsch: update logarithmic quantizer scale factor in hi sub-band*/
- nbh = logsch (ih, nbh);
-
- /* note : scalel and scaleh use same code, different parameters */
- deth = scalel (nbh, 10);
-
- /* parrec - add pole predictor output to quantized diff. signal */
- ph = dh + szh;
-
- /* upzero: update zero section predictor coefficients (sixth order) */
- /* calling parameters: dh, dhi, bphi */
- /* return params: updated bphi, delayed dhx */
- upzero (dh, delay_dhx, delay_bph);
-
- /* uppol2: update second predictor coef aph2 and delay as ah2 */
- /* calling params: ah1, ah2, ph, ph1, ph2 */
- ah2 = uppol2 (ah1, ah2, ph, ph1, ph2);
-
- /* uppol1: update first predictor coef. aph2 and delay it as ah1 */
- ah1 = uppol1 (ah1, ah2, ph, ph1);
-
- /* recons for higher sub-band */
- yh = sh + dh;
-
- /* done with higher sub-band encoder, now Delay for next time */
- rh2 = rh1;
- rh1 = yh;
- ph2 = ph1;
- ph1 = ph;
-
- /* multiplex ih and il to get signals together */
- compressed[i/2] = (il | (ih << 6));
- }
for (i = 0; i < IN_END; i += 2)
- {
- int input = compressed[i / 2];
-
- int xa1, xa2; /* qmf accumulators */
- const int *h_ptr;
- int *ac_ptr, *ac_ptr1, *ad_ptr, *ad_ptr1;
-
- /* split transmitted word from input into ilr and ih */
- ilr = input & 0x3f;
- ih = input >> 6;
-
- /* LOWER SUB_BAND DECODER */
-
- /* filtez: compute predictor output for zero section */
- dec_szl = filtez (dec_del_bpl, dec_del_dltx);
-
- /* filtep: compute predictor output signal for pole section */
- dec_spl = filtep (dec_rlt1, dec_al1, dec_rlt2, dec_al2);
-
- dec_sl = dec_spl + dec_szl;
-
- /* compute quantized difference signal for adaptive predic */
- dec_dlt = ((int) dec_detl * qq4_code4_table[ilr >> 2]) >> 15;
-
- /* compute quantized difference signal for decoder output */
- dl = ((int) dec_detl * qq6_code6_table[il]) >> 15;
-
- rl = dl + dec_sl;
-
- /* logscl: quantizer scale factor adaptation in the lower sub-band */
- dec_nbl = logscl (ilr, dec_nbl);
-
- /* scalel: computes quantizer scale factor in the lower sub band */
- dec_detl = scalel (dec_nbl, 8);
-
- /* parrec - add pole predictor output to quantized diff. signal */
- /* for partially reconstructed signal */
- dec_plt = dec_dlt + dec_szl;
-
- /* upzero: update zero section predictor coefficients */
- upzero (dec_dlt, dec_del_dltx, dec_del_bpl);
-
- /* uppol2: update second predictor coefficient apl2 and delay it as al2 */
- dec_al2 = uppol2 (dec_al1, dec_al2, dec_plt, dec_plt1, dec_plt2);
-
- /* uppol1: update first predictor coef. (pole setion) */
- dec_al1 = uppol1 (dec_al1, dec_al2, dec_plt, dec_plt1);
-
- /* recons : compute recontructed signal for adaptive predictor */
- dec_rlt = dec_sl + dec_dlt;
-
- /* done with lower sub band decoder, implement delays for next time */
- dec_rlt2 = dec_rlt1;
- dec_rlt1 = dec_rlt;
- dec_plt2 = dec_plt1;
- dec_plt1 = dec_plt;
-
- /* HIGH SUB-BAND DECODER */
-
- /* filtez: compute predictor output for zero section */
- dec_szh = filtez (dec_del_bph, dec_del_dhx);
-
- /* filtep: compute predictor output signal for pole section */
- dec_sph = filtep (dec_rh1, dec_ah1, dec_rh2, dec_ah2);
-
- /* predic:compute the predictor output value in the higher sub_band decoder */
- dec_sh = dec_sph + dec_szh;
-
- /* in-place compute the quantized difference signal */
- dec_dh = ((int) dec_deth * qq2_code2_table[ih]) >> 15L;
-
- /* logsch: update logarithmic quantizer scale factor in hi sub band */
- dec_nbh = logsch (ih, dec_nbh);
-
- /* scalel: compute the quantizer scale factor in the higher sub band */
- dec_deth = scalel (dec_nbh, 10);
-
- /* parrec: compute partially recontructed signal */
- dec_ph = dec_dh + dec_szh;
-
- /* upzero: update zero section predictor coefficients */
- upzero (dec_dh, dec_del_dhx, dec_del_bph);
-
- /* uppol2: update second predictor coefficient aph2 and delay it as ah2 */
- dec_ah2 = uppol2 (dec_ah1, dec_ah2, dec_ph, dec_ph1, dec_ph2);
-
- /* uppol1: update first predictor coef. (pole setion) */
- dec_ah1 = uppol1 (dec_ah1, dec_ah2, dec_ph, dec_ph1);
-
- /* recons : compute recontructed signal for adaptive predictor */
- rh = dec_sh + dec_dh;
-
- /* done with high band decode, implementing delays for next time here */
- dec_rh2 = dec_rh1;
- dec_rh1 = rh;
- dec_ph2 = dec_ph1;
- dec_ph1 = dec_ph;
-
- /* end of higher sub_band decoder */
-
- /* end with receive quadrature mirror filters */
- xd = rl - rh;
- xs = rl + rh;
-
- /* receive quadrature mirror filters implemented here */
- h_ptr = h;
- ac_ptr = accumc;
- ad_ptr = accumd;
- /* main multiply accumulate loop for samples and coefficients */
- for (int j = 0; j < 12; j++)
- {
- int opA1, opB1;
- int opA2, opB2;
- if(i==0){
- opA1 = xd;
- opB1 = (*h_ptr++);
- opA2 = xs;
- opB2 = (*h_ptr++);
- }
- else if(i==11){
- opA1 = (*ac_ptr++);
- opB1 = (*h_ptr++);
- opA2 = (*ad_ptr++);
- opB2 = (*h_ptr++);
- }
- else{
- opA1 = (*ac_ptr);
- opB1 = (*h_ptr++);
- opA2 = (*ad_ptr);
- opB2 = (*h_ptr++);
- }
- xa1 += (int) opA1 * opB1;
- xa2 += (int) opA2 * opB2;
- }
-
- /* scale by 2^14 */
- xout1 = xa1 >> 14;
- xout2 = xa2 >> 14;
-
- /* update delay lines */
- ac_ptr1 = ac_ptr - 1;
- ad_ptr1 = ad_ptr - 1;
- for (j = 0; j < 10; j++)
{
- *ac_ptr-- = *ac_ptr1--;
- *ad_ptr-- = *ad_ptr1--;
+ decode (compressed[i / 2]);
+ result[i] = xout1;
+ result[i + 1] = xout2;
}
- *ac_ptr = xd;
- *ad_ptr = xs;
- result[i] = xout1;
- result[i + 1] = xout2;
- }
}
- int
+int
main ()
{
int i;
int main_result;
- const int test_data[SIZE] = {
- 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x44, 0x44, 0x44,
- 0x44, 0x44, 0x43, 0x43, 0x43,
- 0x43, 0x43, 0x43, 0x43, 0x42,
- 0x42, 0x42, 0x42, 0x42, 0x42,
- 0x41, 0x41, 0x41, 0x41, 0x41,
- 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x3f, 0x3f,
- 0x3f, 0x3f, 0x3f, 0x3e, 0x3e,
- 0x3e, 0x3e, 0x3e, 0x3e, 0x3d,
- 0x3d, 0x3d, 0x3d, 0x3d, 0x3d,
- 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
- 0x3c, 0x3c, 0x3c, 0x3c, 0x3b,
- 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
- 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
- 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
- 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
- 0x3b, 0x3b, 0x3c, 0x3c, 0x3c,
- 0x3c, 0x3c, 0x3c, 0x3c, 0x3c
- };
- int compressed[SIZE], result[SIZE];
- const int test_compressed[SIZE] = {
- 0xfd, 0xde, 0x77, 0xba, 0xf2,
- 0x90, 0x20, 0xa0, 0xec, 0xed,
- 0xef, 0xf1, 0xf3, 0xf4, 0xf5,
- 0xf5, 0xf5, 0xf5, 0xf6, 0xf6,
- 0xf6, 0xf7, 0xf8, 0xf7, 0xf8,
- 0xf7, 0xf9, 0xf8, 0xf7, 0xf9,
- 0xf8, 0xf8, 0xf6, 0xf8, 0xf8,
- 0xf7, 0xf9, 0xf9, 0xf9, 0xf8,
- 0xf7, 0xfa, 0xf8, 0xf8, 0xf7,
- 0xfb, 0xfa, 0xf9, 0xf8, 0xf8
- };
- const int test_result[SIZE] = {
- 0, 0xffffffff, 0xffffffff, 0, 0,
- 0xffffffff, 0, 0, 0xffffffff, 0xffffffff,
- 0, 0, 0x1, 0x1, 0,
- 0xfffffffe, 0xffffffff, 0xfffffffe, 0, 0xfffffffc,
- 0x1, 0x1, 0x1, 0xfffffffb, 0x2,
- 0x2, 0x3, 0xb, 0x14, 0x14,
- 0x16, 0x18, 0x20, 0x21, 0x26,
- 0x27, 0x2e, 0x2f, 0x33, 0x32,
- 0x35, 0x33, 0x36, 0x34, 0x37,
- 0x34, 0x37, 0x35, 0x38, 0x36,
- 0x39, 0x38, 0x3b, 0x3a, 0x3f,
- 0x3f, 0x40, 0x3a, 0x3d, 0x3e,
- 0x41, 0x3c, 0x3e, 0x3f, 0x42,
- 0x3e, 0x3b, 0x37, 0x3b, 0x3e,
- 0x41, 0x3b, 0x3b, 0x3a, 0x3b,
- 0x36, 0x39, 0x3b, 0x3f, 0x3c,
- 0x3b, 0x37, 0x3b, 0x3d, 0x41,
- 0x3d, 0x3e, 0x3c, 0x3e, 0x3b,
- 0x3a, 0x37, 0x3b, 0x3e, 0x41,
- 0x3c, 0x3b, 0x39, 0x3a, 0x36
- };
-
- main_result = 0;
- adpcm_main (test_data,compressed,result);
- for (i = 0; i < IN_END / 2; i++)
- {
- if (compressed[i] != test_compressed[i])
- {
- main_result += 1;
- }
- }/*
- for (i = 0; i < IN_END; i++)
- {
- if (result[i] != test_result[i])
- {
- main_result += 1;
+ main_result = 0;
+ adpcm_main ();
+ for (i = 0; i < IN_END / 2; i++)
+ {
+ if (compressed[i] != test_compressed[i])
+ {
+ main_result += 1;
+ }
+ }
+ for (i = 0; i < IN_END; i++)
+ {
+ if (result[i] != test_result[i])
+ {
+ main_result += 1;
+ }
+ }
+ printf ("%d\n", main_result);
+ return main_result;
}
- }*/
- return main_result;
-}
diff --git a/benchmarks/CHStone/aes/aes.c b/benchmarks/CHStone/aes/aes.c
index efbb5d8..a0cdf2d 100755
--- a/benchmarks/CHStone/aes/aes.c
+++ b/benchmarks/CHStone/aes/aes.c
@@ -62,707 +62,17 @@
#include <stdio.h>
-int
-SubByte (int in, const int Sbox[16][16])
-{
- return Sbox[(in / 16)][(in % 16)];
-}
-
-
-/* **************** key expand ************************ */
-int
-KeySchedule (int type, int key[32], int word[4][120], const int Sbox[16][16])
-{
- int nk, nb, round_val;
- int i, j, temp[4];
- const int Rcon0[30] = {
- 0x01, 0x02, 0x04, 0x08,
- 0x10, 0x20, 0x40, 0x80,
- 0x1b, 0x36, 0x6c, 0xd8,
- 0xab, 0x4d, 0x9a, 0x2f,
- 0x5e, 0xbc, 0x63, 0xc6,
- 0x97, 0x35, 0x6a, 0xd4,
- 0xb3, 0x7d, 0xfa, 0xef,
- 0xc5, 0x91,
- };
-
-
- switch (type)
- {
- case 128128:
- nk = 4;
- nb = 4;
- round_val = 10;
- break;
- case 128192:
- nk = 4;
- nb = 6;
- round_val = 12;
- break;
- case 128256:
- nk = 4;
- nb = 8;
- round_val = 14;
- break;
- case 192128:
- nk = 6;
- nb = 4;
- round_val = 12;
- break;
- case 192192:
- nk = 6;
- nb = 6;
- round_val = 12;
- break;
- case 192256:
- nk = 6;
- nb = 8;
- round_val = 14;
- break;
- case 256128:
- nk = 8;
- nb = 4;
- round_val = 14;
- break;
- case 256192:
- nk = 8;
- nb = 6;
- round_val = 14;
- break;
- case 256256:
- nk = 8;
- nb = 8;
- round_val = 14;
- break;
- default:
- return -1;
- }
- for (j = 0; j < nk; ++j)
- for (i = 0; i < 4; ++i)
-/* 0 word */
- word[i][j] = key[i + j * 4];
-
-/* expanded key is generated */
- for (j = nk; j < nb * (round_val + 1); ++j)
- {
-
-/* RotByte */
- if ((j % nk) == 0)
- {
- temp[0] = SubByte (word[1][j - 1], Sbox) ^ Rcon0[(j / nk) - 1];
- temp[1] = SubByte (word[2][j - 1], Sbox);
- temp[2] = SubByte (word[3][j - 1], Sbox);
- temp[3] = SubByte (word[0][j - 1], Sbox);
- }
- if ((j % nk) != 0)
- {
- temp[0] = word[0][j - 1];
- temp[1] = word[1][j - 1];
- temp[2] = word[2][j - 1];
- temp[3] = word[3][j - 1];
- }
- if (nk > 6 && j % nk == 4)
- for (i = 0; i < 4; ++i)
- temp[i] = SubByte (temp[i], Sbox);
- for (i = 0; i < 4; ++i)
- word[i][j] = word[i][j - nk] ^ temp[i];
- }
- return 0;
-}
-
-/* ********* ByteSub & ShiftRow ********* */
-void
-ByteSub_ShiftRow (int statemt[32], int nb, const int Sbox[16][16])
-{
- int temp;
-
- switch (nb)
- {
- case 4:
- temp = Sbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = Sbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = Sbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = Sbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = temp;
-
- temp = Sbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = Sbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = temp;
- temp = Sbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = Sbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = temp;
-
- temp = Sbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = Sbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = Sbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = Sbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = temp;
-
- statemt[0] = Sbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = Sbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = Sbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = Sbox[statemt[12] >> 4][statemt[12] & 0xf];
- break;
- case 6:
- temp = Sbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = Sbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = Sbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = Sbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = Sbox[statemt[17] >> 4][statemt[17] & 0xf];
- statemt[17] = Sbox[statemt[21] >> 4][statemt[21] & 0xf];
- statemt[21] = temp;
-
- temp = Sbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = Sbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = Sbox[statemt[18] >> 4][statemt[18] & 0xf];
- statemt[18] = temp;
- temp = Sbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = Sbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = Sbox[statemt[22] >> 4][statemt[22] & 0xf];
- statemt[22] = temp;
-
- temp = Sbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = Sbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = temp;
- temp = Sbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = Sbox[statemt[19] >> 4][statemt[19] & 0xf];
- statemt[19] = temp;
- temp = Sbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = Sbox[statemt[23] >> 4][statemt[23] & 0xf];
- statemt[23] = temp;
-
- statemt[0] = Sbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = Sbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = Sbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = Sbox[statemt[12] >> 4][statemt[12] & 0xf];
- statemt[16] = Sbox[statemt[16] >> 4][statemt[16] & 0xf];
- statemt[20] = Sbox[statemt[20] >> 4][statemt[20] & 0xf];
- break;
- case 8:
- temp = Sbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = Sbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = Sbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = Sbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = Sbox[statemt[17] >> 4][statemt[17] & 0xf];
- statemt[17] = Sbox[statemt[21] >> 4][statemt[21] & 0xf];
- statemt[21] = Sbox[statemt[25] >> 4][statemt[25] & 0xf];
- statemt[25] = Sbox[statemt[29] >> 4][statemt[29] & 0xf];
- statemt[29] = temp;
-
- temp = Sbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = Sbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = Sbox[statemt[26] >> 4][statemt[26] & 0xf];
- statemt[26] = Sbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = Sbox[statemt[18] >> 4][statemt[18] & 0xf];
- statemt[18] = Sbox[statemt[30] >> 4][statemt[30] & 0xf];
- statemt[30] = Sbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = Sbox[statemt[22] >> 4][statemt[22] & 0xf];
- statemt[22] = temp;
-
- temp = Sbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = Sbox[statemt[19] >> 4][statemt[19] & 0xf];
- statemt[19] = temp;
- temp = Sbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = Sbox[statemt[23] >> 4][statemt[23] & 0xf];
- statemt[23] = temp;
- temp = Sbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = Sbox[statemt[27] >> 4][statemt[27] & 0xf];
- statemt[27] = temp;
- temp = Sbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = Sbox[statemt[31] >> 4][statemt[31] & 0xf];
- statemt[31] = temp;
-
- statemt[0] = Sbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = Sbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = Sbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = Sbox[statemt[12] >> 4][statemt[12] & 0xf];
- statemt[16] = Sbox[statemt[16] >> 4][statemt[16] & 0xf];
- statemt[20] = Sbox[statemt[20] >> 4][statemt[20] & 0xf];
- statemt[24] = Sbox[statemt[24] >> 4][statemt[24] & 0xf];
- statemt[28] = Sbox[statemt[28] >> 4][statemt[28] & 0xf];
- break;
- }
-}
-
-/* ********* InversShiftRow & ByteSub ********* */
-void
-InversShiftRow_ByteSub (int statemt[32], int nb, const int invSbox[16][16])
-{
- int temp;
-
- switch (nb)
- {
- case 4:
- temp = invSbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = invSbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = invSbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = invSbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = temp;
-
- temp = invSbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = invSbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = temp;
- temp = invSbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = invSbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = temp;
-
- temp = invSbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = invSbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = invSbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = invSbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = temp;
-
- statemt[0] = invSbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = invSbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = invSbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = invSbox[statemt[12] >> 4][statemt[12] & 0xf];
- break;
- case 6:
- temp = invSbox[statemt[21] >> 4][statemt[21] & 0xf];
- statemt[21] = invSbox[statemt[17] >> 4][statemt[17] & 0xf];
- statemt[17] = invSbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = invSbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = invSbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = invSbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = temp;
-
- temp = invSbox[statemt[22] >> 4][statemt[22] & 0xf];
- statemt[22] = invSbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = invSbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = temp;
- temp = invSbox[statemt[18] >> 4][statemt[18] & 0xf];
- statemt[18] = invSbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = invSbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = temp;
-
- temp = invSbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = invSbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = temp;
- temp = invSbox[statemt[19] >> 4][statemt[19] & 0xf];
- statemt[19] = invSbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = temp;
- temp = invSbox[statemt[23] >> 4][statemt[23] & 0xf];
- statemt[23] = invSbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = temp;
-
- statemt[0] = invSbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = invSbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = invSbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = invSbox[statemt[12] >> 4][statemt[12] & 0xf];
- statemt[16] = invSbox[statemt[16] >> 4][statemt[16] & 0xf];
- statemt[20] = invSbox[statemt[20] >> 4][statemt[20] & 0xf];
- break;
- case 8:
- temp = invSbox[statemt[29] >> 4][statemt[29] & 0xf];
- statemt[29] = invSbox[statemt[25] >> 4][statemt[25] & 0xf];
- statemt[25] = invSbox[statemt[21] >> 4][statemt[21] & 0xf];
- statemt[21] = invSbox[statemt[17] >> 4][statemt[17] & 0xf];
- statemt[17] = invSbox[statemt[13] >> 4][statemt[13] & 0xf];
- statemt[13] = invSbox[statemt[9] >> 4][statemt[9] & 0xf];
- statemt[9] = invSbox[statemt[5] >> 4][statemt[5] & 0xf];
- statemt[5] = invSbox[statemt[1] >> 4][statemt[1] & 0xf];
- statemt[1] = temp;
-
- temp = invSbox[statemt[30] >> 4][statemt[30] & 0xf];
- statemt[30] = invSbox[statemt[18] >> 4][statemt[18] & 0xf];
- statemt[18] = invSbox[statemt[6] >> 4][statemt[6] & 0xf];
- statemt[6] = invSbox[statemt[26] >> 4][statemt[26] & 0xf];
- statemt[26] = invSbox[statemt[14] >> 4][statemt[14] & 0xf];
- statemt[14] = invSbox[statemt[2] >> 4][statemt[2] & 0xf];
- statemt[2] = invSbox[statemt[22] >> 4][statemt[22] & 0xf];
- statemt[22] = invSbox[statemt[10] >> 4][statemt[10] & 0xf];
- statemt[10] = temp;
-
- temp = invSbox[statemt[31] >> 4][statemt[31] & 0xf];
- statemt[31] = invSbox[statemt[15] >> 4][statemt[15] & 0xf];
- statemt[15] = temp;
- temp = invSbox[statemt[27] >> 4][statemt[27] & 0xf];
- statemt[27] = invSbox[statemt[11] >> 4][statemt[11] & 0xf];
- statemt[11] = temp;
- temp = invSbox[statemt[23] >> 4][statemt[23] & 0xf];
- statemt[23] = invSbox[statemt[7] >> 4][statemt[7] & 0xf];
- statemt[7] = temp;
- temp = invSbox[statemt[19] >> 4][statemt[19] & 0xf];
- statemt[19] = invSbox[statemt[3] >> 4][statemt[3] & 0xf];
- statemt[3] = temp;
-
- statemt[0] = invSbox[statemt[0] >> 4][statemt[0] & 0xf];
- statemt[4] = invSbox[statemt[4] >> 4][statemt[4] & 0xf];
- statemt[8] = invSbox[statemt[8] >> 4][statemt[8] & 0xf];
- statemt[12] = invSbox[statemt[12] >> 4][statemt[12] & 0xf];
- statemt[16] = invSbox[statemt[16] >> 4][statemt[16] & 0xf];
- statemt[20] = invSbox[statemt[20] >> 4][statemt[20] & 0xf];
- statemt[24] = invSbox[statemt[24] >> 4][statemt[24] & 0xf];
- statemt[28] = invSbox[statemt[28] >> 4][statemt[28] & 0xf];
- break;
- }
-}
-
-/* ******** MixColumn ********** */
-int
-MixColumn_AddRoundKey (int statemt[32], int nb, int n, int word[4][120])
-{
- int ret[8 * 4], j;
- register int x;
-
- for (j = 0; j < nb; ++j)
- {
- ret[j * 4] = (statemt[j * 4] << 1);
- if ((ret[j * 4] >> 8) == 1)
- ret[j * 4] ^= 283;
- x = statemt[1 + j * 4];
- x ^= (x << 1);
- if ((x >> 8) == 1)
- ret[j * 4] ^= (x ^ 283);
- else
- ret[j * 4] ^= x;
- ret[j * 4] ^=
- statemt[2 + j * 4] ^ statemt[3 + j * 4] ^ word[0][j + nb * n];
-
- ret[1 + j * 4] = (statemt[1 + j * 4] << 1);
- if ((ret[1 + j * 4] >> 8) == 1)
- ret[1 + j * 4] ^= 283;
- x = statemt[2 + j * 4];
- x ^= (x << 1);
- if ((x >> 8) == 1)
- ret[1 + j * 4] ^= (x ^ 283);
- else
- ret[1 + j * 4] ^= x;
- ret[1 + j * 4] ^=
- statemt[3 + j * 4] ^ statemt[j * 4] ^ word[1][j + nb * n];
-
- ret[2 + j * 4] = (statemt[2 + j * 4] << 1);
- if ((ret[2 + j * 4] >> 8) == 1)
- ret[2 + j * 4] ^= 283;
- x = statemt[3 + j * 4];
- x ^= (x << 1);
- if ((x >> 8) == 1)
- ret[2 + j * 4] ^= (x ^ 283);
- else
- ret[2 + j * 4] ^= x;
- ret[2 + j * 4] ^=
- statemt[j * 4] ^ statemt[1 + j * 4] ^ word[2][j + nb * n];
-
- ret[3 + j * 4] = (statemt[3 + j * 4] << 1);
- if ((ret[3 + j * 4] >> 8) == 1)
- ret[3 + j * 4] ^= 283;
- x = statemt[j * 4];
- x ^= (x << 1);
- if ((x >> 8) == 1)
- ret[3 + j * 4] ^= (x ^ 283);
- else
- ret[3 + j * 4] ^= x;
- ret[3 + j * 4] ^=
- statemt[1 + j * 4] ^ statemt[2 + j * 4] ^ word[3][j + nb * n];
- }
- for (j = 0; j < nb; ++j)
- {
- statemt[j * 4] = ret[j * 4];
- statemt[1 + j * 4] = ret[1 + j * 4];
- statemt[2 + j * 4] = ret[2 + j * 4];
- statemt[3 + j * 4] = ret[3 + j * 4];
- }
- return 0;
-}
-
-/* ******** InversMixColumn ********** */
-int
-AddRoundKey_InversMixColumn (int statemt[32], int nb, int n, int word[4][120])
-{
- int ret[8 * 4], i, j;
- register int x;
-
- for (j = 0; j < nb; ++j)
- {
- statemt[j * 4] ^= word[0][j + nb * n];
- statemt[1 + j * 4] ^= word[1][j + nb * n];
- statemt[2 + j * 4] ^= word[2][j + nb * n];
- statemt[3 + j * 4] ^= word[3][j + nb * n];
- }
- for (j = 0; j < nb; ++j)
- for (i = 0; i < 4; ++i)
- {
- x = (statemt[i + j * 4] << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[i + j * 4];
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[i + j * 4];
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- ret[i + j * 4] = x;
-
- x = (statemt[(i + 1) % 4 + j * 4] << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[(i + 1) % 4 + j * 4];
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[(i + 1) % 4 + j * 4];
- ret[i + j * 4] ^= x;
+int main_result;
- x = (statemt[(i + 2) % 4 + j * 4] << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[(i + 2) % 4 + j * 4];
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[(i + 2) % 4 + j * 4];
- ret[i + j * 4] ^= x;
-
- x = (statemt[(i + 3) % 4 + j * 4] << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x = (x << 1);
- if ((x >> 8) == 1)
- x ^= 283;
- x ^= statemt[(i + 3) % 4 + j * 4];
- ret[i + j * 4] ^= x;
- }
- for (i = 0; i < nb; ++i)
- {
- statemt[i * 4] = ret[i * 4];
- statemt[1 + i * 4] = ret[1 + i * 4];
- statemt[2 + i * 4] = ret[2 + i * 4];
- statemt[3 + i * 4] = ret[3 + i * 4];
- }
- return 0;
-}
-
-/* ******** AddRoundKey ********** */
-int
-AddRoundKey (int statemt[32], int type, int n, int word[4][120])
-{
- int j, nb;
+#include "aes.h"
+#include "aes_enc.c"
+#include "aes_dec.c"
+#include "aes_key.c"
+#include "aes_func.c"
- switch (type)
- {
- case 128128:
- case 192128:
- case 256128:
- nb = 4;
- break;
- case 128192:
- case 192192:
- case 256192:
- nb = 6;
- break;
- case 128256:
- case 192256:
- case 256256:
- nb = 8;
- break;
- }
- for (j = 0; j < nb; ++j)
- {
- statemt[j * 4] ^= word[0][j + nb * n];
- statemt[1 + j * 4] ^= word[1][j + nb * n];
- statemt[2 + j * 4] ^= word[2][j + nb * n];
- statemt[3 + j * 4] ^= word[3][j + nb * n];
- }
- return 0;
-}
-int
-encrypt (int statemt[32], int key[32], int type, int *main_result, const int Sbox[16][16])
-{
- int i;
- int nb;
- int round_val;
- int word[4][120];
-/*
-+--------------------------------------------------------------------------+
-| * Test Vector (added for CHStone) |
-| out_enc_statemt : expected output data for "encrypt" |
-+--------------------------------------------------------------------------+
-*/
- const int out_enc_statemt[16] =
- { 0x39, 0x25, 0x84, 0x1d, 0x2, 0xdc, 0x9, 0xfb, 0xdc, 0x11, 0x85, 0x97,
- 0x19, 0x6a, 0xb, 0x32
- };
-
- KeySchedule (type, key, word, Sbox);
- switch (type)
- {
- case 128128:
- round_val = 0;
- nb = 4;
- break;
- case 192128:
- round_val = 2;
- nb = 4;
- break;
- case 256128:
- round_val = 4;
- nb = 4;
- break;
- case 128192:
- case 192192:
- round_val = 2;
- nb = 6;
- break;
- case 256192:
- round_val = 4;
- nb = 6;
- break;
- case 128256:
- case 192256:
- case 256256:
- round_val = 4;
- nb = 8;
- break;
- }
- AddRoundKey (statemt, type, 0, word);
- for (i = 1; i <= round_val + 9; ++i)
- {
- ByteSub_ShiftRow (statemt, nb, Sbox);
- MixColumn_AddRoundKey (statemt, nb, i, word);
- }
- ByteSub_ShiftRow (statemt, nb, Sbox);
- AddRoundKey (statemt, type, i, word);
-/*
- printf ("encrypted message \t");
- for (i = 0; i < nb * 4; ++i)
- {
- if (statemt[i] < 16)
- printf ("0");
- printf ("%x", statemt[i]);
- }
-*/
- for (i = 0; i < 16; i++)
- *main_result += (statemt[i] != out_enc_statemt[i]);
-
- return 0;
-}
-
-int
-decrypt (int statemt[32], int key[32], int type, int *main_result, const int Sbox[16][16])
-{
- int i;
- int nb;
- int round_val;
- int word[4][120];
- const int invSbox[16][16] = {
- {0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e,
- 0x81, 0xf3, 0xd7, 0xfb},
- {0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44,
- 0xc4, 0xde, 0xe9, 0xcb},
- {0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b,
- 0x42, 0xfa, 0xc3, 0x4e},
- {0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49,
- 0x6d, 0x8b, 0xd1, 0x25},
- {0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc,
- 0x5d, 0x65, 0xb6, 0x92},
- {0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57,
- 0xa7, 0x8d, 0x9d, 0x84},
- {0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05,
- 0xb8, 0xb3, 0x45, 0x06},
- {0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03,
- 0x01, 0x13, 0x8a, 0x6b},
- {0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce,
- 0xf0, 0xb4, 0xe6, 0x73},
- {0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8,
- 0x1c, 0x75, 0xdf, 0x6e},
- {0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e,
- 0xaa, 0x18, 0xbe, 0x1b},
- {0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe,
- 0x78, 0xcd, 0x5a, 0xf4},
- {0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59,
- 0x27, 0x80, 0xec, 0x5f},
- {0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f,
- 0x93, 0xc9, 0x9c, 0xef},
- {0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c,
- 0x83, 0x53, 0x99, 0x61},
- {0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63,
- 0x55, 0x21, 0x0c, 0x7d}
- };
-/*
-+--------------------------------------------------------------------------+
-| * Test Vector (added for CHStone) |
-| out_enc_statemt : expected output data for "decrypt" |
-+--------------------------------------------------------------------------+
-*/
- const int out_dec_statemt[16] =
- { 0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2,
- 0xe0, 0x37, 0x7, 0x34
- };
- KeySchedule (type, key, word, Sbox);
-
- switch (type)
- {
- case 128128:
- round_val = 10;
- nb = 4;
- break;
- case 128192:
- case 192192:
- round_val = 12;
- nb = 6;
- break;
- case 192128:
- round_val = 12;
- nb = 4;
- break;
- case 128256:
- case 192256:
- round_val = 14;
- nb = 8;
- break;
- case 256128:
- round_val = 14;
- nb = 4;
- break;
- case 256192:
- round_val = 14;
- nb = 6;
- break;
- case 256256:
- round_val = 14;
- nb = 8;
- break;
- }
-
- AddRoundKey (statemt, type, round_val, word);
-
- InversShiftRow_ByteSub (statemt, nb, invSbox);
-
- for (i = round_val - 1; i >= 1; --i)
- {
- AddRoundKey_InversMixColumn (statemt, nb, i, word);
- InversShiftRow_ByteSub (statemt, nb, invSbox);
- }
-
- AddRoundKey (statemt, type, 0, word);
-/*
- printf ("\ndecrypto message\t");
- for (i = 0; i < ((type % 1000) / 8); ++i)
- {
- if (statemt[i] < 16)
- printf ("0");
- printf ("%x", statemt[i]);
- }
-*/
- for (i = 0; i < 16; i++)
- *main_result += (statemt[i] != out_dec_statemt[i]);
-
- return 0;
-}
/* ***************** main **************************** */
int
-aes_main (int *res)
+aes_main (void)
{
/*
+--------------------------------------------------------------------------+
@@ -770,8 +80,6 @@ aes_main (int *res)
| statemt, key : input data |
+--------------------------------------------------------------------------+
*/
- int key[32];
- int statemt[32];
statemt[0] = 50;
statemt[1] = 67;
statemt[2] = 246;
@@ -805,52 +113,17 @@ aes_main (int *res)
key[13] = 207;
key[14] = 79;
key[15] = 60;
-const int Sbox[16][16] = {
- {0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
- 0xfe, 0xd7, 0xab, 0x76},
- {0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf,
- 0x9c, 0xa4, 0x72, 0xc0},
- {0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1,
- 0x71, 0xd8, 0x31, 0x15},
- {0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2,
- 0xeb, 0x27, 0xb2, 0x75},
- {0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3,
- 0x29, 0xe3, 0x2f, 0x84},
- {0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39,
- 0x4a, 0x4c, 0x58, 0xcf},
- {0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f,
- 0x50, 0x3c, 0x9f, 0xa8},
- {0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21,
- 0x10, 0xff, 0xf3, 0xd2},
- {0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d,
- 0x64, 0x5d, 0x19, 0x73},
- {0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14,
- 0xde, 0x5e, 0x0b, 0xdb},
- {0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62,
- 0x91, 0x95, 0xe4, 0x79},
- {0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea,
- 0x65, 0x7a, 0xae, 0x08},
- {0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f,
- 0x4b, 0xbd, 0x8b, 0x8a},
- {0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9,
- 0x86, 0xc1, 0x1d, 0x9e},
- {0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9,
- 0xce, 0x55, 0x28, 0xdf},
- {0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f,
- 0xb0, 0x54, 0xbb, 0x16}
-};
- encrypt (statemt, key, 128128, res, Sbox);
- decrypt (statemt, key, 128128, res, Sbox);
+ encrypt (statemt, key, 128128);
+ decrypt (statemt, key, 128128);
return 0;
}
int
main ()
{
- int main_result;
main_result = 0;
- aes_main (&main_result);
- //printf ("\n%d\n", main_result);
+ aes_main ();
+ printf ("\n%d\n", main_result);
return main_result;
}
diff --git a/benchmarks/CHStone/gsm/gsm.c b/benchmarks/CHStone/gsm/gsm.c
index ff472c3..282437a 100755
--- a/benchmarks/CHStone/gsm/gsm.c
+++ b/benchmarks/CHStone/gsm/gsm.c
@@ -16,514 +16,95 @@
| 4. Please follow the copyright of each benchmark program. |
+--------------------------------------------------------------------------+
*/
-//#include <stdio.h>
-typedef int word; /* 16 bit signed int */
-typedef long longword; /* 32 bit signed int */
+#include <stdio.h>
+#include "lpc.c"
-#define MIN_WORD ((-32767)-1)
-#define MAX_WORD ( 32767)
-
-#define SASR(x, by) ((x) >> (by))
-
-#define GSM_MULT_R(a, b) gsm_mult_r(a, b)
-#define GSM_MULT(a, b) gsm_mult(a, b)
-#define GSM_ADD(a, b) gsm_add(a, b)
-#define GSM_ABS(a) gsm_abs(a)
-
-#define saturate(x) \
- ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
-
-word
-gsm_add (word a, word b)
-{
- longword sum;
- sum = (longword) a + (longword) b;
- return saturate (sum);
-}
-
-word
-gsm_mult (word a, word b)
-{
- if (a == MIN_WORD && b == MIN_WORD)
- return MAX_WORD;
- else
- return SASR ((longword) a * (longword) b, 15);
-}
-
-word
-gsm_mult_r (word a, word b)
-{
- longword prod;
- if (b == MIN_WORD && a == MIN_WORD)
- return MAX_WORD;
- else
- {
- prod = (longword) a *(longword) b + 16384;
- prod >>= 15;
- return prod & 0xFFFF;
- }
-}
-
-word
-gsm_abs (word a)
-{
- return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
-}
-
-word
-gsm_norm (longword a)
-/*
- * the number of left shifts needed to normalize the 32 bit
- * variable L_var1 for positive values on the interval
- *
- * with minimum of
- * minimum of 1073741824 (01000000000000000000000000000000) and
- * maximum of 2147483647 (01111111111111111111111111111111)
- *
- *
- * and for negative values on the interval with
- * minimum of -2147483648 (-10000000000000000000000000000000) and
- * maximum of -1073741824 ( -1000000000000000000000000000000).
- *
- * in order to normalize the result, the following
- * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
- *
- * (That's 'ffs', only from the left, not the right..)
- */
-{
- const unsigned int bitoff[256] = {
- 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
- if (a < 0)
- {
- if (a <= -1073741824)
- return 0;
- a = ~a;
- }
-
- return a & 0xffff0000 ?
- (a & 0xff000000 ? -1 + bitoff[0xFF & (a >> 24)] :
- 7 + bitoff[0xFF & (a >> 16)])
- : (a & 0xff00 ? 15 + bitoff[0xFF & (a >> 8)] : 23 + bitoff[0xFF & a]);
-}
-
-word
-gsm_div (word num, word denum)
-{
- longword L_num;
- longword L_denum;
- word div;
- int k;
-
- L_num = num;
- L_denum = denum;
- div = 0;
- k = 15;
- /* The parameter num sometimes becomes zero.
- * Although this is explicitly guarded against in 4.2.5,
- * we assume that the result should then be zero as well.
- */
-
- if (num == 0)
- return 0;
-
- while (k--)
- {
- div <<= 1;
- L_num <<= 1;
-
- if (L_num >= L_denum)
- {
- L_num -= L_denum;
- div++;
- }
- }
-
- return div;
-}
-
-void
-Autocorrelation (word * s /* [0..159] IN/OUT */ ,
- longword * L_ACF /* [0..8] OUT */ )
/*
- * The goal is to compute the array L_ACF[k]. The signal s[i] must
- * be scaled in order to avoid an overflow situation.
- */
-{
- register int k, i;
-
- word temp;
- word smax;
- word scalauto, n;
- word *sp;
- word sl;
-
- /* Search for the maximum.
- */
- smax = 0;
- for (k = 0; k <= 159; k++)
- {
- temp = GSM_ABS (s[k]);
- if (temp > smax)
- smax = temp;
- }
-
- /* Computation of the scaling factor.
- */
- if (smax == 0)
- scalauto = 0;
- else
- scalauto = 4 - gsm_norm ((longword) smax << 16); /* sub(4,..) */
-
- if (scalauto > 0 && scalauto <= 4)
- {
- n = scalauto;
- for (k = 0; k <= 159; k++)
- s[k] = GSM_MULT_R (s[k], 16384 >> (n - 1));
- }
-
- /* Compute the L_ACF[..].
- */
- {
- sp = s;
- sl = *sp;
-
-#define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
-
-#define NEXTI sl = *++sp
- for (k = 8; k >= 0; k--)
- L_ACF[k] = 0;
-
- STEP (0);
- NEXTI;
- STEP (0);
- STEP (1);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- STEP (7);
-
- for (i = 8; i <= 159; i++)
- {
-
- NEXTI;
-
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- STEP (7);
- STEP (8);
- }
-
- for (k = 8; k >= 0; k--)
- L_ACF[k] <<= 1;
-
- }
- /* Rescaling of the array s[0..159]
- */
- if (scalauto > 0)
- for (k = 159; k >= 0; k--)
- *s++ <<= scalauto;
-}
-
-/* 4.2.5 */
-
-void
-Reflection_coefficients (longword * L_ACF /* 0...8 IN */ ,
- register word * r /* 0...7 OUT */ )
-{
- register int i, m, n;
- register word temp;
- word ACF[9]; /* 0..8 */
- word P[9]; /* 0..8 */
- word K[9]; /* 2..8 */
-
- /* Schur recursion with 16 bits arithmetic.
- */
-
- if (L_ACF[0] == 0)
- {
- for (i = 8; i > 0; i--)
- *r++ = 0;
- return;
- }
-
- temp = gsm_norm (L_ACF[0]);
- for (i = 0; i <= 8; i++)
- ACF[i] = SASR (L_ACF[i] << temp, 16);
-
- /* Initialize array P[..] and K[..] for the recursion.
- */
-
- for (i = 1; i <= 7; i++)
- K[i] = ACF[i];
- for (i = 0; i <= 8; i++)
- P[i] = ACF[i];
-
- /* Compute reflection coefficients
- */
- for (n = 1; n <= 8; n++, r++)
- {
-
- temp = P[1];
- temp = GSM_ABS (temp);
- if (P[0] < temp)
- {
- for (i = n; i <= 8; i++)
- *r++ = 0;
- return;
- }
-
- *r = gsm_div (temp, P[0]);
-
- if (P[1] > 0)
- *r = -*r; /* r[n] = sub(0, r[n]) */
- if (n == 8)
- return;
-
- /* Schur recursion
- */
- temp = GSM_MULT_R (P[1], *r);
- P[0] = GSM_ADD (P[0], temp);
-
- for (m = 1; m <= 8 - n; m++)
- {
- temp = GSM_MULT_R (K[m], *r);
- P[m] = GSM_ADD (P[m + 1], temp);
-
- temp = GSM_MULT_R (P[m + 1], *r);
- K[m] = GSM_ADD (K[m], temp);
- }
- }
-}
-
-/* 4.2.6 */
-
-void
-Transformation_to_Log_Area_Ratios (register word * r /* 0..7 IN/OUT */ )
-/*
- * The following scaling for r[..] and LAR[..] has been used:
- *
- * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
- * LAR[..] = integer( real_LAR[..] * 16384 );
- * with -1.625 <= real_LAR <= 1.625
- */
-{
- register word temp;
- register int i;
-
-
- /* Computation of the LAR[0..7] from the r[0..7]
- */
- for (i = 1; i <= 8; i++, r++)
- {
-
- temp = *r;
- temp = GSM_ABS (temp);
-
- if (temp < 22118)
- {
- temp >>= 1;
- }
- else if (temp < 31130)
- {
- temp -= 11059;
- }
- else
- {
- temp -= 26112;
- temp <<= 2;
- }
-
- *r = *r < 0 ? -temp : temp;
- }
-}
-
-/* 4.2.7 */
-
-void
-Quantization_and_coding (register word * LAR /* [0..7] IN/OUT */ )
-{
- register word temp;
-
-
- /* This procedure needs four tables; the following equations
- * give the optimum scaling for the constants:
- *
- * A[0..7] = integer( real_A[0..7] * 1024 )
- * B[0..7] = integer( real_B[0..7] * 512 )
- * MAC[0..7] = maximum of the LARc[0..7]
- * MIC[0..7] = minimum of the LARc[0..7]
- */
-
-# undef STEP
-# define STEP( A, B, MAC, MIC ) \
- temp = GSM_MULT( A, *LAR ); \
- temp = GSM_ADD( temp, B ); \
- temp = GSM_ADD( temp, 256 ); \
- temp = SASR( temp, 9 ); \
- *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
- LAR++;
-
- STEP (20480, 0, 31, -32);
- STEP (20480, 0, 31, -32);
- STEP (20480, 2048, 15, -16);
- STEP (20480, -2560, 15, -16);
-
- STEP (13964, 94, 7, -8);
- STEP (15360, -1792, 7, -8);
- STEP (8534, -341, 3, -4);
- STEP (9036, -1144, 3, -4);
-
-# undef STEP
-}
-
-void
-Gsm_LPC_Analysis (word * s /* 0..159 signals IN/OUT */ ,
- word * LARc /* 0..7 LARc's OUT */ )
-{
- longword L_ACF[9];
-
- Autocorrelation (s, L_ACF);
- Reflection_coefficients (L_ACF, LARc);
- Transformation_to_Log_Area_Ratios (LARc);
- Quantization_and_coding (LARc);
-}
-
++--------------------------------------------------------------------------+
+| * Test Vectors (added for CHStone) |
+| inData : input data |
+| outData, outLARc : expected output data |
++--------------------------------------------------------------------------+
+*/
#define N 160
#define M 8
-
-int
-main ()
-{
- const word inData[N] =
+const word inData[N] =
{ 81, 10854, 1893, -10291, 7614, 29718, 20475, -29215, -18949, -29806,
- -32017, 1596, 15744, -3088, -17413, -22123, 6798, -13276, 3819, -16273,
+ -32017, 1596, 15744, -3088, -17413, -22123, 6798, -13276, 3819, -16273,
-1573, -12523, -27103,
- -193, -25588, 4698, -30436, 15264, -1393, 11418, 11370, 4986, 7869, -1903,
+ -193, -25588, 4698, -30436, 15264, -1393, 11418, 11370, 4986, 7869, -1903,
9123, -31726,
- -25237, -14155, 17982, 32427, -12439, -15931, -21622, 7896, 1689, 28113,
+ -25237, -14155, 17982, 32427, -12439, -15931, -21622, 7896, 1689, 28113,
3615, 22131, -5572,
- -20110, 12387, 9177, -24544, 12480, 21546, -17842, -13645, 20277, 9987,
+ -20110, 12387, 9177, -24544, 12480, 21546, -17842, -13645, 20277, 9987,
17652, -11464, -17326,
- -10552, -27100, 207, 27612, 2517, 7167, -29734, -22441, 30039, -2368, 12813,
+ -10552, -27100, 207, 27612, 2517, 7167, -29734, -22441, 30039, -2368, 12813,
300, -25555, 9087,
- 29022, -6559, -20311, -14347, -7555, -21709, -3676, -30082, -3190, -30979,
+ 29022, -6559, -20311, -14347, -7555, -21709, -3676, -30082, -3190, -30979,
8580, 27126, 3414,
- -4603, -22303, -17143, 13788, -1096, -14617, 22071, -13552, 32646, 16689,
+ -4603, -22303, -17143, 13788, -1096, -14617, 22071, -13552, 32646, 16689,
-8473, -12733, 10503,
- 20745, 6696, -26842, -31015, 3792, -19864, -20431, -30307, 32421, -13237,
+ 20745, 6696, -26842, -31015, 3792, -19864, -20431, -30307, 32421, -13237,
9006, 18249, 2403,
- -7996, -14827, -5860, 7122, 29817, -31894, 17955, 28836, -31297, 31821,
+ -7996, -14827, -5860, 7122, 29817, -31894, 17955, 28836, -31297, 31821,
-27502, 12276, -5587,
- -22105, 9192, -22549, 15675, -12265, 7212, -23749, -12856, -5857, 7521,
+ -22105, 9192, -22549, 15675, -12265, 7212, -23749, -12856, -5857, 7521,
17349, 13773, -3091,
- -17812, -9655, 26667, 7902, 2487, 3177, 29412, -20224, -2776, 24084, -7963,
+ -17812, -9655, 26667, 7902, 2487, 3177, 29412, -20224, -2776, 24084, -7963,
-10438, -11938,
- -14833, -6658, 32058, 4020, 10461, 15159
- };
+ -14833, -6658, 32058, 4020, 10461, 15159
+};
- const word outData[N] =
+const word outData[N] =
{ 80, 10848, 1888, -10288, 7616, 29712, 20480, -29216, -18944, -29808,
- -32016, 1600, 15744, -3088, -17408, -22128, 6800, -13280, 3824, -16272,
+ -32016, 1600, 15744, -3088, -17408, -22128, 6800, -13280, 3824, -16272,
-1568, -12528, -27104,
- -192, -25584, 4704, -30432, 15264, -1392, 11424, 11376, 4992, 7872, -1904,
+ -192, -25584, 4704, -30432, 15264, -1392, 11424, 11376, 4992, 7872, -1904,
9120, -31728, -25232,
- -14160, 17984, 32432, -12432, -15936, -21616, 7904, 1696, 28112, 3616,
+ -14160, 17984, 32432, -12432, -15936, -21616, 7904, 1696, 28112, 3616,
22128, -5568, -20112,
- 12384, 9184, -24544, 12480, 21552, -17840, -13648, 20272, 9984, 17648,
+ 12384, 9184, -24544, 12480, 21552, -17840, -13648, 20272, 9984, 17648,
-11456, -17328, -10544,
- -27104, 208, 27616, 2512, 7168, -29728, -22448, 30032, -2368, 12816, 304,
+ -27104, 208, 27616, 2512, 7168, -29728, -22448, 30032, -2368, 12816, 304,
-25552, 9088, 29024,
- -6560, -20304, -14352, -7552, -21712, -3680, -30080, -3184, -30976, 8576,
+ -6560, -20304, -14352, -7552, -21712, -3680, -30080, -3184, -30976, 8576,
27120, 3408, -4608,
- -22304, -17136, 13792, -1088, -14624, 22064, -13552, 32640, 16688, -8480,
+ -22304, -17136, 13792, -1088, -14624, 22064, -13552, 32640, 16688, -8480,
-12736, 10496, 20752,
- 6704, -26848, -31008, 3792, -19856, -20432, -30304, 32416, -13232, 9008,
+ 6704, -26848, -31008, 3792, -19856, -20432, -30304, 32416, -13232, 9008,
18256, 2400, -8000,
- -14832, -5856, 7120, 29824, -31888, 17952, 28832, -31296, 31824, -27504,
+ -14832, -5856, 7120, 29824, -31888, 17952, 28832, -31296, 31824, -27504,
12272, -5584, -22112,
- 9200, -22544, 15680, -12272, 7216, -23744, -12848, -5856, 7520, 17344,
+ 9200, -22544, 15680, -12272, 7216, -23744, -12848, -5856, 7520, 17344,
13776, -3088, -17808,
- -9648, 26672, 7904, 2480, 3184, 29408, -20224, -2768, 24080, -7968, -10432,
+ -9648, 26672, 7904, 2480, 3184, 29408, -20224, -2768, 24080, -7968, -10432,
-11936, -14832,
- -6656, 32064, 4016, 10464, 15152
- };
+ -6656, 32064, 4016, 10464, 15152
+};
- const word outLARc[M] = { 32, 33, 22, 13, 7, 5, 3, 2 };
+const word outLARc[M] = { 32, 33, 22, 13, 7, 5, 3, 2 };
+
+int
+main ()
+{
int i;
int main_result;
word so[N];
word LARc[M];
- main_result = 0;
+ main_result = 0;
- for (i = 0; i < N; i++)
- so[i] = inData[i];
+ for (i = 0; i < N; i++)
+ so[i] = inData[i];
- Gsm_LPC_Analysis (so, LARc);
+ Gsm_LPC_Analysis (so, LARc);
- for (i = 0; i < N; i++)
- main_result += (so[i] != outData[i]);
- for (i = 0; i < M; i++)
- main_result += (LARc[i] != outLARc[i]);
+ for (i = 0; i < N; i++)
+ main_result += (so[i] != outData[i]);
+ for (i = 0; i < M; i++)
+ main_result += (LARc[i] != outLARc[i]);
- //printf ("%d\n", main_result);
- return main_result;
-}
+ printf ("%d\n", main_result);
+ return main_result;
+ }
diff --git a/benchmarks/CHStone/gsm2/gsm.c b/benchmarks/CHStone/gsm2/gsm.c
deleted file mode 100755
index 4e1c2d1..0000000
--- a/benchmarks/CHStone/gsm2/gsm.c
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
-+--------------------------------------------------------------------------+
-| CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
-| ======================================================================== |
-| |
-| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
-| H. Takada and K. Ishii |
-| Nagoya University, Japan |
-| |
-| * Remark : |
-| 1. This source code is modified to unify the formats of the benchmark |
-| programs in CHStone. |
-| 2. Test vectors are added for CHStone. |
-| 3. If "main_result" is 0 at the end of the program, the program is |
-| correctly executed. |
-| 4. Please follow the copyright of each benchmark program. |
-+--------------------------------------------------------------------------+
-*/
-//#include <stdio.h>
-typedef int word; /* 16 bit signed int */
-typedef long longword; /* 32 bit signed int */
-
-#define MIN_WORD ((-32767)-1)
-#define MAX_WORD ( 32767)
-
-#define SASR(x, by) ((x) >> (by))
-
-#define GSM_MULT_R(a, b) gsm_mult_r(a, b)
-#define GSM_MULT(a, b) gsm_mult(a, b)
-#define GSM_ADD(a, b) gsm_add(a, b)
-#define GSM_ABS(a) gsm_abs(a)
-
-#define saturate(x) \
- ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
-
-word
-gsm_add (word a, word b)
-{
- longword sum;
- sum = (longword) a + (longword) b;
- return saturate (sum);
-}
-
-word
-gsm_mult (word a, word b)
-{
- if (a == MIN_WORD && b == MIN_WORD)
- return MAX_WORD;
- else
- return SASR ((longword) a * (longword) b, 15);
-}
-
-word
-gsm_mult_r (word a, word b)
-{
- longword prod;
- if (b == MIN_WORD && a == MIN_WORD)
- return MAX_WORD;
- else
- {
- prod = (longword) a *(longword) b + 16384;
- prod >>= 15;
- return prod & 0xFFFF;
- }
-}
-
-word
-gsm_abs (word a)
-{
- return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
-}
-
-word
-gsm_norm (longword a)
-/*
- * the number of left shifts needed to normalize the 32 bit
- * variable L_var1 for positive values on the interval
- *
- * with minimum of
- * minimum of 1073741824 (01000000000000000000000000000000) and
- * maximum of 2147483647 (01111111111111111111111111111111)
- *
- *
- * and for negative values on the interval with
- * minimum of -2147483648 (-10000000000000000000000000000000) and
- * maximum of -1073741824 ( -1000000000000000000000000000000).
- *
- * in order to normalize the result, the following
- * operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
- *
- * (That's 'ffs', only from the left, not the right..)
- */
-{
- const unsigned int bitoff[256] = {
- 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
- if (a < 0)
- {
- if (a <= -1073741824)
- return 0;
- a = ~a;
- }
-
- return a & 0xffff0000 ?
- (a & 0xff000000 ? -1 + bitoff[0xFF & (a >> 24)] :
- 7 + bitoff[0xFF & (a >> 16)])
- : (a & 0xff00 ? 15 + bitoff[0xFF & (a >> 8)] : 23 + bitoff[0xFF & a]);
-}
-
-word
-gsm_div (word num, word denum)
-{
- longword L_num;
- longword L_denum;
- word div;
- int k;
-
- L_num = num;
- L_denum = denum;
- div = 0;
- k = 15;
- /* The parameter num sometimes becomes zero.
- * Although this is explicitly guarded against in 4.2.5,
- * we assume that the result should then be zero as well.
- */
-
- if (num == 0)
- return 0;
-
- while (k--)
- {
- div <<= 1;
- L_num <<= 1;
-
- if (L_num >= L_denum)
- {
- L_num -= L_denum;
- div++;
- }
- }
-
- return div;
-}
-
-void
-Autocorrelation (word * s /* [0..159] IN/OUT */ ,
- longword * L_ACF /* [0..8] OUT */ )
-/*
- * The goal is to compute the array L_ACF[k]. The signal s[i] must
- * be scaled in order to avoid an overflow situation.
- */
-{
- register int k, i;
-
- word temp;
- word smax;
- word scalauto, n;
- word *sp;
- word sl;
-
- /* Search for the maximum.
- */
- smax = 0;
- for (k = 0; k <= 159; k++)
- {
- temp = GSM_ABS (s[k]);
- if (temp > smax)
- smax = temp;
- }
-
- /* Computation of the scaling factor.
- */
- if (smax == 0)
- scalauto = 0;
- else
- scalauto = 4 - gsm_norm ((longword) smax << 16); /* sub(4,..) */
-
- if (scalauto > 0 && scalauto <= 4)
- {
- n = scalauto;
- for (k = 0; k <= 159; k++)
- s[k] = GSM_MULT_R (s[k], 16384 >> (n - 1));
- }
-
- /* Compute the L_ACF[..].
- */
- {
- sp = s;
- sl = *sp;
-
-#define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
-
-#define NEXTI sl = *++sp
- for (k = 8; k >= 0; k--)
- L_ACF[k] = 0;
-
-int mask[36] = {
-0,
-0,1,
-0,1,2,
-0,1,2,3,
-0,1,2,3,4,
-0,1,2,3,4,5,
-0,1,2,3,4,5,6,
-0,1,2,3,4,5,6,7
-};
-int i;
-int j;
-for(i=1; i < 8; i++){
- for(j=0;j<i;j++){
- STEP (j);
- }
- NEXTI;
-}
- /*
- STEP (0);
- NEXTI;
- STEP (0);
- STEP (1);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- NEXTI;
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- STEP (7);
-*/
- for (i = 8; i <= 159; i++)
- {
-
- NEXTI;
- for(j=0;j<9;j++) STEP(j);
- /*
- STEP (0);
- STEP (1);
- STEP (2);
- STEP (3);
- STEP (4);
- STEP (5);
- STEP (6);
- STEP (7);
- STEP (8);
- */
- }
-
- for (k = 8; k >= 0; k--)
- L_ACF[k] <<= 1;
-
- }
- /* Rescaling of the array s[0..159]
- */
- if (scalauto > 0)
- for (k = 159; k >= 0; k--)
- *s++ <<= scalauto;
-}
-
-/* 4.2.5 */
-
-void
-Reflection_coefficients (longword * L_ACF /* 0...8 IN */ ,
- register word * r /* 0...7 OUT */ )
-{
- register int i, m, n;
- register word temp;
- word ACF[9]; /* 0..8 */
- word P[9]; /* 0..8 */
- word K[9]; /* 2..8 */
-
- /* Schur recursion with 16 bits arithmetic.
- */
-
- if (L_ACF[0] == 0)
- {
- for (i = 8; i > 0; i--)
- *r++ = 0;
- return;
- }
-
- temp = gsm_norm (L_ACF[0]);
- for (i = 0; i <= 8; i++)
- ACF[i] = SASR (L_ACF[i] << temp, 16);
-
- /* Initialize array P[..] and K[..] for the recursion.
- */
-
- for (i = 1; i <= 7; i++)
- K[i] = ACF[i];
- for (i = 0; i <= 8; i++)
- P[i] = ACF[i];
-
- /* Compute reflection coefficients
- */
- for (n = 1; n <= 8; n++, r++)
- {
-
- temp = P[1];
- temp = GSM_ABS (temp);
- if (P[0] < temp)
- {
- for (i = n; i <= 8; i++)
- *r++ = 0;
- return;
- }
-
- *r = gsm_div (temp, P[0]);
-
- if (P[1] > 0)
- *r = -*r; /* r[n] = sub(0, r[n]) */
- if (n == 8)
- return;
-
- /* Schur recursion
- */
- temp = GSM_MULT_R (P[1], *r);
- P[0] = GSM_ADD (P[0], temp);
-
- for (m = 1; m <= 8 - n; m++)
- {
- temp = GSM_MULT_R (K[m], *r);
- P[m] = GSM_ADD (P[m + 1], temp);
-
- temp = GSM_MULT_R (P[m + 1], *r);
- K[m] = GSM_ADD (K[m], temp);
- }
- }
-}
-
-/* 4.2.6 */
-
-void
-Transformation_to_Log_Area_Ratios (register word * r /* 0..7 IN/OUT */ )
-/*
- * The following scaling for r[..] and LAR[..] has been used:
- *
- * r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
- * LAR[..] = integer( real_LAR[..] * 16384 );
- * with -1.625 <= real_LAR <= 1.625
- */
-{
- register word temp;
- register int i;
-
-
- /* Computation of the LAR[0..7] from the r[0..7]
- */
- for (i = 1; i <= 8; i++, r++)
- {
-
- temp = *r;
- temp = GSM_ABS (temp);
-
- if (temp < 22118)
- {
- temp >>= 1;
- }
- else if (temp < 31130)
- {
- temp -= 11059;
- }
- else
- {
- temp -= 26112;
- temp <<= 2;
- }
-
- *r = *r < 0 ? -temp : temp;
- }
-}
-
-/* 4.2.7 */
-
-void
-Quantization_and_coding (register word * LAR /* [0..7] IN/OUT */ )
-{
- register word temp;
-
-
- /* This procedure needs four tables; the following equations
- * give the optimum scaling for the constants:
- *
- * A[0..7] = integer( real_A[0..7] * 1024 )
- * B[0..7] = integer( real_B[0..7] * 512 )
- * MAC[0..7] = maximum of the LARc[0..7]
- * MIC[0..7] = minimum of the LARc[0..7]
- */
-
-# undef STEP
-# define STEP( A, B, MAC, MIC ) \
- temp = GSM_MULT( A, *LAR ); \
- temp = GSM_ADD( temp, B ); \
- temp = GSM_ADD( temp, 256 ); \
- temp = SASR( temp, 9 ); \
- *LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
- LAR++;
-
-int in1[8] = {20480,20480,20480,20480,13964,15360,8534,9036};
-int in2[8] = {0,0,2048,-2560,94,-1792,-341,-1144};
-int in3[8] = {31,31,15,15,7,7,3,3};
-int in4[8] = {-32,-32,-16,-16,8,-8,-4,-4};
-int k=0;
-for(k=0; k<8; k++)
- STEP(in1[k],in2[k],in3[k],in4[k]);
- /*
- STEP (20480, 0, 31, -32);
- STEP (20480, 0, 31, -32);
- STEP (20480, 2048, 15, -16);
- STEP (20480, -2560, 15, -16);
- STEP (13964, 94, 7, -8);
- STEP (15360, -1792, 7, -8);
- STEP (8534, -341, 3, -4);
- STEP (9036, -1144, 3, -4);
- */
-# undef STEP
-}
-
-void
-Gsm_LPC_Analysis (word * s /* 0..159 signals IN/OUT */ ,
- word * LARc /* 0..7 LARc's OUT */ )
-{
- longword L_ACF[9];
-
- Autocorrelation (s, L_ACF);
- Reflection_coefficients (L_ACF, LARc);
- Transformation_to_Log_Area_Ratios (LARc);
- Quantization_and_coding (LARc);
-}
-
-#define N 160
-#define M 8
-
-int
-main ()
-{
-
- /* here, do your time-consuming job */
-
- const word inData[N] =
- { 81, 10854, 1893, -10291, 7614, 29718, 20475, -29215, -18949, -29806,
- -32017, 1596, 15744, -3088, -17413, -22123, 6798, -13276, 3819, -16273,
- -1573, -12523, -27103,
- -193, -25588, 4698, -30436, 15264, -1393, 11418, 11370, 4986, 7869, -1903,
- 9123, -31726,
- -25237, -14155, 17982, 32427, -12439, -15931, -21622, 7896, 1689, 28113,
- 3615, 22131, -5572,
- -20110, 12387, 9177, -24544, 12480, 21546, -17842, -13645, 20277, 9987,
- 17652, -11464, -17326,
- -10552, -27100, 207, 27612, 2517, 7167, -29734, -22441, 30039, -2368, 12813,
- 300, -25555, 9087,
- 29022, -6559, -20311, -14347, -7555, -21709, -3676, -30082, -3190, -30979,
- 8580, 27126, 3414,
- -4603, -22303, -17143, 13788, -1096, -14617, 22071, -13552, 32646, 16689,
- -8473, -12733, 10503,
- 20745, 6696, -26842, -31015, 3792, -19864, -20431, -30307, 32421, -13237,
- 9006, 18249, 2403,
- -7996, -14827, -5860, 7122, 29817, -31894, 17955, 28836, -31297, 31821,
- -27502, 12276, -5587,
- -22105, 9192, -22549, 15675, -12265, 7212, -23749, -12856, -5857, 7521,
- 17349, 13773, -3091,
- -17812, -9655, 26667, 7902, 2487, 3177, 29412, -20224, -2776, 24084, -7963,
- -10438, -11938,
- -14833, -6658, 32058, 4020, 10461, 15159
- };
-
- const word outData[N] =
- { 80, 10848, 1888, -10288, 7616, 29712, 20480, -29216, -18944, -29808,
- -32016, 1600, 15744, -3088, -17408, -22128, 6800, -13280, 3824, -16272,
- -1568, -12528, -27104,
- -192, -25584, 4704, -30432, 15264, -1392, 11424, 11376, 4992, 7872, -1904,
- 9120, -31728, -25232,
- -14160, 17984, 32432, -12432, -15936, -21616, 7904, 1696, 28112, 3616,
- 22128, -5568, -20112,
- 12384, 9184, -24544, 12480, 21552, -17840, -13648, 20272, 9984, 17648,
- -11456, -17328, -10544,
- -27104, 208, 27616, 2512, 7168, -29728, -22448, 30032, -2368, 12816, 304,
- -25552, 9088, 29024,
- -6560, -20304, -14352, -7552, -21712, -3680, -30080, -3184, -30976, 8576,
- 27120, 3408, -4608,
- -22304, -17136, 13792, -1088, -14624, 22064, -13552, 32640, 16688, -8480,
- -12736, 10496, 20752,
- 6704, -26848, -31008, 3792, -19856, -20432, -30304, 32416, -13232, 9008,
- 18256, 2400, -8000,
- -14832, -5856, 7120, 29824, -31888, 17952, 28832, -31296, 31824, -27504,
- 12272, -5584, -22112,
- 9200, -22544, 15680, -12272, 7216, -23744, -12848, -5856, 7520, 17344,
- 13776, -3088, -17808,
- -9648, 26672, 7904, 2480, 3184, 29408, -20224, -2768, 24080, -7968, -10432,
- -11936, -14832,
- -6656, 32064, 4016, 10464, 15152
- };
-
- const word outLARc[M] = { 32, 33, 22, 13, 7, 5, 3, 2 };
-
- int i;
- int main_result;
- word so[N];
- word LARc[M];
- main_result = 0;
-
- for (i = 0; i < N; i++)
- so[i] = inData[i];
-
- Gsm_LPC_Analysis (so, LARc);
-
- for (i = 0; i < N; i++)
- main_result += (so[i] != outData[i]);
- for (i = 0; i < M; i++)
- main_result += (LARc[i] != outLARc[i]);
-
- return main_result;
-}
diff --git a/benchmarks/CHStone/mips/mips.c b/benchmarks/CHStone/mips/mips.c
index 9482a5e..09591fe 100755
--- a/benchmarks/CHStone/mips/mips.c
+++ b/benchmarks/CHStone/mips/mips.c
@@ -34,43 +34,9 @@
* agents, transferees, successors, and assigns.
*
*/
+#include <stdio.h>
+int main_result;
-/*
-+--------------------------------------------------------------------------+
-| CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
-| ======================================================================== |
-| |
-| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
-| H. Takada and K. Ishii |
-| Nagoya University, Japan |
-| |
-| * Remark : |
-| 1. This source code is modified to unify the formats of the benchmark |
-| programs in CHStone. |
-| 2. Test vectors are added for CHStone. |
-| 3. If "main_result" is 0 at the end of the program, the program is |
-| correctly executed. |
-| 4. Please follow the copyright of each benchmark program. |
-+--------------------------------------------------------------------------+
-*/
-/*
- * Copyright (C) 2008
- * Y. Hara, H. Tomiyama, S. Honda, H. Takada and K. Ishii
- * Nagoya University, Japan
- * All rights reserved.
- *
- * Disclaimer of Warranty
- *
- * These software programs are available to the user without any license fee or
- * royalty on an "as is" basis. The authors disclaims any and all warranties,
- * whether express, implied, or statuary, including any implied warranties or
- * merchantability or of fitness for a particular purpose. In no event shall the
- * copyright-holder be liable for any incidental, punitive, or consequential damages
- * of any kind whatsoever arising from the use of these programs. This disclaimer
- * of warranty extends to the user of these programs and user's customers, employees,
- * agents, transferees, successors, and assigns.
- *
- */
#define R 0
#define ADDU 33
@@ -114,6 +80,7 @@
#define SLTI 10
#define SLTIU 11
+#include "imem.h"
/*
+--------------------------------------------------------------------------+
| * Test Vectors (added for CHStone) |
@@ -121,65 +88,16 @@
| outData : expected output data |
+--------------------------------------------------------------------------+
*/
+const int A[8] = { 22, 5, -9, 3, -17, 38, 0, 11 };
+const int outData[8] = { -17, -9, 0, 3, 5, 11, 22, 38 };
+
#define IADDR(x) (((x)&0x000000ff)>>2)
#define DADDR(x) (((x)&0x000000ff)>>2)
int
main ()
{
- const unsigned int imem[44] = {
- 0x8fa40000, // [0x00400000] lw $4, 0($29) ; 175: lw $a0 0($sp) # argc
- 0x27a50004, // [0x00400004] addiu $5, $29, 4 ; 176: addiu $a1 $sp 4 # argv
- 0x24a60004, // [0x00400008] addiu $6, $5, 4 ; 177: addiu $a2 $a1 4 # envp
- 0x00041080, // [0x0040000c] sll $2, $4, 2 ; 178: sll $v0 $a0 2
- 0x00c23021, // [0x00400010] addu $6, $6, $2 ; 179: addu $a2 $a2 $v0
- 0x0c100016, // [0x00400014] jal 0x00400058 [main] ; 180: jal main
- 0x00000000, // [0x00400018] nop ; 181: nop
- 0x3402000a, // [0x0040001c] ori $2, $0, 10 ; 183: li $v0 10
- 0x0000000c, // [0x00400020] syscall ; 184: syscall # syscall 10 (exit)
- 0x3c011001, // [0x00400024] lui $1, 4097 [A] ; 4: la $t0,A ; C&S
- 0x34280000, // [0x00400028] ori $8, $1, 0 [A]
- 0x00044880, // [0x0040002c] sll $9, $4, 2 ; 5: sll $t1,$a0,2
- 0x01094821, // [0x00400030] addu $9, $8, $9 ; 6: addu $t1,$t0,$t1
- 0x8d2a0000, // [0x00400034] lw $10, 0($9) ; 7: lw $t2,($t1)
- 0x00055880, // [0x00400038] sll $11, $5, 2 ; 8: sll $t3,$a1,2
- 0x010b5821, // [0x0040003c] addu $11, $8, $11 ; 9: addu $t3,$t0,$t3
- 0x8d6c0000, // [0x00400040] lw $12, 0($11) ; 10: lw $t4,($t3)
- 0x018a682a, // [0x00400044] slt $13, $12, $10 ; 11: slt $t5,$t4,$t2
- 0x11a00003, // [0x00400048] beq $13, $0, 12 [L1-0x00400048] ; 12: beq $t5,$zero,L1
- 0xad2c0000, // [0x0040004c] sw $12, 0($9) ; 13: sw $t4,($t1)
- 0xad6a0000, // [0x00400050] sw $10, 0($11) ; 14: sw $t2,($t3)
- 0x03e00008, // [0x00400054] jr $31 ; 15: jr $ra ; L1
- 0x27bdfff4, // [0x00400058] addiu $29, $29, -12 ; 17: addiu $sp,$sp,-12 ; main
- 0xafbf0008, // [0x0040005c] sw $31, 8($29) ; 18: sw $ra,8($sp)
- 0xafb10004, // [0x00400060] sw $17, 4($29) ; 19: sw $s1,4($sp)
- 0xafb00000, // [0x00400064] sw $16, 0($29) ; 20: sw $s0,0($sp)
- 0x24100000, // [0x00400068] addiu $16, $0, 0 ; 21: addiu $s0,$zero,0
- 0x2a080008, // [0x0040006c] slti $8, $16, 8 ; 22: slti $t0,$s0,8 ; L5
- 0x1100000b, // [0x00400070] beq $8, $0, 44 [L2-0x00400070] ; 23: beq $t0,$zero,L2
- 0x26110001, // [0x00400074] addiu $17, $16, 1 ; 24: addiu $s1,$s0,1
- 0x2a280008, // [0x00400078] slti $8, $17, 8 ; 25: slti $t0,$s1,8 ; L4
- 0x11000006, // [0x0040007c] beq $8, $0, 24 [L3-0x0040007c] ; 26: beq $t0,$zero,L3
- 0x26040000, // [0x00400080] addiu $4, $16, 0 ; 27: addiu $a0,$s0,0
- 0x26250000, // [0x00400084] addiu $5, $17, 0 ; 28: addiu $a1,$s1,0
- 0x0c100009, // [0x00400088] jal 0x00400024 [compare_swap] ; 29: jal compare_swap
- 0x26310001, // [0x0040008c] addiu $17, $17, 1 ; 30: addiu $s1,$s1,1
- 0x0810001e, // [0x00400090] j 0x00400078 [L4] ; 31: j L4
- 0x26100001, // [0x00400094] addiu $16, $16, 1 ; 32: addiu $s0,$s0,1 ; L3
- 0x0810001b, // [0x00400098] j 0x0040006c [L5] ; 33: j L5
- 0x8fbf0008, // [0x0040009c] lw $31, 8($29) ; 34: lw $ra,8($sp) ; L2
- 0x8fb10004, // [0x004000a0] lw $17, 4($29) ; 35: lw $s1,4($sp)
- 0x8fb00000, // [0x004000a4] lw $16, 0($29) ; 36: lw $s0,0($sp)
- 0x27bd000c, // [0x004000a8] addiu $29, $29, 12 ; 37: addiu $sp,$sp,12
- 0x03e00008, // [0x004000ac] jr $31 ; 38: jr $ra
- };
-
- const int A[8] = { 22, 5, -9, 3, -17, 38, 0, 11 };
- const int outData[8] = { -17, -9, 0, 3, 5, 11, 22, 38 };
-
- int main_result;
-
- int hilo;
+ long long hilo;
int reg[32];
int Hi = 0;
int Lo = 0;
@@ -194,194 +112,195 @@ main ()
int rd;
int shamt;
int funct;
- int address;
+ short address;
int tgtadr;
- while (1)
- {
- int i;
- int n_inst;
-
- n_inst = 0;
- main_result = 0;
-
- for (i = 0; i < 32; i++)
- {
- reg[i] = 0;
- }
- reg[29] = 0x7fffeffc;
-
- for (i = 0; i < 8; i++)
- {
- dmem[i] = A[i];
- }
-
- pc = 0x00400000;
-
- do
- {
- ins = imem[IADDR (pc)];
- pc = pc + 4;
-
- op = ins >> 26;
-
- switch (op)
- {
- case R:
- funct = ins & 0x3f;
- shamt = (ins >> 6) & 0x1f;
- rd = (ins >> 11) & 0x1f;
- rt = (ins >> 16) & 0x1f;
- rs = (ins >> 21) & 0x1f;
-
- switch (funct)
- {
-
- case ADDU:
- reg[rd] = reg[rs] + reg[rt];
- break;
- case SUBU:
- reg[rd] = reg[rs] - reg[rt];
- break;
- /*
- case MULT:
- hilo = (long long) reg[rs] * (long long) reg[rt];
- Lo = hilo & 0x00000000ffffffffULL;
- Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
- break;
- case MULTU:
- hilo =
- (unsigned long long) ((unsigned int) (reg[rs])) *
- (unsigned long long) ((unsigned int) (reg[rt]));
- Lo = hilo & 0x00000000ffffffffULL;
- Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
- break;
- */
- case MFHI:
- reg[rd] = Hi;
- break;
- case MFLO:
- reg[rd] = Lo;
- break;
-
- case AND:
- reg[rd] = reg[rs] & reg[rt];
- break;
- case OR:
- reg[rd] = reg[rs] | reg[rt];
- break;
- case XOR:
- reg[rd] = reg[rs] ^ reg[rt];
- break;
- case SLL:
- reg[rd] = reg[rt] << shamt;
- break;
- case SRL:
- reg[rd] = reg[rt] >> shamt;
- break;
- case SLLV:
- reg[rd] = reg[rt] << reg[rs];
- break;
- case SRLV:
- reg[rd] = reg[rt] >> reg[rs];
- break;
-
- case SLT:
- reg[rd] = reg[rs] < reg[rt];
- break;
- case SLTU:
- reg[rd] = (unsigned int) reg[rs] < (unsigned int) reg[rt];
- break;
-
- case JR:
- pc = reg[rs];
- break;
- default:
- pc = 0; // error
- break;
- }
- break;
-
- case J:
- tgtadr = ins & 0x3ffffff;
- pc = tgtadr << 2;
- break;
- case JAL:
- tgtadr = ins & 0x3ffffff;
- reg[31] = pc;
- pc = tgtadr << 2;
- break;
-
- default:
-
- address = ins & 0xffff;
- rt = (ins >> 16) & 0x1f;
- rs = (ins >> 21) & 0x1f;
- switch (op)
- {
- case ADDIU:
- reg[rt] = reg[rs] + address;
- break;
-
- case ANDI:
- reg[rt] = reg[rs] & (unsigned ) address;
- break;
- case ORI:
- reg[rt] = reg[rs] | (unsigned ) address;
- break;
- case XORI:
- reg[rt] = reg[rs] ^ (unsigned ) address;
- break;
-
- case LW:
- reg[rt] = dmem[DADDR (reg[rs] + address)];
- break;
- case SW:
- dmem[DADDR (reg[rs] + address)] = reg[rt];
- break;
-
- case LUI:
- reg[rt] = address << 16;
- break;
-
- case BEQ:
- if (reg[rs] == reg[rt])
- pc = pc - 4 + (address << 2);
- break;
- case BNE:
- if (reg[rs] != reg[rt])
- pc = pc - 4 + (address << 2);
- break;
- case BGEZ:
- if (reg[rs] >= 0)
- pc = pc - 4 + (address << 2);
- break;
-
- case SLTI:
- reg[rt] = reg[rs] < address;
- break;
-
- case SLTIU:
- reg[rt] = (unsigned int) reg[rs] < (unsigned int) address;
- break;
-
- default:
- pc = 0; /* error */
- break;
- }
- break;
- }
- reg[0] = 0;
- n_inst = n_inst + 1;
- }
- while (pc != 0);
-
- main_result += (n_inst != 611);
- for (j = 0; j < 8; j++)
+ while (1)
{
- main_result += (dmem[j] == outData[j]);
+ int i;
+ int n_inst;
+
+ n_inst = 0;
+ main_result = 0;
+
+ for (i = 0; i < 32; i++)
+ {
+ reg[i] = 0;
+ }
+ reg[29] = 0x7fffeffc;
+
+ for (i = 0; i < 64; i++)
+ {
+ dmem[i] = A[i];
+ }
+
+ pc = 0x00400000;
+
+ do
+ {
+ ins = imem[IADDR (pc)];
+ pc = pc + 4;
+
+ op = ins >> 26;
+
+ switch (op)
+ {
+ case R:
+ funct = ins & 0x3f;
+ shamt = (ins >> 6) & 0x1f;
+ rd = (ins >> 11) & 0x1f;
+ rt = (ins >> 16) & 0x1f;
+ rs = (ins >> 21) & 0x1f;
+
+ switch (funct)
+ {
+
+ case ADDU:
+ reg[rd] = reg[rs] + reg[rt];
+ break;
+ case SUBU:
+ reg[rd] = reg[rs] - reg[rt];
+ break;
+
+ case MULT:
+ hilo = (long long) reg[rs] * (long long) reg[rt];
+ Lo = hilo & 0x00000000ffffffffULL;
+ Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
+ break;
+ case MULTU:
+ hilo =
+ (unsigned long long) ((unsigned int) (reg[rs])) *
+ (unsigned long long) ((unsigned int) (reg[rt]));
+ Lo = hilo & 0x00000000ffffffffULL;
+ Hi = ((int) (hilo >> 32)) & 0xffffffffUL;
+ break;
+
+ case MFHI:
+ reg[rd] = Hi;
+ break;
+ case MFLO:
+ reg[rd] = Lo;
+ break;
+
+ case AND:
+ reg[rd] = reg[rs] & reg[rt];
+ break;
+ case OR:
+ reg[rd] = reg[rs] | reg[rt];
+ break;
+ case XOR:
+ reg[rd] = reg[rs] ^ reg[rt];
+ break;
+ case SLL:
+ reg[rd] = reg[rt] << shamt;
+ break;
+ case SRL:
+ reg[rd] = reg[rt] >> shamt;
+ break;
+ case SLLV:
+ reg[rd] = reg[rt] << reg[rs];
+ break;
+ case SRLV:
+ reg[rd] = reg[rt] >> reg[rs];
+ break;
+
+ case SLT:
+ reg[rd] = reg[rs] < reg[rt];
+ break;
+ case SLTU:
+ reg[rd] = (unsigned int) reg[rs] < (unsigned int) reg[rt];
+ break;
+
+ case JR:
+ pc = reg[rs];
+ break;
+ default:
+ pc = 0; // error
+ break;
+ }
+ break;
+
+ case J:
+ tgtadr = ins & 0x3ffffff;
+ pc = tgtadr << 2;
+ break;
+ case JAL:
+ tgtadr = ins & 0x3ffffff;
+ reg[31] = pc;
+ pc = tgtadr << 2;
+ break;
+
+ default:
+
+ address = ins & 0xffff;
+ rt = (ins >> 16) & 0x1f;
+ rs = (ins >> 21) & 0x1f;
+ switch (op)
+ {
+ case ADDIU:
+ reg[rt] = reg[rs] + address;
+ break;
+
+ case ANDI:
+ reg[rt] = reg[rs] & (unsigned short) address;
+ break;
+ case ORI:
+ reg[rt] = reg[rs] | (unsigned short) address;
+ break;
+ case XORI:
+ reg[rt] = reg[rs] ^ (unsigned short) address;
+ break;
+
+ case LW:
+ reg[rt] = dmem[DADDR (reg[rs] + address)];
+ break;
+ case SW:
+ dmem[DADDR (reg[rs] + address)] = reg[rt];
+ break;
+
+ case LUI:
+ reg[rt] = address << 16;
+ break;
+
+ case BEQ:
+ if (reg[rs] == reg[rt])
+ pc = pc - 4 + (address << 2);
+ break;
+ case BNE:
+ if (reg[rs] != reg[rt])
+ pc = pc - 4 + (address << 2);
+ break;
+ case BGEZ:
+ if (reg[rs] >= 0)
+ pc = pc - 4 + (address << 2);
+ break;
+
+ case SLTI:
+ reg[rt] = reg[rs] < address;
+ break;
+
+ case SLTIU:
+ reg[rt] = (unsigned int) reg[rs] < (unsigned short) address;
+ break;
+
+ default:
+ pc = 0; /* error */
+ break;
+ }
+ break;
+ }
+ reg[0] = 0;
+ n_inst = n_inst + 1;
+ }
+ while (pc != 0);
+
+ main_result += (n_inst != 611);
+ for (j = 0; j < 8; j++)
+ {
+ main_result += (dmem[j] != outData[j]);
+ }
+
+ printf ("%d\n", main_result);
+ return main_result;
}
-
- return main_result;
- }
}
diff --git a/benchmarks/CHStone/sha/sha_coqup.c b/benchmarks/CHStone/sha/sha_coqup.c
deleted file mode 100755
index 3c4d7c8..0000000
--- a/benchmarks/CHStone/sha/sha_coqup.c
+++ /dev/null
@@ -1,1353 +0,0 @@
-/*
-+--------------------------------------------------------------------------+
-| CHStone : a suite of benchmark programs for C-based High-Level Synthesis |
-| ======================================================================== |
-| |
-| * Collected and Modified : Y. Hara, H. Tomiyama, S. Honda, |
-| H. Takada and K. Ishii |
-| Nagoya University, Japan |
-| |
-| * Remark : |
-| 1. This source code is modified to unify the formats of the benchmark |
-| programs in CHStone. |
-| 2. Test vectors are added for CHStone. |
-| 3. If "main_result" is 0 at the end of the program, the program is |
-| correctly executed. |
-| 4. Please follow the copyright of each benchmark program. |
-+--------------------------------------------------------------------------+
-*/
-/* NIST Secure Hash Algorithm */
-/* heavily modified by Uwe Hollerbach uh@alumni.caltech edu */
-/* from Peter C. Gutmann's implementation as found in */
-/* Applied Cryptography by Bruce Schneier */
-
-/* NIST's proposed modification to SHA of 7/11/94 may be */
-/* activated by defining USE_MODIFIED_SHA */
-
-/* NIST Secure Hash Algorithm */
-/* heavily modified from Peter C. Gutmann's implementation */
-
-/* Useful defines & typedefs */
-
-typedef unsigned int BYTE;
-typedef unsigned int INT32;
-
-#define SHA_BLOCKSIZE 64
-
-void sha_init (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi);
-void sha_update (const BYTE *, int, INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16]);
-void sha_final (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16]);
-
-void sha_stream (INT32 sha_info_digest[5]);
-void sha_print ();
-
-#define BLOCK_SIZE 8192
-#define VSIZE 2
-
-/*
-+--------------------------------------------------------------------------+
-| * Test Vectors (added for CHStone) |
-| indata, in_i : input data |
-+--------------------------------------------------------------------------+
-*/
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-void
-local_memset (INT32 * s, int c, int n, int e)
-{
- INT32 uc;
- INT32 *p;
- int m;
-
- m = n >> 2;
- uc = c;
- p = (INT32 *) s;
- while (e-- > 0)
- {
- p++;
- }
- while (m-- > 0)
- {
- *p++ = uc;
- }
-}
-
-void
-local_memcpy (INT32 * s1, const BYTE * s2, int n)
-{
- INT32 *p1;
- BYTE *p2;
- INT32 tmp;
- int m;
- m = n >> 2;
- p1 = (INT32 *) s1;
- p2 = (BYTE *) s2;
-
- while (m-- > 0)
- {
- tmp = 0;
- tmp |= 0xFF & *p2++;
- tmp |= (0xFF & *p2++) << 8;
- tmp |= (0xFF & *p2++) << 16;
- tmp |= (0xFF & *p2++) << 24;
- *p1 = tmp;
- p1++;
- }
-}
-
-/* do SHA transformation */
-
-static void
-sha_transform (INT32 sha_info_digest[5], INT32 sha_info_data[16])
-{
- int i;
- INT32 temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i)
- {
- W[i] = sha_info_data[i];
- }
- for (i = 16; i < 80; ++i)
- {
- W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
- }
- A = sha_info_digest[0];
- B = sha_info_digest[1];
- C = sha_info_digest[2];
- D = sha_info_digest[3];
- E = sha_info_digest[4];
-
- for (i = 0; i < 20; ++i)
- {
- FUNC (1, i);
- }
- for (i = 20; i < 40; ++i)
- {
- FUNC (2, i);
- }
- for (i = 40; i < 60; ++i)
- {
- FUNC (3, i);
- }
- for (i = 60; i < 80; ++i)
- {
- FUNC (4, i);
- }
-
- sha_info_digest[0] += A;
- sha_info_digest[1] += B;
- sha_info_digest[2] += C;
- sha_info_digest[3] += D;
- sha_info_digest[4] += E;
-}
-
-/* initialize the SHA digest */
-
-void
-sha_init (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi)
-{
- sha_info_digest[0] = 0x67452301L;
- sha_info_digest[1] = 0xefcdab89L;
- sha_info_digest[2] = 0x98badcfeL;
- sha_info_digest[3] = 0x10325476L;
- sha_info_digest[4] = 0xc3d2e1f0L;
- *sha_info_count_lo = 0L;
- *sha_info_count_hi = 0L;
-}
-
-/* update the SHA digest */
-
-void
-sha_update (const BYTE * buffer, int count, INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16])
-{
- if ((*sha_info_count_lo + ((INT32) count << 3)) < *sha_info_count_lo)
- {
- *sha_info_count_hi = *sha_info_count_hi + 1 ;
- }
- *sha_info_count_lo += (INT32) count << 3;
- *sha_info_count_hi += (INT32) count >> 29;
- while (count >= SHA_BLOCKSIZE)
- {
- local_memcpy (sha_info_data, buffer, SHA_BLOCKSIZE);
- sha_transform (sha_info_digest, sha_info_data);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- }
- local_memcpy (sha_info_data, buffer, count);
-}
-
-/* finish computing the SHA digest */
-
-void
-sha_final (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16])
-{
- int count;
- INT32 lo_bit_count;
- INT32 hi_bit_count;
-
-
- lo_bit_count = *sha_info_count_lo;
- hi_bit_count = *sha_info_count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- sha_info_data[count++] = 0x80;
- if (count > 56)
- {
- local_memset (sha_info_data, 0, 64 - count, count);
- sha_transform (sha_info_digest, sha_info_data);
- local_memset (sha_info_data, 0, 56, 0);
- }
- else
- {
- local_memset (sha_info_data, 0, 56 - count, count);
- }
- sha_info_data[14] = hi_bit_count;
- sha_info_data[15] = lo_bit_count;
- sha_transform (sha_info_digest, sha_info_data);
-}
-
-/* compute the SHA digest of a FILE stream */
-void
-sha_stream (INT32 sha_info_digest[5])
-{
- int i, j;
- const BYTE *p;
- INT32 sha_info_count_lo, sha_info_count_hi; /* 64-bit bit count */
- INT32 sha_info_data[16];
- const BYTE indata[VSIZE][BLOCK_SIZE] = {
- {75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111,
- 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101,
- 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100,
- 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99,
- 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102,
- 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112,
- 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116,
- 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101,
- 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110,
- 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98,
- 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114,
- 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97,
- 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109,
- 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110,
- 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103,
- 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108,
- 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118,
- 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101,
- 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116,
- 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104,
- 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117,
- 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111,
- 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111,
- 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110,
- 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117,
- 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119,
- 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121,
- 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100,
- 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114,
- 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97,
- 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116,
- 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100,
- 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115,
- 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116,
- 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115,
- 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100,
- 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101,
- 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98,
- 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98,
- 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118,
- 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119,
- 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102,
- 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115,
- 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116,
- 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114,
- 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119,
- 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115,
- 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110,
- 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108,
- 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104,
- 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121,
- 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105,
- 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116,
- 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114,
- 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116,
- 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108,
- 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121,
- 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119,
- 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108,
- 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117,
- 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121,
- 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89,
- 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121,
- 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111,
- 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 79, 114, 119, 111, 114, 114, 121, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100,
- 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109,
- 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111,
- 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115,
- 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111,
- 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97,
- 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101,
- 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101,
- 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73,
- 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105,
- 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117,
- 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104,
- 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108,
- 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116,
- 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117,
- 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97,
- 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97,
- 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101,
- 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97,
- 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111,
- 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105,
- 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111,
- 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115,
- 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100,
- 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115,
- 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119,
- 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110,
- 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101,
- 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110,
- 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100,
- 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110,
- 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101,
- 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111,
- 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121,
- 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117,
- 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101,
- 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112,
- 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115,
- 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115,
- 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110,
- 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98,
- 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110,
- 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99,
- 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116,
- 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106,
- 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119,
- 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110,
- 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117,
- 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100,
- 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121,
- 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99,
- 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114,
- 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97,
- 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110,
- 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98,
- 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121,
- 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117,
- 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101,
- 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97,
- 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116,
- 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107,
- 110, 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110,
- 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111,
- 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116,
- 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110,
- 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105,
- 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101,
- 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115,
- 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105,
- 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97,
- 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110,
- 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101,
- 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110,
- 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98,
- 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116,
- 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117,
- 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97,
- 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 75, 117, 114, 116,
- 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110,
- 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77,
- 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108,
- 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111,
- 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110,
- 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111,
- 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116,
- 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101,
- 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108,
- 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115,
- 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101,
- 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105,
- 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116,
- 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99,
- 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101,
- 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111,
- 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112,
- 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115,
- 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101,
- 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105,
- 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100,
- 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118,
- 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109,
- 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108,
- 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115,
- 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101,
- 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110,
- 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99,
- 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121,
- 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119,
- 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108,
- 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110,
- 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103,
- 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111,
- 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111,
- 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75,
- 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86,
- 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99,
- 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73,
- 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117},
- {116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97,
- 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110,
- 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111,
- 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121,
- 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108,
- 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114,
- 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111,
- 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102,
- 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98,
- 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108,
- 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97,
- 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105, 110,
- 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117, 116,
- 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114, 114,
- 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117, 114,
- 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101,
- 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97,
- 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110,
- 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115,
- 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101,
- 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114,
- 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111,
- 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104,
- 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105,
- 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97,
- 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115,
- 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97,
- 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118,
- 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114,
- 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121,
- 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120,
- 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105,
- 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99,
- 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109,
- 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110,
- 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121,
- 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116,
- 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108,
- 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111,
- 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114,
- 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97,
- 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117,
- 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97,
- 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111,
- 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97,
- 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101,
- 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97,
- 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98,
- 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119,
- 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116,
- 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100,
- 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115,
- 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116,
- 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115,
- 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100,
- 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101,
- 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98,
- 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98,
- 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118,
- 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119,
- 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102,
- 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115,
- 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116,
- 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114,
- 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119,
- 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115,
- 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110,
- 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108,
- 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104,
- 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121,
- 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105,
- 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116,
- 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114,
- 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116,
- 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108,
- 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121,
- 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119,
- 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108,
- 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117,
- 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121,
- 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89,
- 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121,
- 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111,
- 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111,
- 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103,
- 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116,
- 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105,
- 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111,
- 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97,
- 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117,
- 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111,
- 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108,
- 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114,
- 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114,
- 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116,
- 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116,
- 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98,
- 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108,
- 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100,
- 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101,
- 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104,
- 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111,
- 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79,
- 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105,
- 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100,
- 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109,
- 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111,
- 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115,
- 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111,
- 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97,
- 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101,
- 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101,
- 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73,
- 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105,
- 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117,
- 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104,
- 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108,
- 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116,
- 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117,
- 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97,
- 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97,
- 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101,
- 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97,
- 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111,
- 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105,
- 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111,
- 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115,
- 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100,
- 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115,
- 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119,
- 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110,
- 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101,
- 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110,
- 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100,
- 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110,
- 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101,
- 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111,
- 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121,
- 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117,
- 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101,
- 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112,
- 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115,
- 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115,
- 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110,
- 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98,
- 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110,
- 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99,
- 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116,
- 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106,
- 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119,
- 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110,
- 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117,
- 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100,
- 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121,
- 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99,
- 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114,
- 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97,
- 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110,
- 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98,
- 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121,
- 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117,
- 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101,
- 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97,
- 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116,
- 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107,
- 110, 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110,
- 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111,
- 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116,
- 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110,
- 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105,
- 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101,
- 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115,
- 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105,
- 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97,
- 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110,
- 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101,
- 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110,
- 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98,
- 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116,
- 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117,
- 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97,
- 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101,
- 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48,
- 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98,
- 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111,
- 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108,
- 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97,
- 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115,
- 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111,
- 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117,
- 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111,
- 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115,
- 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68,
- 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98,
- 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104,
- 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105,
- 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97,
- 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115,
- 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97,
- 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118,
- 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114,
- 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121,
- 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120,
- 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105,
- 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99,
- 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109,
- 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110,
- 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121,
- 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116,
- 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108,
- 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111,
- 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114,
- 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97,
- 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117,
- 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97,
- 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111,
- 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97,
- 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101,
- 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97,
- 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98,
- 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119,
- 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111}
-};
-const int in_i[VSIZE] = { 8192, 8192 };
-
- sha_init(sha_info_digest, &sha_info_count_lo, &sha_info_count_hi);
- for (j = 0; j < VSIZE; j++)
- {
- i = in_i[j];
- p = &indata[j][0];
- sha_update (p, i, sha_info_digest, &sha_info_count_lo, &sha_info_count_hi, sha_info_data);
- }
- sha_final (sha_info_digest, &sha_info_count_lo, &sha_info_count_hi, sha_info_data);
-}
-/*
-+--------------------------------------------------------------------------+
-| * Test Vector (added for CHStone) |
-| outData : expected output data |
-+--------------------------------------------------------------------------+
-*/
-int
-main ()
-{
- const INT32 outData[5] =
- { 0x006a5a37UL, 0x93dc9485UL, 0x2c412112UL, 0x63f7ba43UL, 0xad73f922UL };
- INT32 sha_info_digest[5]; /* message digest */
-
- int i;
- int main_result;
- main_result = 0;
- sha_stream (sha_info_digest);
-
- for (i = 0; i < 5; i++)
- {
- main_result += (sha_info_digest[i] != outData[i]);
- }
-
- return main_result;
- }
diff --git a/benchmarks/CHStone/sha/sha_driver.c b/benchmarks/CHStone/sha/sha_driver.c
index d533c52..5cbb394 100755
--- a/benchmarks/CHStone/sha/sha_driver.c
+++ b/benchmarks/CHStone/sha/sha_driver.c
@@ -25,1326 +25,25 @@
/* activated by defining USE_MODIFIED_SHA */
#include <stdio.h>
+#include "sha.h"
+#include "sha.c"
-/* NIST Secure Hash Algorithm */
-/* heavily modified from Peter C. Gutmann's implementation */
-
-/* Useful defines & typedefs */
-
-typedef unsigned char BYTE;
-typedef unsigned int INT32;
-
-#define SHA_BLOCKSIZE 64
-
-void sha_init (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi);
-void sha_update (const BYTE *, int, INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16]);
-void sha_final (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16]);
-
-void sha_stream (INT32 sha_info_digest[5]);
-void sha_print ();
-
-#define BLOCK_SIZE 8192
-#define VSIZE 2
-
-/*
-+--------------------------------------------------------------------------+
-| * Test Vectors (added for CHStone) |
-| indata, in_i : input data |
-+--------------------------------------------------------------------------+
-*/
-#define f1(x,y,z) ((x & y) | (~x & z))
-#define f2(x,y,z) (x ^ y ^ z)
-#define f3(x,y,z) ((x & y) | (x & z) | (y & z))
-#define f4(x,y,z) (x ^ y ^ z)
-
-/* SHA constants */
-
-#define CONST1 0x5a827999L
-#define CONST2 0x6ed9eba1L
-#define CONST3 0x8f1bbcdcL
-#define CONST4 0xca62c1d6L
-
-/* 32-bit rotate */
-
-#define ROT32(x,n) ((x << n) | (x >> (32 - n)))
-
-#define FUNC(n,i) \
- temp = ROT32(A,5) + f##n(B,C,D) + E + W[i] + CONST##n; \
- E = D; D = C; C = ROT32(B,30); B = A; A = temp
-
-void
-local_memset (INT32 * s, int c, int n, int e)
-{
- INT32 uc;
- INT32 *p;
- int m;
-
- m = n >> 2;
- uc = c;
- p = (INT32 *) s;
- while (e-- > 0)
- {
- p++;
- }
- while (m-- > 0)
- {
- *p++ = uc;
- }
-}
-
-void
-local_memcpy (INT32 * s1, const BYTE * s2, int n)
-{
- INT32 *p1;
- BYTE *p2;
- INT32 tmp;
- int m;
- m = n >> 2;
- p1 = (INT32 *) s1;
- p2 = (BYTE *) s2;
-
- while (m-- > 0)
- {
- tmp = 0;
- tmp |= 0xFF & *p2++;
- tmp |= (0xFF & *p2++) << 8;
- tmp |= (0xFF & *p2++) << 16;
- tmp |= (0xFF & *p2++) << 24;
- *p1 = tmp;
- p1++;
- }
-}
-
-/* do SHA transformation */
-
-static void
-sha_transform (INT32 sha_info_digest[5], INT32 sha_info_data[16])
-{
- int i;
- INT32 temp, A, B, C, D, E, W[80];
-
- for (i = 0; i < 16; ++i)
- {
- W[i] = sha_info_data[i];
- }
- for (i = 16; i < 80; ++i)
- {
- W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
- }
- A = sha_info_digest[0];
- B = sha_info_digest[1];
- C = sha_info_digest[2];
- D = sha_info_digest[3];
- E = sha_info_digest[4];
-
- for (i = 0; i < 20; ++i)
- {
- FUNC (1, i);
- }
- for (i = 20; i < 40; ++i)
- {
- FUNC (2, i);
- }
- for (i = 40; i < 60; ++i)
- {
- FUNC (3, i);
- }
- for (i = 60; i < 80; ++i)
- {
- FUNC (4, i);
- }
-
- sha_info_digest[0] += A;
- sha_info_digest[1] += B;
- sha_info_digest[2] += C;
- sha_info_digest[3] += D;
- sha_info_digest[4] += E;
-}
-
-/* initialize the SHA digest */
-
-void
-sha_init (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi)
-{
- sha_info_digest[0] = 0x67452301L;
- sha_info_digest[1] = 0xefcdab89L;
- sha_info_digest[2] = 0x98badcfeL;
- sha_info_digest[3] = 0x10325476L;
- sha_info_digest[4] = 0xc3d2e1f0L;
- *sha_info_count_lo = 0L;
- *sha_info_count_hi = 0L;
-}
-
-/* update the SHA digest */
-
-void
-sha_update (const BYTE * buffer, int count, INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16])
-{
- if ((*sha_info_count_lo + ((INT32) count << 3)) < *sha_info_count_lo)
- {
- *sha_info_count_hi = *sha_info_count_hi + 1 ;
- }
- *sha_info_count_lo += (INT32) count << 3;
- *sha_info_count_hi += (INT32) count >> 29;
- while (count >= SHA_BLOCKSIZE)
- {
- local_memcpy (sha_info_data, buffer, SHA_BLOCKSIZE);
- sha_transform (sha_info_digest, sha_info_data);
- buffer += SHA_BLOCKSIZE;
- count -= SHA_BLOCKSIZE;
- }
- local_memcpy (sha_info_data, buffer, count);
-}
-
-/* finish computing the SHA digest */
-
-void
-sha_final (INT32 sha_info_digest[5], INT32 * sha_info_count_lo, INT32 * sha_info_count_hi, INT32 sha_info_data[16])
-{
- int count;
- INT32 lo_bit_count;
- INT32 hi_bit_count;
-
-
- lo_bit_count = *sha_info_count_lo;
- hi_bit_count = *sha_info_count_hi;
- count = (int) ((lo_bit_count >> 3) & 0x3f);
- sha_info_data[count++] = 0x80;
- if (count > 56)
- {
- local_memset (sha_info_data, 0, 64 - count, count);
- sha_transform (sha_info_digest, sha_info_data);
- local_memset (sha_info_data, 0, 56, 0);
- }
- else
- {
- local_memset (sha_info_data, 0, 56 - count, count);
- }
- sha_info_data[14] = hi_bit_count;
- sha_info_data[15] = lo_bit_count;
- sha_transform (sha_info_digest, sha_info_data);
-}
-
-/* compute the SHA digest of a FILE stream */
-void
-sha_stream (INT32 sha_info_digest[5])
-{
- int i, j;
- const BYTE *p;
- INT32 sha_info_count_lo, sha_info_count_hi; /* 64-bit bit count */
- INT32 sha_info_data[16];
- const BYTE indata[VSIZE][BLOCK_SIZE] = {
- {75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111,
- 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101,
- 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100,
- 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99,
- 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102,
- 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112,
- 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116,
- 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101,
- 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110,
- 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98,
- 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114,
- 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97,
- 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109,
- 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110,
- 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103,
- 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108,
- 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118,
- 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101,
- 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116,
- 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104,
- 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117,
- 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111,
- 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111,
- 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110,
- 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117,
- 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119,
- 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121,
- 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100,
- 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114,
- 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97,
- 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116,
- 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100,
- 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115,
- 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116,
- 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115,
- 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100,
- 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101,
- 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98,
- 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98,
- 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118,
- 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119,
- 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102,
- 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115,
- 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116,
- 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114,
- 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119,
- 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115,
- 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110,
- 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108,
- 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104,
- 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121,
- 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105,
- 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116,
- 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114,
- 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116,
- 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108,
- 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121,
- 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119,
- 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108,
- 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117,
- 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121,
- 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89,
- 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121,
- 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111,
- 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 79, 114, 119, 111, 114, 114, 121, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100,
- 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109,
- 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111,
- 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115,
- 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111,
- 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97,
- 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101,
- 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101,
- 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73,
- 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105,
- 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117,
- 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104,
- 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108,
- 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116,
- 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117,
- 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97,
- 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97,
- 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101,
- 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97,
- 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111,
- 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105,
- 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111,
- 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115,
- 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100,
- 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115,
- 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119,
- 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110,
- 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101,
- 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110,
- 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100,
- 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110,
- 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101,
- 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111,
- 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121,
- 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117,
- 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101,
- 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112,
- 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115,
- 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115,
- 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110,
- 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98,
- 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110,
- 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99,
- 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116,
- 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106,
- 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119,
- 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110,
- 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117,
- 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100,
- 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121,
- 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99,
- 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114,
- 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97,
- 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110,
- 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98,
- 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121,
- 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117,
- 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101,
- 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97,
- 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116,
- 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107,
- 110, 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110,
- 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111,
- 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116,
- 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110,
- 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105,
- 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101,
- 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115,
- 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105,
- 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97,
- 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110,
- 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101,
- 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110,
- 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98,
- 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116,
- 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117,
- 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97,
- 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 75, 117, 114, 116,
- 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110,
- 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77,
- 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108,
- 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111,
- 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110,
- 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111,
- 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116,
- 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101,
- 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108,
- 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115,
- 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101,
- 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105,
- 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116,
- 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99,
- 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101,
- 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111,
- 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112,
- 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115,
- 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101,
- 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105,
- 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100,
- 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118,
- 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109,
- 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108,
- 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115,
- 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101,
- 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110,
- 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99,
- 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121,
- 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119,
- 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108,
- 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110,
- 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103,
- 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111,
- 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111,
- 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75,
- 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86,
- 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99,
- 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73,
- 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117},
- {116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97,
- 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110,
- 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111,
- 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121,
- 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108,
- 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114,
- 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111,
- 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102,
- 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98,
- 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108,
- 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97,
- 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105, 110,
- 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117, 116,
- 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114, 114,
- 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117, 114,
- 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101,
- 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97,
- 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110,
- 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115,
- 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101,
- 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114,
- 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111,
- 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104,
- 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105,
- 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97,
- 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115,
- 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97,
- 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118,
- 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114,
- 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121,
- 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120,
- 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105,
- 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99,
- 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109,
- 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110,
- 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121,
- 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116,
- 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108,
- 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111,
- 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114,
- 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97,
- 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117,
- 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97,
- 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111,
- 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97,
- 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101,
- 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97,
- 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98,
- 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119,
- 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116,
- 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100,
- 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115,
- 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116,
- 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115,
- 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100,
- 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101,
- 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98,
- 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98,
- 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118,
- 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119,
- 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102,
- 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115,
- 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116,
- 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114,
- 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119,
- 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115,
- 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110,
- 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108,
- 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104,
- 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121,
- 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105,
- 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116,
- 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114,
- 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116,
- 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108,
- 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121,
- 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119,
- 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108,
- 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117,
- 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121,
- 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89,
- 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121,
- 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111,
- 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111,
- 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103,
- 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116,
- 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105,
- 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111,
- 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97,
- 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117,
- 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111,
- 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117,
- 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108,
- 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114,
- 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114,
- 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116,
- 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116,
- 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98,
- 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108,
- 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100,
- 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101,
- 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104,
- 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111,
- 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79,
- 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105,
- 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 75, 117, 114, 116, 86, 111,
- 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101,
- 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84,
- 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101,
- 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102,
- 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73,
- 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117,
- 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111,
- 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111,
- 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98,
- 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101,
- 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104,
- 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101,
- 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114,
- 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119,
- 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101,
- 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112,
- 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110,
- 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114,
- 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114,
- 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110,
- 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101,
- 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 75, 117,
- 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67, 111, 109, 109,
- 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114, 101, 115, 115,
- 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110, 100, 103, 101,
- 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101, 99, 108, 97,
- 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110, 115, 99, 114,
- 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102, 102, 101,
- 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105, 112, 102,
- 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117, 110, 115,
- 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84,
- 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102,
- 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104,
- 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121,
- 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101,
- 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100,
- 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111,
- 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109,
- 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101,
- 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100,
- 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105,
- 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111,
- 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121,
- 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114,
- 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117,
- 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116,
- 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100,
- 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99,
- 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109,
- 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108,
- 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104,
- 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101,
- 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114,
- 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105,
- 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121,
- 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79,
- 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104,
- 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117, 116, 115, 67,
- 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65, 100, 100, 114,
- 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101, 115, 97, 110,
- 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102, 116, 104, 101,
- 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108, 100, 111, 102,
- 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110, 101, 116, 105,
- 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114, 101, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 75, 117, 114, 116, 86, 111, 110, 110, 101, 103, 117,
- 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110, 116, 65,
- 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100, 105, 101,
- 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110, 111, 102,
- 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101, 97, 114,
- 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111, 117, 108,
- 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121, 111, 110,
- 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116, 117, 114,
- 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100,
- 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109,
- 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111,
- 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115,
- 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111,
- 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97,
- 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101,
- 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101,
- 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73,
- 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105,
- 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121,
- 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117,
- 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104,
- 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108,
- 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116,
- 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116,
- 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116,
- 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117,
- 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97,
- 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97,
- 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101,
- 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97,
- 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111,
- 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105,
- 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111,
- 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115,
- 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100,
- 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115,
- 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119,
- 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110,
- 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110, 101,
- 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101, 110,
- 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97, 100,
- 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101, 110,
- 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87, 101,
- 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99, 111,
- 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108, 121,
- 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117, 116,
- 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111, 117,
- 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116, 101,
- 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117, 110,
- 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110, 112,
- 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105, 115,
- 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101, 115,
- 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115, 110,
- 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105, 97, 98,
- 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97, 110,
- 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110, 99,
- 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101, 116,
- 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110, 106,
- 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117, 119,
- 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97, 110,
- 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97,
- 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 117,
- 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101, 100,
- 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48, 121,
- 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99,
- 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111, 117, 114,
- 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97,
- 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110,
- 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98,
- 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121,
- 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117,
- 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101,
- 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97,
- 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116,
- 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107,
- 110, 111, 119, 116, 104, 97, 116, 75, 117, 114, 116, 86, 111, 110, 110,
- 101, 103, 117, 116, 115, 67, 111, 109, 109, 101, 110, 99, 101, 109, 101,
- 110, 116, 65, 100, 100, 114, 101, 115, 115, 97, 116, 77, 73, 84, 76, 97,
- 100, 105, 101, 115, 97, 110, 100, 103, 101, 110, 116, 108, 101, 109, 101,
- 110, 111, 102, 116, 104, 101, 99, 108, 97, 115, 115, 111, 102, 57, 55, 87,
- 101, 97, 114, 115, 117, 110, 115, 99, 114, 101, 101, 110, 73, 102, 73, 99,
- 111, 117, 108, 100, 111, 102, 102, 101, 114, 121, 111, 117, 111, 110, 108,
- 121, 111, 110, 101, 116, 105, 112, 102, 111, 114, 116, 104, 101, 102, 117,
- 116, 117, 114, 101, 115, 117, 110, 115, 99, 114, 101, 101, 110, 119, 111,
- 117, 108, 100, 98, 101, 105, 116, 84, 104, 101, 108, 111, 110, 103, 116,
- 101, 114, 109, 98, 101, 110, 101, 102, 105, 116, 115, 111, 102, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 104, 97, 118, 101, 98, 101, 101, 110,
- 112, 114, 111, 118, 101, 100, 98, 121, 115, 99, 105, 101, 110, 116, 105,
- 115, 116, 115, 119, 104, 101, 114, 101, 97, 115, 116, 104, 101, 114, 101,
- 115, 116, 111, 102, 109, 121, 97, 100, 118, 105, 99, 101, 104, 97, 115,
- 110, 111, 98, 97, 115, 105, 115, 109, 111, 114, 101, 114, 101, 108, 105,
- 97, 98, 108, 101, 116, 104, 97, 110, 109, 121, 111, 119, 110, 109, 101, 97,
- 110, 100, 101, 114, 105, 110, 103, 101, 120, 112, 101, 114, 105, 101, 110,
- 99, 101, 73, 119, 105, 108, 108, 100, 105, 115, 112, 101, 110, 115, 101,
- 116, 104, 105, 115, 97, 100, 118, 105, 99, 101, 110, 111, 119, 69, 110,
- 106, 111, 121, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98,
- 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116,
- 104, 79, 104, 110, 101, 118, 101, 114, 109, 105, 110, 100, 89, 111, 117,
- 119, 105, 108, 108, 110, 111, 116, 117, 110, 100, 101, 114, 115, 116, 97,
- 110, 100, 116, 104, 101, 112, 111, 119, 101, 114, 97, 110, 100, 98, 101,
- 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121, 111, 117, 116, 104,
- 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101, 102, 97, 100, 101,
- 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101, 105, 110, 50, 48,
- 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108, 111, 111, 107, 98,
- 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111, 102, 121, 111,
- 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99, 97, 108, 108,
- 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116, 103, 114, 97,
- 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104, 112, 111, 115,
- 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98, 101, 102, 111,
- 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102, 97, 98, 117,
- 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108, 121, 108, 111,
- 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111, 116, 97, 115,
- 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105, 110, 101, 68,
- 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117, 116, 116, 104,
- 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114, 114, 121, 98,
- 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 115, 117, 110, 115, 99,
- 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105, 116, 84, 104,
- 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110, 101, 102, 105,
- 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101, 110, 104, 97,
- 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100, 98, 121, 115,
- 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101, 114, 101, 97,
- 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121, 97, 100, 118,
- 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115, 109, 111, 114,
- 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97, 110, 109, 121,
- 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110, 103, 101, 120,
- 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108, 108, 100, 105,
- 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100, 118, 105, 99,
- 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101, 112, 111, 119,
- 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118, 101, 114, 109,
- 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111, 116, 117, 110,
- 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112, 111, 119, 101,
- 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117,
- 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121,
- 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116,
- 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108,
- 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111,
- 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114,
- 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97,
- 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117,
- 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97,
- 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111,
- 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97,
- 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101,
- 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97,
- 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98,
- 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119,
- 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116,
- 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111, 117, 114, 121,
- 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101, 121, 118, 101,
- 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115, 116, 109, 101,
- 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117, 108, 108, 108,
- 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104, 111, 116, 111, 115, 111,
- 102, 121, 111, 117, 114, 115, 101, 108, 102, 97, 110, 100, 114, 101, 99,
- 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111, 117, 99, 97, 110, 116,
- 103, 114, 97, 115, 112, 110, 111, 119, 104, 111, 119, 109, 117, 99, 104,
- 112, 111, 115, 115, 105, 98, 105, 108, 105, 116, 121, 108, 97, 121, 98,
- 101, 102, 111, 114, 101, 121, 111, 117, 97, 110, 100, 104, 111, 119, 102,
- 97, 98, 117, 108, 111, 117, 115, 121, 111, 117, 114, 101, 97, 108, 108,
- 121, 108, 111, 111, 107, 101, 100, 89, 111, 117, 97, 114, 101, 110, 111,
- 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117, 105, 109, 97, 103, 105,
- 110, 101, 68, 111, 110, 116, 119, 111, 114, 114, 121, 97, 98, 111, 117,
- 116, 116, 104, 101, 102, 117, 116, 117, 114, 101, 79, 114, 119, 111, 114,
- 114, 121, 98, 117, 116, 107, 110, 111, 119, 116, 104, 97, 116, 115, 117,
- 110, 115, 99, 114, 101, 101, 110, 119, 111, 117, 108, 100, 98, 101, 105,
- 116, 84, 104, 101, 108, 111, 110, 103, 116, 101, 114, 109, 98, 101, 110,
- 101, 102, 105, 116, 115, 111, 102, 115, 117, 110, 115, 99, 114, 101, 101,
- 110, 104, 97, 118, 101, 98, 101, 101, 110, 112, 114, 111, 118, 101, 100,
- 98, 121, 115, 99, 105, 101, 110, 116, 105, 115, 116, 115, 119, 104, 101,
- 114, 101, 97, 115, 116, 104, 101, 114, 101, 115, 116, 111, 102, 109, 121,
- 97, 100, 118, 105, 99, 101, 104, 97, 115, 110, 111, 98, 97, 115, 105, 115,
- 109, 111, 114, 101, 114, 101, 108, 105, 97, 98, 108, 101, 116, 104, 97,
- 110, 109, 121, 111, 119, 110, 109, 101, 97, 110, 100, 101, 114, 105, 110,
- 103, 101, 120, 112, 101, 114, 105, 101, 110, 99, 101, 73, 119, 105, 108,
- 108, 100, 105, 115, 112, 101, 110, 115, 101, 116, 104, 105, 115, 97, 100,
- 118, 105, 99, 101, 110, 111, 119, 69, 110, 106, 111, 121, 116, 104, 101,
- 112, 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111,
- 102, 121, 111, 117, 114, 121, 111, 117, 116, 104, 79, 104, 110, 101, 118,
- 101, 114, 109, 105, 110, 100, 89, 111, 117, 119, 105, 108, 108, 110, 111,
- 116, 117, 110, 100, 101, 114, 115, 116, 97, 110, 100, 116, 104, 101, 112,
- 111, 119, 101, 114, 97, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102,
- 121, 111, 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116,
- 104, 101, 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114,
- 117, 115, 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121,
- 111, 117, 108, 108, 108, 111, 111, 107, 98, 97, 99, 107, 97, 116, 112, 104,
- 111, 116, 111, 115, 111, 102, 121, 111, 117, 114, 115, 101, 108, 102, 97,
- 110, 100, 114, 101, 99, 97, 108, 108, 105, 110, 97, 119, 97, 121, 121, 111,
- 117, 99, 97, 110, 116, 103, 114, 97, 115, 112, 110, 111, 119, 104, 111,
- 119, 109, 117, 99, 104, 112, 111, 115, 115, 105, 98, 105, 108, 105, 116,
- 121, 108, 97, 121, 98, 101, 102, 111, 114, 101, 121, 111, 117, 97, 110,
- 100, 104, 111, 119, 102, 97, 98, 117, 108, 111, 117, 115, 121, 111, 117,
- 114, 101, 97, 108, 108, 121, 108, 111, 111, 107, 101, 100, 89, 111, 117,
- 97, 114, 101, 110, 111, 116, 97, 115, 102, 97, 116, 97, 115, 121, 111, 117,
- 105, 109, 97, 103, 105, 110, 101, 68, 111, 110, 116, 119, 111, 114, 114,
- 121, 97, 98, 111, 117, 116, 116, 104, 101, 102, 117, 116, 117, 114, 101,
- 79, 114, 119, 111, 114, 114, 121, 98, 117, 116, 107, 110, 111, 119, 116,
- 104, 97, 116, 110, 100, 98, 101, 97, 117, 116, 121, 111, 102, 121, 111,
- 117, 114, 121, 111, 117, 116, 104, 117, 110, 116, 105, 108, 116, 104, 101,
- 121, 118, 101, 102, 97, 100, 101, 100, 66, 117, 116, 116, 114, 117, 115,
- 116, 109, 101, 105, 110, 50, 48, 121, 101, 97, 114, 115, 121, 111, 117,
- 108, 108, 108, 111, 111}
-};
-const int in_i[VSIZE] = { 8192, 8192 };
-
- sha_init(sha_info_digest, &sha_info_count_lo, &sha_info_count_hi);
- for (j = 0; j < VSIZE; j++)
- {
- i = in_i[j];
- p = &indata[j][0];
- sha_update (p, i, sha_info_digest, &sha_info_count_lo, &sha_info_count_hi, sha_info_data);
- }
- sha_final (sha_info_digest, &sha_info_count_lo, &sha_info_count_hi, sha_info_data);
-}
/*
+--------------------------------------------------------------------------+
| * Test Vector (added for CHStone) |
| outData : expected output data |
+--------------------------------------------------------------------------+
*/
+const INT32 outData[5] =
+ { 0x006a5a37UL, 0x93dc9485UL, 0x2c412112UL, 0x63f7ba43UL, 0xad73f922UL };
+
int
main ()
{
- const INT32 outData[5] =
- { 0x006a5a37UL, 0x93dc9485UL, 0x2c412112UL, 0x63f7ba43UL, 0xad73f922UL };
- INT32 sha_info_digest[5]; /* message digest */
-
int i;
int main_result;
main_result = 0;
- sha_stream (sha_info_digest);
+ sha_stream ();
for (i = 0; i < 5; i++)
{
diff --git a/benchmarks/polybench-syn/data-mining/covariance.c b/benchmarks/polybench-syn/data-mining/covariance.c
deleted file mode 100644
index 63f2320..0000000
--- a/benchmarks/polybench-syn/data-mining/covariance.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* covariance.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int m, int n,
- int *float_n,
- int data[ 32 + 0][28 + 0])
-{
- int i, j;
- int ONE = 1;
- int DIV = 28;
-
- *float_n = (int)n;
-
- for (i = 0; i < 32; plus(i))
- for (j = 0; j < 28; plus(j))
- data[i][j] = ((int) i*j) / DIV;
-}
-
-
-
-
-static
-int print_array(int m,
- int cov[ 28 + 0][28 + 0])
-
-{
- int i, j;
- int ONE = 1;
- int res = 0;
- for (i = 0; i < m; plus(i))
- for (j = 0; j < m; plus(j)) {
- res ^= cov[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_covariance(int m, int n,
- int float_n,
- int data[ 32 + 0][28 + 0],
- int cov[ 28 + 0][28 + 0],
- int mean[ 28 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (j = 0; j < m; plus(j))
- {
- mean[j] = 0;
- for (i = 0; i < n; plus(i))
- mean[j] += data[i][j];
- mean[j] /= float_n;
- }
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < m; plus(j))
- data[i][j] -= mean[j];
-
- for (i = 0; i < m; plus(i))
- for (j = i; j < m; plus(j))
- {
- cov[i][j] = 0;
- for (k = 0; k < n; plus(k))
- cov[i][j] += data[k][i] * data[k][j];
- cov[i][j] /= (float_n - ONE);
- cov[j][i] = cov[i][j];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 32;
- int m = 28;
-
-
- int float_n;
- int data[32 + 0][28 + 0];
- int mean[28 + 0];
- int cov[28 + 0][28 + 0];
-
- init_array (m, n, &float_n, data);
-
- kernel_covariance (m, n, float_n,
- data,
- cov,
- mean);
-
- return print_array(m, cov);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/gemm.c b/benchmarks/polybench-syn/linear-algebra/blas/gemm.c
deleted file mode 100644
index 5a28f08..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/gemm.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* gemm.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array(int ni, int nj, int nk,
- int *alpha,
- int *beta,
- int C[ 20 + 0][25 + 0],
- int A[ 20 + 0][30 + 0],
- int B[ 30 + 0][25 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 2;
- *beta = 2;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nj; plus(j))
- C[i][j] = (int) ((i*j+ONE) % ni) / ni;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nk; plus(j))
- A[i][j] = (int) (i*(j+ONE) % nk) / nk;
- for (i = 0; i < nk; plus(i))
- for (j = 0; j < nj; plus(j))
- B[i][j] = (int) (i*(j+ONE+ONE) % nj) / nj;
-}
-
-
-
-
-static
-int print_array(int ni, int nj,
- int C[ 20 + 0][25 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nj; plus(j)) {
- res ^= C[i][j];
- }
- return res;
-}
-
-static
-void kernel_gemm(int ni, int nj, int nk,
- int alpha,
- int beta,
- int C[ 20 + 0][25 + 0],
- int A[ 20 + 0][30 + 0],
- int B[ 30 + 0][25 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < ni; plus(i)) {
- for (j = 0; j < nj; plus(j))
- C[i][j] *= beta;
- for (k = 0; k < nk; plus(k)) {
- for (j = 0; j < nj; plus(j))
- C[i][j] += alpha * A[i][k] * B[k][j];
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int ni = 20;
- int nj = 25;
- int nk = 30;
-
-
- int alpha;
- int beta;
- int C[20 + 0][25 + 0];
- int A[20 + 0][30 + 0];
- int B[30 + 0][25 + 0];
-
-
- init_array (ni, nj, nk, &alpha, &beta,
- C,
- A,
- B);
-
-
- kernel_gemm (ni, nj, nk,
- alpha, beta,
- C,
- A,
- B);
-
-
- return
- print_array(ni, nj, C);
-
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/gemver.c b/benchmarks/polybench-syn/linear-algebra/blas/gemver.c
deleted file mode 100644
index a2711cb..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/gemver.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* gemver.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int *alpha,
- int *beta,
- int A[ 40 + 0][40 + 0],
- int u1[ 40 + 0],
- int v1[ 40 + 0],
- int u2[ 40 + 0],
- int v2[ 40 + 0],
- int w[ 40 + 0],
- int x[ 40 + 0],
- int y[ 40 + 0],
- int z[ 40 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 3;
- *beta = 2;
-
- int fn = (int)n;
-
- for (i = 0; i < n; plus(i))
- {
- u1[i] = i;
- u2[i] = ((i+ONE)/fn)/2;
- v1[i] = ((i+ONE)/fn)/4;
- v2[i] = ((i+ONE)/fn)/6;
- y[i] = ((i+ONE)/fn)/8;
- z[i] = ((i+ONE)/fn)/9;
- x[i] = 0;
- w[i] = 0;
- for (j = 0; j < n; plus(j))
- A[i][j] = (int) (i*j % n) / n;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int w[ 40 + 0])
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res ^= w[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_gemver(int n,
- int alpha,
- int beta,
- int A[ 40 + 0][40 + 0],
- int u1[ 40 + 0],
- int v1[ 40 + 0],
- int u2[ 40 + 0],
- int v2[ 40 + 0],
- int w[ 40 + 0],
- int x[ 40 + 0],
- int y[ 40 + 0],
- int z[ 40 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- A[i][j] = A[i][j] + u1[i] * v1[j] + u2[i] * v2[j];
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- x[i] = x[i] + beta * A[j][i] * y[j];
-
- for (i = 0; i < n; plus(i))
- x[i] = x[i] + z[i];
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- w[i] = w[i] + alpha * A[i][j] * x[j];
-
-#pragma endscop
-}
-
-
-int main()
-{
-
- int n = 40;
-
-
- int alpha;
- int beta;
- int A[40 + 0][40 + 0];
- int u1[40 + 0];
- int v1[40 + 0];
- int u2[40 + 0];
- int v2[40 + 0];
- int w[40 + 0];
- int x[40 + 0];
- int y[40 + 0];
- int z[40 + 0];
-
-
-
- init_array (n, &alpha, &beta,
- A,
- u1,
- v1,
- u2,
- v2,
- w,
- x,
- y,
- z);
-
- kernel_gemver (n, alpha, beta,
- A,
- u1,
- v1,
- u2,
- v2,
- w,
- x,
- y,
- z);
-
- return print_array(n, w);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/gesummv.c b/benchmarks/polybench-syn/linear-algebra/blas/gesummv.c
deleted file mode 100644
index 606a581..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/gesummv.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* gesummv.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-
-static
-void init_array(int n,
- int *alpha,
- int *beta,
- int A[ 30 + 0][30 + 0],
- int B[ 30 + 0][30 + 0],
- int x[ 30 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 3;
- *beta = 2;
- for (i = 0; i < n; plus(i))
- {
- x[i] = (int)( i % n) / n;
- for (j = 0; j < n; plus(j)) {
- A[i][j] = (int) ((i*j+ONE) % n) / n;
- B[i][j] = (int) ((i*j+ONE+ONE) % n) / n;
- }
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int y[ 30 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res ^= y[i];
- }
- return res;
-}
-
-static
-void kernel_gesummv(int n,
- int alpha,
- int beta,
- int A[ 30 + 0][30 + 0],
- int B[ 30 + 0][30 + 0],
- int tmp[ 30 + 0],
- int x[ 30 + 0],
- int y[ 30 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i))
- {
- tmp[i] = 0;
- y[i] = 0;
- for (j = 0; j < n; plus(j))
- {
- tmp[i] = A[i][j] * x[j] + tmp[i];
- y[i] = B[i][j] * x[j] + y[i];
- }
- y[i] = alpha * tmp[i] + beta * y[i];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 30;
-
-
- int alpha;
- int beta;
- int A[30 + 0][30 + 0];
- int B[30 + 0][30 + 0];
- int tmp[30 + 0];
- int x[30 + 0];
- int y[30 + 0];
-
- init_array (n, &alpha, &beta,
- A,
- B,
- x);
-
- kernel_gesummv (n, alpha, beta,
- A,
- B,
- tmp,
- x,
- y);
-
-
- return print_array(n, y);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/symm.c b/benchmarks/polybench-syn/linear-algebra/blas/symm.c
deleted file mode 100644
index a5e8539..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/symm.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* symm.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array(int m, int n,
- int *alpha,
- int *beta,
- int C[ 20 + 0][30 + 0],
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int HUND = 100;
-
- *alpha = 3;
- *beta = 2;
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j)) {
- C[i][j] = (int) ((i+j) % HUND) / m;
- B[i][j] = (int) ((n+i-j) % HUND) / m;
- }
- for (i = 0; i < m; plus(i)) {
- for (j = 0; j <=i; plus(j))
- A[i][j] = (int) ((i+j) % HUND) / m;
- for (j = i+ONE; j < m; plus(j))
- A[i][j] = -999;
- }
-}
-
-static
-int print_array(int m, int n,
- int C[ 20 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= C[i][j];
- }
- return res;
-}
-
-
-static
-void kernel_symm(int m, int n,
- int alpha,
- int beta,
- int C[ 20 + 0][30 + 0],
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int ONE = 1;
- int i, j, k;
- int temp2;
-#pragma scop
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j) )
- {
- temp2 = 0;
- for (k = 0; k < i; plus(k)) {
- C[k][j] += alpha*B[i][j] * A[i][k];
- temp2 += B[k][j] * A[i][k];
- }
- C[i][j] = beta * C[i][j] + alpha*B[i][j] * A[i][i] + alpha * temp2;
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int m = 20;
- int n = 30;
-
- int alpha;
- int beta;
- int C[20 + 0][30 + 0];
- int A[20 + 0][20 + 0];
- int B[20 + 0][30 + 0];
-
-
- init_array (m, n, &alpha, &beta,
- C,
- A,
- B);
-
- kernel_symm (m, n,
- alpha, beta,
- C,
- A,
- B);
-
- return
- print_array(m, n, C);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/syr2k.c b/benchmarks/polybench-syn/linear-algebra/blas/syr2k.c
deleted file mode 100644
index 82b4d3b..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/syr2k.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* syr2k.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array(int n, int m,
- int *alpha,
- int *beta,
- int C[ 30 + 0][30 + 0],
- int A[ 30 + 0][20 + 0],
- int B[ 30 + 0][20 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 3;
- *beta = 2;
- for (i = 0; i < n; plus(i))
- for (j = 0; j < m; plus(j)) {
- A[i][j] = (int) ((i*j+ONE)%n) / n;
- B[i][j] = (int) ((i*j+ONE+ONE)%m) / m;
- }
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- C[i][j] = (int) ((i*j+4-ONE)%n) / m;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int C[ 30 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= C[i][j];
- }
- return res;
-}
-
-
-static
-void kernel_syr2k(int n, int m,
- int alpha,
- int beta,
- int C[ 30 + 0][30 + 0],
- int A[ 30 + 0][20 + 0],
- int B[ 30 + 0][20 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i)) {
- for (j = 0; j <= i; plus(j))
- C[i][j] *= beta;
- for (k = 0; k < m; plus(k))
- for (j = 0; j <= i; plus(j))
- {
- C[i][j] += A[j][k]*alpha*B[i][k] + B[j][k]*alpha*A[i][k];
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 30;
- int m = 20;
-
-
- int alpha;
- int beta;
- int C[30 + 0][30 + 0];
- int A[30 + 0][20 + 0];
- int B[30 + 0][20 + 0];
-
-
- init_array (n, m, &alpha, &beta,
- C,
- A,
- B);
-
-
- ;
-
-
- kernel_syr2k (n, m,
- alpha, beta,
- C,
- A,
- B);
-
-
- ;
- ;
-
-
-
- return print_array(n, C);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/syrk.c b/benchmarks/polybench-syn/linear-algebra/blas/syrk.c
deleted file mode 100644
index dbf2e6b..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/syrk.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* syrk.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array(int n, int m,
- int *alpha,
- int *beta,
- int C[ 30 + 0][30 + 0],
- int A[ 30 + 0][20 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 3;
- *beta = 2;
- for (i = 0; i < n; plus(i))
- for (j = 0; j < m; plus(j))
- A[i][j] = (int) ((i*j+ONE)%n) / n;
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- C[i][j] = (int) ((i*j+ONE+ONE)%m) / m;
-}
-
-
-static
-int print_array(int n,
- int C[ 30 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= C[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_syrk(int n, int m,
- int alpha,
- int beta,
- int C[ 30 + 0][30 + 0],
- int A[ 30 + 0][20 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i)) {
- for (j = 0; j <= i; plus(j))
- C[i][j] *= beta;
- for (k = 0; k < m; plus(k)) {
- for (j = 0; j <= i; plus(j))
- C[i][j] += alpha * A[i][k] * A[j][k];
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 30;
- int m = 20;
-
-
- int alpha;
- int beta;
- int C[30 + 0][30 + 0];
- int A[30 + 0][20 + 0];
-
-
- init_array (n, m, &alpha, &beta, C, A);
-
-
- ;
-
-
- kernel_syrk (n, m, alpha, beta, C, A);
-
-
- ;
- ;
-
-
-
- return print_array(n, C);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/trmm.c b/benchmarks/polybench-syn/linear-algebra/blas/trmm.c
deleted file mode 100644
index 79b384d..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/trmm.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* trmm.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array(int m, int n,
- int *alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 3;
- for (i = 0; i < m; plus(i)) {
- for (j = 0; j < i; plus(j)) {
- A[i][j] = (int)((i+j) % m)/m;
- }
- A[i][i] = 1;
- for (j = 0; j < n; plus(j)) {
- B[i][j] = (int)((n+(i-j)) % n)/n;
- }
- }
-
-}
-
-
-
-
-static
-int print_array(int m, int n,
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= B[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_trmm(int m, int n,
- int alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j, k;
- int ONE = 1;
-#pragma scop
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j)) {
- for (k = i+ONE; k < m; plus(k))
- B[i][j] += A[k][i] * B[k][j];
- B[i][j] = alpha * B[i][j];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int m = 20;
- int n = 30;
-
-
- int alpha;
- int A[20 + 0][20 + 0];
- int B[20 + 0][30 + 0];
-
-
- init_array (m, n, &alpha, A, B);
-
-
- kernel_trmm (m, n, alpha, A, B);
-
- return print_array(m, n, B);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c b/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c
deleted file mode 100644
index 9b8edfe..0000000
--- a/benchmarks/polybench-syn/linear-algebra/blas/trmm.preproc.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* trmm.c: this file is part of PolyBench/C */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <math.h>
-
-/* Include polybench common header. */
-#include<polybench.h>
-# 1 "trmm.c"
-# 1 "<built-in>" 1
-# 1 "<built-in>" 3
-# 362 "<built-in>" 3
-# 1 "<command line>" 1
-# 1 "<built-in>" 2
-# 1 "trmm.c" 2
-# 1 "utilities/polybench.h" 1
-# 30 "utilities/polybench.h"
-# 1 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h" 1 3 4
-# 31 "utilities/polybench.h" 2
-# 231 "utilities/polybench.h"
-extern void* polybench_alloc_data(unsigned long long int n, int elt_size);
-extern void polybench_free_data(void* ptr);
-
-
-
-
-extern void polybench_flush_cache();
-extern void polybench_prepare_instruments();
-# 2 "trmm.c" 2
-
-
-# 1 "./linear-algebra/blas/trmm/trmm.h" 1
-# 5 "trmm.c" 2
-
-
-
-static
-void init_array(int m, int n,
- int *alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
-
- *alpha = 1.5;
- for (i = 0; i < m; i++) {
- for (j = 0; j < i; j++) {
- A[i][j] = (int)((i+j) % m)/m;
- }
- A[i][i] = 1.0;
- for (j = 0; j < n; j++) {
- B[i][j] = (int)((n+(i-j)) % n)/n;
- }
- }
-
-}
-
-
-
-
-static
-void print_array(int m, int n,
- int B[ 20 + 0][30 + 0])
-{
- int i, j;
-
- fprintf(stderr, "==BEGIN DUMP_ARRAYS==\n");
- fprintf(stderr, "begin dump: %s", "B");
- for (i = 0; i < m; i++)
- for (j = 0; j < n; j++) {
- if ((i * m + j) % 20 == 0) fprintf (stderr, "\n");
- fprintf (stderr, "%d ", B[i][j]);
- }
- fprintf(stderr, "\nend dump: %s\n", "B");
- fprintf(stderr, "==END DUMP_ARRAYS==\n");
-}
-
-
-
-
-static
-void kernel_trmm(int m, int n,
- int alpha,
- int A[ 20 + 0][20 + 0],
- int B[ 20 + 0][30 + 0])
-{
- int i, j, k;
-# 68 "trmm.c"
-#pragma scop
- for (i = 0; i < m; i++)
- for (j = 0; j < n; j++) {
- for (k = i+1; k < m; k++)
- B[i][j] += A[k][i] * B[k][j];
- B[i][j] = alpha * B[i][j];
- }
-#pragma endscop
-
-}
-
-
-int main(int argc, char** argv)
-{
-
- int m = 20;
- int n = 30;
-
-
- int alpha;
- int (*A)[20 + 0][20 + 0]; A = (int(*)[20 + 0][20 + 0])polybench_alloc_data ((20 + 0) * (20 + 0), sizeof(int));;
- int (*B)[20 + 0][30 + 0]; B = (int(*)[20 + 0][30 + 0])polybench_alloc_data ((20 + 0) * (30 + 0), sizeof(int));;
-
-
- init_array (m, n, &alpha, *A, *B);
-
-
- ;
-
-
- kernel_trmm (m, n, alpha, *A, *B);
-
-
- ;
- ;
-
-
-
- if (argc > 42 && ! strcmp(argv[0], "")) print_array(m, n, *B);
-
-
- free((void*)A);;
- free((void*)B);;
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/2mm.c b/benchmarks/polybench-syn/linear-algebra/kernels/2mm.c
deleted file mode 100644
index 391e9ac..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/2mm.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* 2mm.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array(int ni, int nj, int nk, int nl,
- int *alpha,
- int *beta,
- int A[ 16 + 0][22 + 0],
- int B[ 22 + 0][18 + 0],
- int C[ 18 + 0][24 + 0],
- int D[ 16 + 0][24 + 0])
-{
- int i, j;
- int ONE = 1;
-
- *alpha = 2;
- *beta = 2;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nk; plus(j))
- A[i][j] = (int) ((i*j+ONE) % ni) / ni;
- for (i = 0; i < nk; plus(i))
- for (j = 0; j < nj; plus(j))
- B[i][j] = (int) (i*(j+ONE) % nj) / nj;
- for (i = 0; i < nj; plus(i))
- for (j = 0; j < nl; plus(j))
- C[i][j] = (int) ((i*(j+ONE+ONE+ONE)+ONE) % nl) / nl;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nl; plus(j))
- D[i][j] = (int) (i*(j+ONE+ONE) % nk) / nk;
-}
-
-static
-int print_array(int ni, int nl,
- int D[ 16 + 0][24 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nl; plus(j)) {
- res ^= D[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_2mm(int ni, int nj, int nk, int nl,
- int alpha,
- int beta,
- int tmp[ 16 + 0][18 + 0],
- int A[ 16 + 0][22 + 0],
- int B[ 22 + 0][18 + 0],
- int C[ 18 + 0][24 + 0],
- int D[ 16 + 0][24 + 0])
-{
- int ONE = 1;
- int i, j, k;
-
-#pragma scop
-
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nj; plus(j))
- {
- tmp[i][j] = 0;
- for (k = 0; k < nk; plus(k))
- tmp[i][j] += alpha * A[i][k] * B[k][j];
- }
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nl; plus(j))
- {
- D[i][j] *= beta;
- for (k = 0; k < nj; plus(k))
- D[i][j] += tmp[i][k] * C[k][j];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int ni = 16;
- int nj = 18;
- int nk = 22;
- int nl = 24;
-
- int alpha;
- int beta;
- int tmp[16 + 0][18 + 0];
- int A[16 + 0][22 + 0];
- int B[22 + 0][18 + 0];
- int C[18 + 0][24 + 0];
- int D[16 + 0][24 + 0];
-
-
- init_array (ni, nj, nk, nl, &alpha, &beta,
- A,
- B,
- C,
- D);
-
-
- kernel_2mm (ni, nj, nk, nl,
- alpha, beta,
- tmp,
- A,
- B,
- C,
- D);
-
-
- return print_array(ni, nl, D);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/3mm.c b/benchmarks/polybench-syn/linear-algebra/kernels/3mm.c
deleted file mode 100644
index e565fb5..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/3mm.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* 3mm.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array(int ni, int nj, int nk, int nl, int nm,
- int A[ 16 + 0][20 + 0],
- int B[ 20 + 0][18 + 0],
- int C[ 18 + 0][24 + 0],
- int D[ 24 + 0][22 + 0])
-{
- int i, j;
- int ONE = 1;
- int TWO = 2;
- int THREE = 3;
- int FIVE = 5;
-
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nk; plus(j))
- A[i][j] = (int) ((i*j+ONE) % ni) / (5*ni);
- for (i = 0; i < nk; plus(i))
- for (j = 0; j < nj; plus(j))
- B[i][j] = (int) ((i*(j+ONE)+TWO) % nj) / (5*nj);
- for (i = 0; i < nj; plus(i))
- for (j = 0; j < nm; plus(j))
- C[i][j] = (int) (i*(j+THREE) % nl) / (5*nl);
- for (i = 0; i < nm; plus(i))
- for (j = 0; j < nl; plus(j))
- D[i][j] = (int) ((i*(j+TWO)+TWO) % nk) / (5*nk);
-}
-
-
-
-
-static
-int print_array(int ni, int nl,
- int G[ 16 + 0][22 + 0])
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nl; plus(j)) {
- res ^= G[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_3mm(int ni, int nj, int nk, int nl, int nm,
- int E[ 16 + 0][18 + 0],
- int A[ 16 + 0][20 + 0],
- int B[ 20 + 0][18 + 0],
- int F[ 18 + 0][22 + 0],
- int C[ 18 + 0][24 + 0],
- int D[ 24 + 0][22 + 0],
- int G[ 16 + 0][22 + 0])
-{
- int ONE = 1;
- int i, j, k;
-
-#pragma scop
-
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nj; plus(j))
- {
- E[i][j] = 0;
- for (k = 0; k < nk; plus(k))
- E[i][j] += A[i][k] * B[k][j];
- }
-
- for (i = 0; i < nj; plus(i))
- for (j = 0; j < nl; plus(j))
- {
- F[i][j] = 0;
- for (k = 0; k < nm; plus(k))
- F[i][j] += C[i][k] * D[k][j];
- }
-
- for (i = 0; i < ni; plus(i))
- for (j = 0; j < nl; plus(j))
- {
- G[i][j] = 0;
- for (k = 0; k < nj; plus(k))
- G[i][j] += E[i][k] * F[k][j];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int ni = 16;
- int nj = 18;
- int nk = 20;
- int nl = 22;
- int nm = 24;
-
-
- int E[16 + 0][18 + 0];
- int A[16 + 0][20 + 0];
- int B[20 + 0][18 + 0];
- int F[18 + 0][22 + 0];
- int C[18 + 0][24 + 0];
- int D[24 + 0][22 + 0];
- int G[16 + 0][22 + 0];
-
-
- init_array (ni, nj, nk, nl, nm,
- A,
- B,
- C,
- D);
-
- kernel_3mm (ni, nj, nk, nl, nm,
- E,
- A,
- B,
- F,
- C,
- D,
- G);
-
-
- return print_array(ni, nl, G);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/atas.c b/benchmarks/polybench-syn/linear-algebra/kernels/atas.c
deleted file mode 100644
index a051046..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/atas.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* atax.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int m, int n,
- int A[ 38 + 0][42 + 0],
- int x[ 42 + 0])
-{
- int ONE = 1;
- int i, j;
- int fn;
- fn = (int)n;
-
- for (i = 0; i < n; plus(i))
- x[i] = ONE + (i / fn);
- for (i = 0; i < m; plus(i))
- for (j = 0; j < n; plus(j))
- A[i][j] = (int) ((i+j) % n) / (5*m);
-}
-
-
-
-
-static
-int print_array(int n,
- int y[ 42 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res ^= y[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_atax(int m, int n,
- int A[ 38 + 0][42 + 0],
- int x[ 42 + 0],
- int y[ 42 + 0],
- int tmp[ 38 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i))
- y[i] = 0;
- for (i = 0; i < m; plus(i))
- {
- tmp[i] = 0;
- for (j = 0; j < n; plus(j))
- tmp[i] = tmp[i] + A[i][j] * x[j];
- for (j = 0; j < n; plus(j))
- y[j] = y[j] + A[i][j] * tmp[i];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int m = 38;
- int n = 42;
-
-
- int A[38 + 0][42 + 0];
- int x[42 + 0];
- int y[42 + 0];
- int tmp[38 + 0];
-
- init_array (m, n, A, x);
-
- kernel_atax (m, n,
- A,
- x,
- y,
- tmp);
-
-
- return print_array(n, y);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/bicg.c b/benchmarks/polybench-syn/linear-algebra/kernels/bicg.c
deleted file mode 100644
index 48b7658..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/bicg.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* bicg.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array (int m, int n,
- int A[ 42 + 0][38 + 0],
- int r[ 42 + 0],
- int p[ 38 + 0])
-{
- int i, j;
- int ONE = 1;
-
- for (i = 0; i < m; plus(i))
- p[i] = (int)(i % m) / m;
- for (i = 0; i < n; plus(i)) {
- r[i] = (int)(i % n) / n;
- for (j = 0; j < m; plus(j))
- A[i][j] = (int) (i*(j+ONE) % n)/n;
- }
-}
-
-
-
-
-static
-int print_array(int m, int n,
- int s[ 38 + 0],
- int q[ 42 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < m; plus(i)) {
- res ^= s[i];
- }
- for (i = 0; i < n; plus(i)) {
- res ^= q[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_bicg(int m, int n,
- int A[ 42 + 0][38 + 0],
- int s[ 38 + 0],
- int q[ 42 + 0],
- int p[ 38 + 0],
- int r[ 42 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < m; plus(i))
- s[i] = 0;
- for (i = 0; i < n; plus(i))
- {
- q[i] = 0;
- for (j = 0; j < m; plus(j))
- {
- s[j] = s[j] + r[i] * A[i][j];
- q[i] = q[i] + A[i][j] * p[j];
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 42;
- int m = 38;
-
-
- int A[42 + 0][38 + 0];
- int s[38 + 0];
- int q[42 + 0];
- int p[38 + 0];
- int r[42 + 0];
-
-
- init_array (m, n,
- A,
- r,
- p);
-
- kernel_bicg (m, n,
- A,
- s,
- q,
- p,
- r);
-
-
- return print_array(m, n, s, q);
-
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/doitgen.c b/benchmarks/polybench-syn/linear-algebra/kernels/doitgen.c
deleted file mode 100644
index 20de1df..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/doitgen.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* doitgen.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array(int nr, int nq, int np,
- int A[ 10 + 0][8 + 0][12 + 0],
- int C4[ 12 + 0][12 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
- for (i = 0; i < nr; plus(i))
- for (j = 0; j < nq; plus(j))
- for (k = 0; k < np; plus(k))
- A[i][j][k] = (int) ((i*j + k)%np) / np;
- for (i = 0; i < np; plus(i))
- for (j = 0; j < np; plus(j))
- C4[i][j] = (int) (i*j % np) / np;
-}
-
-
-static
-int print_array(int nr, int nq, int np,
- int A[ 10 + 0][8 + 0][12 + 0])
-{
- int i, j, k;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < nr; plus(i))
- for (j = 0; j < nq; plus(j))
- for (k = 0; k < np; plus(k)) {
- res ^= A[i][j][k];
- }
- return res;
-}
-
-
-
-
-void kernel_doitgen(int nr, int nq, int np,
- int A[ 10 + 0][8 + 0][12 + 0],
- int C4[ 12 + 0][12 + 0],
- int sum[ 12 + 0])
-{
- int r, q, p, s;
- int ONE = 1;
-
-#pragma scop
- for (r = 0; r < nr; plus(r))
- for (q = 0; q < nq; plus(q)) {
- for (p = 0; p < np; plus(p)) {
- sum[p] = 0;
- for (s = 0; s < np; plus(s))
- sum[p] += A[r][q][s] * C4[s][p];
- }
- for (p = 0; p < np; plus(p))
- A[r][q][p] = sum[p];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int nr = 10;
- int nq = 8;
- int np = 12;
-
-
- int A[10 + 0][8 + 0][12 + 0];
- int sum[12 + 0];
- int C4[12 + 0][12 + 0];
-
-
- init_array (nr, nq, np,
- A,
- C4);
-
-
- kernel_doitgen (nr, nq, np,
- A,
- C4,
- sum);
-
-
-
- return print_array(nr, nq, np, A);
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/kernels/mvt.c b/benchmarks/polybench-syn/linear-algebra/kernels/mvt.c
deleted file mode 100644
index aa68b1c..0000000
--- a/benchmarks/polybench-syn/linear-algebra/kernels/mvt.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* mvt.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-
-static
-void init_array(int n,
- int x1[ 40 + 0],
- int x2[ 40 + 0],
- int y_1[ 40 + 0],
- int y_2[ 40 + 0],
- int A[ 40 + 0][40 + 0])
-{
- int i, j;
- int ONE = 1;
- int THREE = 3;
-
- for (i = 0; i < n; plus(i))
- {
- x1[i] = (int) (i % n) / n;
- x2[i] = (int) ((i + ONE) % n) / n;
- y_1[i] = (int) ((i + THREE) % n) / n;
- y_2[i] = (int) ((i + 4) % n) / n;
- for (j = 0; j < n; plus(j))
- A[i][j] = (int) (i*j % n) / n;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int x1[ 40 + 0],
- int x2[ 40 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res ^= x1[i];
- }
-
- for (i = 0; i < n; plus(i)) {
- res ^= x2[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_mvt(int n,
- int x1[ 40 + 0],
- int x2[ 40 + 0],
- int y_1[ 40 + 0],
- int y_2[ 40 + 0],
- int A[ 40 + 0][40 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- x1[i] = x1[i] + A[i][j] * y_1[j];
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- x2[i] = x2[i] + A[j][i] * y_2[j];
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 40;
-
-
- int A[40 + 0][40 + 0];
- int x1[40 + 0];
- int x2[40 + 0];
- int y_1[40 + 0];
- int y_2[40 + 0];
-
-
-
- init_array (n,
- x1,
- x2,
- y_1,
- y_2,
- A);
-
-
- kernel_mvt (n,
- x1,
- x2,
- y_1,
- y_2,
- A);
-
- return print_array(n, x1, x2);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c b/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c
deleted file mode 100644
index 264251d..0000000
--- a/benchmarks/polybench-syn/linear-algebra/solvers/cholesky.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* cholesky.c: this file is part of PolyBench/C */
-
-#include <stdio.h>
-
-# define SQRT_FUN(x) sqrtf(x)
-
-#define plus(i) i = i + ONE
-static
-void init_array(int n,
- int A[40][40])
-{
- int i, j;
- int ONE = 1;
-
- for (i = 0; i < n; plus(i))
- {
- for (j = 0; j <= i; plus(j))
- A[i][j] = (int)(-j % n) / n + ONE;
- for (j = i + ONE; j < n; plus(j)) {
- A[i][j] = 0;
- }
- A[i][i] = 1;
- }
-
-
- int r,s,t;
- int B[40][40];
- for (r = 0; r < n; ++r)
- for (s = 0; s < n; ++s)
- B[r][s] = 0;
- for (t = 0; t < n; ++t)
- for (r = 0; r < n; ++r)
- for (s = 0; s < n; ++s)
- B[r][s] += A[r][t] * A[s][t];
- for (r = 0; r < n; ++r)
- for (s = 0; s < n; ++s)
- A[r][s] = B[r][s];
-
-}
-
-
-
-
-static
-int check_array(int n,
- int A[40][40])
-
-{
- int res = 0;
- int ONE = 1;
- int i, j;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j <= i; plus(j)) {
- if(A[i][j]!=0) res = 1;
- }
- return res;
-}
-
-
-
-
-static
-void kernel_cholesky(int n,
- int A[40][40])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i)) {
-
- for (j = 0; j < i; plus(j)) {
- for (k = 0; k < j; plus(k)) {
- A[i][j] -= A[i][k] * A[j][k];
- }
- A[i][j] /= A[j][j];
- }
-
- for (k = 0; k < i; plus(k)) {
- A[i][i] -= A[i][k] * A[i][k];
- }
- int sq = 0; int val = 0; int cmp = A[i][i];
- printf("cmp %d\n",cmp);
- while(sq <= cmp) {
- val = val + ONE;
- sq = val * val;
- }
- printf("val %d\n",val);
- A[i][i] = val;
- }
-#pragma endscop
-
-}
-
-
-int main(int argc, char** argv)
-{
-
- int n = 40;
-
-
- int A[40][40];
-
-
- //init_array (n, A);
-
-
- kernel_cholesky (n, A);
-
-
- return check_array(n, A);
-
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c b/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
deleted file mode 100644
index 677c23c..0000000
--- a/benchmarks/polybench-syn/linear-algebra/solvers/durbin.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* durbin.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-/* Include polybench common header. */
-static
-void init_array (int n,
- int r[ 40 + 0])
-{
- int ONE = 1;
- int i, j;
-
- for (i = 0; i < n; plus(i))
- {
- r[i] = (n+ONE-i);
- }
-}
-
-
-
-static
-int print_array(int n,
- int y[ 40 + 0])
-
-{
- int ONE = 1;
- int i;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res += y[i];
- }
- return res;
-}
-
-static
-void kernel_durbin(int n,
- int r[ 40 + 0],
- int y[ 40 + 0])
-{
- int z[40];
- int alpha;
- int beta;
- int sum;
-
- int ONE = 1;
- int i,k;
-
-#pragma scop
- y[0] = -r[0];
- beta = 1;
- alpha = -r[0];
-
- for (k = 1; k < n; plus(k)) {
- beta = (ONE-alpha*alpha)*beta;
- sum = 0;
- for (i=0; i<k; plus(i)) {
- sum += r[k-i-ONE]*y[i];
- }
- alpha = - (r[k] + sum)/beta;
-
- for (i=0; i<k; plus(i)) {
- z[i] = y[i] + alpha*y[k-i-ONE];
- }
- for (i=0; i<k; plus(i)) {
- y[i] = z[i];
- }
- y[k] = alpha;
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 40;
-
-
- int r[40 + 0];
- int y[40 + 0];
-
-
- init_array (n, r);
-
- kernel_durbin (n,
- r,
- y);
-
- return print_array(n, y);
-
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c b/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
deleted file mode 100644
index 1cf07ea..0000000
--- a/benchmarks/polybench-syn/linear-algebra/solvers/lu.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* lu.c: this file is part of PolyBench/C */
-
-//#include <stdio.h>
-//#include <unistd.h>
-//#include <string.h>
-//#include <math.h>
-
-#define plus(i) i = i + ONE
-
-static
-void init_array (int n,
- int A[40][40])
-{
- int ONE = 1;
- int i, j;
-
- for (i = 0; i < n; plus(i))
- {
- for (j = 0; j <= i; plus(j))
- A[i][j] = (int)(-j % n) / n + ONE;
- for (j = plus(i); j < n; plus(j)) {
- A[i][j] = 0;
- }
- A[i][i] = 1;
- }
-
-
-
- int r,s,t;
- int B[40][40]; // B = (int(*)[40 + 0][40 + 0])polybench_alloc_data ((40 + 0) * (40 + 0), sizeof(int));;
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- B[r][s] = 0;
- for (t = 0; t < n; plus(t))
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- B[r][s] += A[r][t] * A[s][t];
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- A[r][s] = B[r][s];
- //free((void*)B);;
-
-}
-
-
-
-/*
-static
-void print_array(int n,
- int A[ 40 + 0][40 + 0])
-
-{
- int i, j;
-
- fprintf(stderr, "==BEGIN DUMP_ARRAYS==\n");
- fprintf(stderr, "begin dump: %s", "A");
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++) {
- if ((i * n + j) % 20 == 0) fprintf (stderr, "\n");
- fprintf (stderr, "%d ", A[i][j]);
- }
- fprintf(stderr, "\nend dump: %s\n", "A");
- fprintf(stderr, "==END DUMP_ARRAYS==\n");
-}
-*/
-
-
-
-static
-void kernel_lu(int n,
- int A[ 40][40])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i)) {
- for (j = 0; j <i; plus(j)) {
- for (k = 0; k < j; plus(k)) {
- A[i][j] -= A[i][k] * A[k][j];
- }
- A[i][j] /= A[j][j];
- }
- for (j = i; j < n; plus(j)) {
- for (k = 0; k < i; plus(k)) {
- A[i][j] -= A[i][k] * A[k][j];
- }
- }
- }
-#pragma endscop
-}
-
-static
-int check_array(int n,
- int A[40][40])
-{
- int res = 0;
- int i, j;
- int ONE = 1;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- if(A[i][j] !=0) res = 1;
-
- return res;
-}
-
-
-int main()
-{
-
- int n = 40;
-
-
- int A[40][40]; //A = (int(*)[40 + 0][40 + 0])polybench_alloc_data ((40 + 0) * (40 + 0), sizeof(int));;
-
-
- init_array (n, A);
-
-
-
- //print_array(n, A);
- // polybench_timer_start();;
-
-
- kernel_lu (n, A);
-
-
- // polybench_timer_stop();;
- // polybench_timer_print();;
-
-
-
- //if (argc > 42 && ! strcmp(argv[0], ""))
- return check_array(n, A);
- return 0;
-
- //free((void*)A);;
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c b/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c
deleted file mode 100644
index e85316a..0000000
--- a/benchmarks/polybench-syn/linear-algebra/solvers/ludcmp.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* ludcmp.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-
-static
-void init_array (int n,
- int A[ 40 + 0][40 + 0],
- int b[ 40 + 0],
- int x[ 40 + 0],
- int y[ 40 + 0])
-{
- int i, j;
- int ONE = 1;
- int TWO = 2;
- int FOUR = 4;
- int fn = (int)n;
-
- for (i = 0; i < n; plus(i))
- {
- x[i] = 0;
- y[i] = 0;
- b[i] = (i+ONE)/fn/(TWO) + (FOUR);
- }
-
- for (i = 0; i < n; plus(i))
- {
- for (j = 0; j <= i; plus(j))
- A[i][j] = (int)(-j % n) / n + ONE;
- for (j = i+ONE; j < n; plus(j)) {
- A[i][j] = 0;
- }
- A[i][i] = 1;
- }
-
-
-
- int r,s,t;
- int B[40 + 0][40 + 0];
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- B[r][s] = 0;
- for (t = 0; t < n; plus(t))
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- B[r][s] += A[r][t] * A[s][t];
- for (r = 0; r < n; plus(r))
- for (s = 0; s < n; plus(s))
- A[r][s] = B[r][s];
-
-}
-
-
-
-
-static
-int check_array(int n,
- int x[ 40 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- res += x[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_ludcmp(int n,
- int A[ 40 + 0][40 + 0],
- int b[ 40 + 0],
- int x[ 40 + 0],
- int y[ 40 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
- int w;
-
-#pragma scop
- for (i = 0; i < n; plus(i)) {
- for (j = 0; j <i; plus(j)) {
- w = A[i][j];
- for (k = 0; k < j; plus(k)) {
- w -= A[i][k] * A[k][j];
- }
- A[i][j] = w / A[j][j];
- }
- for (j = i; j < n; plus(j)) {
- w = A[i][j];
- for (k = 0; k < i; plus(k)) {
- w -= A[i][k] * A[k][j];
- }
- A[i][j] = w;
- }
- }
-
- for (i = 0; i < n; plus(i)) {
- w = b[i];
- for (j = 0; j < i; plus(j))
- w -= A[i][j] * y[j];
- y[i] = w;
- }
-
- for (i = n-ONE; i >=0; i=i-ONE) {
- w = y[i];
- for (j = i+ONE; j < n; plus(j))
- w -= A[i][j] * x[j];
- x[i] = w / A[i][i];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 40;
- int ONE = 1;
-
-
- int A[40 + 0][40 + 0];
- int b[40 + 0];
- int x[40 + 0];
- int y[40 + 0];
-
-
-
- init_array (n,
- A,
- b,
- x,
- y);
-
-
- ;
-
-
- kernel_ludcmp (n,
- A,
- b,
- x,
- y);
-
- return check_array(n, x);
-
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c b/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
deleted file mode 100644
index 5e760e6..0000000
--- a/benchmarks/polybench-syn/linear-algebra/solvers/trisolv.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* trisolv.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array(int n,
- int L[ 40 ][40 ],
- int x[ 40 ],
- int b[ 40 ])
-{
- int i, j;
- int ONE = 1;
-
- for (i = 0; i < n; plus(i))
- {
- x[i] = - 999;
- b[i] = i ;
- for (j = 0; j <= i; plus(j))
- L[i][j] = (int) (i+n-j+ONE)*(ONE+ONE)/n;
- }
-}
-
-
-
-
-static
-int check_array(int n,
- int x[ 40])
-
-{
- int i;
- int res = 0;
- int ONE = 1;
- for (i = 0; i < n; plus(i)) {
- res += x[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_trisolv(int n,
- int L[ 40 + 0][40 + 0],
- int x[ 40 + 0],
- int b[ 40 + 0])
-{
- int i, j;
- int ONE = 1;
-
-#pragma scop
- for (i = 0; i < n; plus(i))
- {
- x[i] = b[i];
- for (j = 0; j <i; plus(j))
- x[i] -= L[i][j] * x[j];
- x[i] = x[i] / L[i][i];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 40;
-
-
- int L[40 + 0][40 + 0];
- int x[40 + 0];
- int b[40 + 0];
-
- init_array (n, L, x, b);
- kernel_trisolv (n, L, x, b);
-
- return check_array(n, x);
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/medley/floyd-warshall.c b/benchmarks/polybench-syn/medley/floyd-warshall.c
deleted file mode 100644
index 46f6774..0000000
--- a/benchmarks/polybench-syn/medley/floyd-warshall.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* floyd-warshall.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int path[ 60 + 0][60 + 0])
-{
- int i, j;
- int ONE = 1;
- int N7 = 7;
- int N11 = 11;
- int N13 = 13;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- path[i][j] = i*j%N7+ONE;
- if ((i+j)%N13 == 0 || (i+j)%N7==0 || (i+j)%N11 == 0)
- path[i][j] = 999;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int path[ 60 + 0][60 + 0])
-
-{
- int i, j;
- int res = 0;
- int ONE = 1;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= path[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_floyd_warshall(int n,
- int path[ 60 + 0][60 + 0])
-{
- int i, j, k;
- int ONE = 1;
-
-#pragma scop
- for (k = 0; k < n; plus(k))
- {
- for(i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- path[i][j] = path[i][j] < path[i][k] + path[k][j] ?
- path[i][j] : path[i][k] + path[k][j];
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 60;
-
-
- int path[60 + 0][60 + 0];
-
- init_array (n, path);
-
- kernel_floyd_warshall (n, path);
-
- return print_array(n, path);
-
- return 0;
-}
diff --git a/benchmarks/polybench-syn/medley/nussinov.c b/benchmarks/polybench-syn/medley/nussinov.c
deleted file mode 100644
index fd33ec4..0000000
--- a/benchmarks/polybench-syn/medley/nussinov.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* nussinov.c: this file is part of PolyBench/C */
-
-typedef int base;
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- base seq[ 60 + 0],
- int table[ 60 + 0][60 + 0])
-{
- int i, j;
- int ONE = 1;
-
-
- for (i=0; i <n; plus(i)) {
- seq[i] = (base)((i+ONE)%4);
- }
-
- for (i=0; i <n; plus(i))
- for (j=0; j <n; plus(j))
- table[i][j] = 0;
-}
-
-
-
-
-static
-int print_array(int n,
- int table[ 60 + 0][60 + 0])
-
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i)) {
- for (j = i; j < n; plus(j)) {
- res ^= table[i][j];
- }
- }
- return res;
-}
-
-static
-void kernel_nussinov(int n, base seq[ 60 + 0],
- int table[ 60 + 0][60 + 0])
-{
- int i, j, k;
- int ONE = 1;
- int THREE = 3;
-
-#pragma scop
- for (i = n-ONE; i >= 0; i=i-ONE) {
- for (j=i+ONE; j<n; plus(j)) {
-
- if (j-ONE>=0)
- table[i][j] = ((table[i][j] >= table[i][j-ONE]) ? table[i][j] : table[i][j-ONE]);
- if (i+ONE<n)
- table[i][j] = ((table[i][j] >= table[i+ONE][j]) ? table[i][j] : table[i+ONE][j]);
-
- if (j-ONE>=0 && i+ONE<n) {
-
- if (i<j-ONE)
- table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0));
- else
- table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]) ? table[i][j] : table[i+ONE][j-ONE]);
- }
-
- for (k=i+ONE; k<j; plus(k)) {
- table[i][j] = ((table[i][j] >= table[i][k] + table[k+ONE][j]) ? table[i][j] : table[i][k] + table[k+ONE][j]);
- }
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 60;
-
-
- base (seq)[60 + 0];
- int (table)[60 + 0][60 + 0];
-
-
- init_array (n, seq, table);
-
- kernel_nussinov (n, seq, table);
-
- return print_array(n, table);
-
-}
diff --git a/benchmarks/polybench-syn/stencils/adi.c b/benchmarks/polybench-syn/stencils/adi.c
deleted file mode 100644
index cc54e11..0000000
--- a/benchmarks/polybench-syn/stencils/adi.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* adi.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int u[ 20 + 0][20 + 0])
-{
- int i, j;
-
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++)
- {
- u[i][j] = (int)(i + n-j) / n;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int u[ 20 + 0][20 + 0])
-
-{
- int i, j;
- int res = 0;
-
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++) {
- res ^= u[i][j];
- }
- return res;
-}
-static
-void kernel_adi(int tsteps, int n,
- int u[ 20 + 0][20 + 0],
- int v[ 20 + 0][20 + 0],
- int p[ 20 + 0][20 + 0],
- int q[ 20 + 0][20 + 0])
-{
- int t, i, j;
- int DX, DY, DT;
- int B1, B2;
- int mul1, mul2;
- int a, b, c, d, e, f;
-
-#pragma scop
-
- DX = 1/(int)n;
- DY = 1/(int)n;
- DT = 1/(int)tsteps;
- B1 = 2;
- B2 = 1;
- mul1 = B1 * DT / (DX * DX);
- mul2 = B2 * DT / (DY * DY);
-
- a = -mul1 / 2;
- b = 1+mul1;
- c = a;
- d = -mul2 / 2;
- e = 1+mul2;
- f = d;
-
- for (t=1; t<=tsteps; t++) {
-
- for (i=1; i<n-1; i++) {
- v[0][i] = 1;
- p[i][0] = 0;
- q[i][0] = v[0][i];
- for (j=1; j<n-1; j++) {
- p[i][j] = -c / (a*p[i][j-1]+b);
- q[i][j] = (-d*u[j][i-1]+(1+2*d)*u[j][i] - f*u[j][i+1]-a*q[i][j-1])/(a*p[i][j-1]+b);
- }
-
- v[n-1][i] = 1;
- for (j=n-2; j>=1; j--) {
- v[j][i] = p[i][j] * v[j+1][i] + q[i][j];
- }
- }
-
- for (i=1; i<n-1; i++) {
- u[i][0] = 1;
- p[i][0] = 0;
- q[i][0] = u[i][0];
- for (j=1; j<n-1; j++) {
- p[i][j] = -f / (d*p[i][j-1]+e);
- q[i][j] = (-a*v[i-1][j]+(1+2*a)*v[i][j] - c*v[i+1][j]-d*q[i][j-1])/(d*p[i][j-1]+e);
- }
- u[i][n-1] = 1;
- for (j=n-2; j>=1; j--) {
- u[i][j] = p[i][j] * u[i][j+1] + q[i][j];
- }
- }
- }
-#pragma endscop
-}
-
-
-int main(int argc, char** argv)
-{
-
- int n = 20;
- int tsteps = 20;
-
-
- int u[20 + 0][20 + 0];
- int v[20 + 0][20 + 0];
- int p[20 + 0][20 + 0];
- int q[20 + 0][20 + 0];
-
-
-
- init_array (n, u);
-
- kernel_adi (tsteps, n, u, v, p, q);
-
- return print_array(n, u);
-
-}
diff --git a/benchmarks/polybench-syn/stencils/fdtd-2d.c b/benchmarks/polybench-syn/stencils/fdtd-2d.c
deleted file mode 100644
index cee6b03..0000000
--- a/benchmarks/polybench-syn/stencils/fdtd-2d.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* fdtd-2d.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int tmax,
- int nx,
- int ny,
- int ex[ 20 + 0][30 + 0],
- int ey[ 20 + 0][30 + 0],
- int hz[ 20 + 0][30 + 0],
- int _fict_[ 20 + 0])
-{
- int i, j;
- int ONE = 1;
- int TWO = 1;
- int THREE = 1;
-
- for (i = 0; i < tmax; plus(i))
- _fict_[i] = (int) i;
- for (i = 0; i < nx; plus(i))
- for (j = 0; j < ny; plus(j))
- {
- ex[i][j] = ((int) i*(j+ONE)) / nx;
- ey[i][j] = ((int) i*(j+TWO)) / ny;
- hz[i][j] = ((int) i*(j+THREE)) / nx;
- }
-
-}
-
-
-
-
-static
-int print_array(int nx,
- int ny,
- int ex[ 20 + 0][30 + 0],
- int ey[ 20 + 0][30 + 0],
- int hz[ 20 + 0][30 + 0])
-{
- int i, j;
- int res = 0;
- int ONE = 1;
-
- for (i = 0; i < nx; plus(i))
- for (j = 0; j < ny; plus(j)) {
- res ^= ex[i][j];
- }
- for (i = 0; i < nx; plus(i))
- for (j = 0; j < ny; plus(j)) {
- res ^= ey[i][j];
- }
- for (i = 0; i < nx; plus(i))
- for (j = 0; j < ny; plus(j)) {
- res ^= hz[i][j];
- }
-
- return res;
-}
-
-
-static
-void kernel_fdtd_2d(int tmax,
- int nx,
- int ny,
- int ex[ 20 + 0][30 + 0],
- int ey[ 20 + 0][30 + 0],
- int hz[ 20 + 0][30 + 0],
- int _fict_[ 20 + 0])
-{
- int t, i, j;
- int ONE = 1;
-
-#pragma scop
-
- for(t = 0; t < tmax; t=t+ONE)
- {
- for (j = 0; j < ny; plus(j))
- ey[0][j] = _fict_[t];
- for (i = 1; i < nx; plus(i))
- for (j = 0; j < ny; plus(j))
- ey[i][j] = ey[i][j] - ((hz[i][j]-(hz[i-ONE][j])>>1));
- for (i = 0; i < nx; plus(i))
- for (j = 1; j < ny; plus(j))
- ex[i][j] = ex[i][j] - ((hz[i][j]-(hz[i][j-ONE])>>1));
- for (i = 0; i < nx - ONE; plus(i))
- for (j = 0; j < ny - ONE; plus(j)){
- int tmp = (ex[i][j+ONE] - ex[i][j] +
- ey[i+ONE][j] - ey[i][j]);
- hz[i][j] = hz[i][j] - tmp >> 1 - tmp >> 2;
- }
- }
-
-#pragma endscop
-}
-
-
-int main()
-{
-
- int tmax = 20;
- int nx = 20;
- int ny = 30;
-
-
- int ex[20 + 0][30 + 0];
- int ey[20 + 0][30 + 0];
- int hz[20 + 0][30 + 0];
- int _fict_[20 + 0];
-
- init_array (tmax, nx, ny,
- ex,
- ey,
- hz,
- _fict_);
- kernel_fdtd_2d (tmax, nx, ny,
- ex,
- ey,
- hz,
- _fict_);
-
- return print_array(nx, ny, ex, ey, hz);
-}
diff --git a/benchmarks/polybench-syn/stencils/heat-3d.c b/benchmarks/polybench-syn/stencils/heat-3d.c
deleted file mode 100644
index 6529e8b..0000000
--- a/benchmarks/polybench-syn/stencils/heat-3d.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* heat-3d.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int A[ 10 + 0][10 + 0][10 + 0],
- int B[ 10 + 0][10 + 0][10 + 0])
-{
- int i, j, k;
- int ONE = 1;
- int TEN = 10;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- for (k = 0; k < n; plus(k))
- A[i][j][k] = B[i][j][k] = (int) (i + j + (n-k))* TEN / (n);
-}
-
-
-
-
-static
-int print_array(int n,
- int A[ 10 + 0][10 + 0][10 + 0])
-
-{
- int i, j, k;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- for (k = 0; k < n; plus(k)) {
- res ^= A[i][j][k];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_heat_3d(int tsteps,
- int n,
- int A[ 10 + 0][10 + 0][10 + 0],
- int B[ 10 + 0][10 + 0][10 + 0])
-{
- int t, i, j, k;
- int ONE = 1;
- int TWO = 2;
- int FOUR = 4;
-
-#pragma scop
- for (t = 1; t <= 5; plus(t)) {
- for (i = 1; i < n-ONE; plus(i)) {
- for (j = 1; j < n-ONE; plus(j)) {
- for (k = 1; k < n-ONE; plus(k)) {
- B[i][j][k] = (A[i+ONE][j][k] - TWO * A[i][j][k] + A[i-ONE][j][k]) >> FOUR
- + (A[i][j+ONE][k] - TWO * A[i][j][k] + A[i][j-ONE][k]) >> 4
- + (A[i][j][k+ONE] - TWO * A[i][j][k] + A[i][j][k-ONE]) >> 4
- + A[i][j][k]
- ;
- }
- }
- }
- for (i = 1; i < n-ONE; plus(i)) {
- for (j = 1; j < n-ONE; plus(j)) {
- for (k = 1; k < n-ONE; plus(k)) {
- A[i][j][k] = (B[i+ONE][j][k] - TWO * B[i][j][k] + B[i-ONE][j][k]) >> 4
- + (B[i][j+ONE][k] - TWO * B[i][j][k] + B[i][j-ONE][k]) >> 4
- + (B[i][j][k+ONE] - TWO * B[i][j][k] + B[i][j][k-ONE]) >> 4
- + B[i][j][k];
- //;
- }
- }
- }
- }
-#pragma endscop
-}
-
-
-int main()
-{
-
- int n = 10;
- int tsteps = 20;
-
-
- int A[10 + 0][10 + 0][10 + 0];
- int B[10 + 0][10 + 0][10 + 0];
-
- init_array (n, A, B);
-
- kernel_heat_3d (tsteps, n, A, B);
-
- return print_array(n, A);
-
-}
diff --git a/benchmarks/polybench-syn/stencils/jacobi-1d.c b/benchmarks/polybench-syn/stencils/jacobi-1d.c
deleted file mode 100644
index 1c3cf79..0000000
--- a/benchmarks/polybench-syn/stencils/jacobi-1d.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* jacobi-1d.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int A[ 30 + 0],
- int B[ 30 + 0])
-{
- int i;
- int ONE = 1;
- int TWO = 2;
- int THREE = 3;
-
- for (i = 0; i < n; plus(i))
- {
- A[i] = ((int) i+TWO) / n;
- B[i] = ((int) i+THREE) / n;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int A[ 30 + 0])
-
-{
- int i;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- {
- res ^= A[i];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_jacobi_1d(int tsteps,
- int n,
- int A[ 30 + 0],
- int B[ 30 + 0])
-{
- int t, i;
- int ONE = 1;
-
-#pragma scop
- for (t = 0; t < tsteps; plus(t))
- {
- for (i = 1; i < n - ONE; plus(i)){
- B[i] = (A[i-ONE] + A[i] + A[i + ONE]);
- B[i] = B[i] >> 2;
- }
- for (i = 1; i < n - ONE; plus(i)){
- A[i] = (B[i-ONE] + B[i] + B[i + ONE]);
- A[i] = A[i] >> 2;
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 30;
- int tsteps = 20;
-
-
- int A[30 + 0];
- int B[30 + 0];
-
-
-
- init_array (n, A, B);
-
- kernel_jacobi_1d(tsteps, n, A, B);
-
- return print_array(n, A);
-
-}
diff --git a/benchmarks/polybench-syn/stencils/jacobi-2d.c b/benchmarks/polybench-syn/stencils/jacobi-2d.c
deleted file mode 100644
index 3a5b43c..0000000
--- a/benchmarks/polybench-syn/stencils/jacobi-2d.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* jacobi-2d.c: this file is part of PolyBench/C */
-
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int A[ 30 + 0][30 + 0],
- int B[ 30 + 0][30 + 0])
-{
- int i, j;
- int ONE = 1;
- int TWO = 2;
- int THREE = 3;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- {
- A[i][j] = ((int) i*(j+TWO) + TWO) / n;
- B[i][j] = ((int) i*(j+THREE) + THREE) / n;
- }
-}
-
-
-
-
-static
-int print_array(int n,
- int A[ 30 + 0][30 + 0])
-
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= A[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_jacobi_2d(int tsteps,
- int n,
- int A[ 30 + 0][30 + 0],
- int B[ 30 + 0][30 + 0])
-{
- int t, i, j;
- int ONE = 1;
- int TWO = 2;
-
-#pragma scop
- for (t = 0; t < tsteps; plus(t))
- {
- for (i = 1; i < n - ONE; plus(i))
- for (j = 1; j < n - ONE; plus(j)){
- B[i][j] = (A[i][j] + A[i][j-ONE] + A[i][ONE+j] + A[ONE+i][j] + A[i-ONE][j]);
- B[i][j] = B[i][j] >> TWO;
- }
- for (i = 1; i < n - ONE; plus(i))
- for (j = 1; j < n - ONE; plus(j)){
- A[i][j] = (B[i][j] + B[i][j-ONE] + B[i][ONE+j] + B[ONE+i][j] + B[i-ONE][j]);
- A[i][j] = A[i][j] >> TWO;
- }
- }
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 30;
- int tsteps = 5;
-
-
- int A[30 + 0][30 + 0];
- int B[30 + 0][30 + 0];
-
-
-
- init_array (n, A, B);
-
- kernel_jacobi_2d(tsteps, n, A, B);
-
- return print_array(n, A);
-
-}
diff --git a/benchmarks/polybench-syn/stencils/seidel-2d.c b/benchmarks/polybench-syn/stencils/seidel-2d.c
deleted file mode 100644
index d4c7f98..0000000
--- a/benchmarks/polybench-syn/stencils/seidel-2d.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * This version is stamped on May 10, 2016
- *
- * Contact:
- * Louis-Noel Pouchet <pouchet.ohio-state.edu>
- * Tomofumi Yuki <tomofumi.yuki.fr>
- *
- * Web address: http://polybench.sourceforge.net
- */
-/* seidel-2d.c: this file is part of PolyBench/C */
-
-#define plus(i) i = i + ONE
-static
-void init_array (int n,
- int A[ 40 + 0][40 + 0])
-{
- int i, j;
- int ONE = 1;
- int TWO = 2;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j))
- A[i][j] = ((int) i*(j+TWO) + TWO) / n;
-}
-
-
-
-
-static
-int print_array(int n,
- int A[ 40 + 0][40 + 0])
-
-{
- int i, j;
- int ONE = 1;
- int res = 0;
-
- for (i = 0; i < n; plus(i))
- for (j = 0; j < n; plus(j)) {
- res ^= A[i][j];
- }
- return res;
-}
-
-
-
-
-static
-void kernel_seidel_2d(int tsteps,
- int n,
- int A[ 40 + 0][40 + 0])
-{
- int t, i, j;
- int ONE = 1;
- int TWO = 2;
- int NINE = 9;
-
-#pragma scop
- for (t = 0; t <= tsteps - ONE; plus(t))
- for (i = ONE; i<= n - TWO; plus(i))
- for (j = ONE; j <= n - TWO; plus(j))
- A[i][j] = (A[i-ONE][j-ONE] + A[i-ONE][j] + A[i-ONE][j+ONE]
- + A[i][j-ONE] + A[i][j] + A[i][j+ONE]
- + A[i+ONE][j-ONE] + A[i+ONE][j] + A[i+ONE][j+ONE])/NINE;
-#pragma endscop
-
-}
-
-
-int main()
-{
-
- int n = 40;
- int tsteps = 5;
-
-
- int A[40 + 0][40 + 0];
-
- init_array (n, A);
-
- kernel_seidel_2d (tsteps, n, A);
-
- return print_array(n, A);
-
-}
diff --git a/benchmarks/unit-tests/shr.c b/benchmarks/unit-tests/shr.c
deleted file mode 100644
index e63e2fd..0000000
--- a/benchmarks/unit-tests/shr.c
+++ /dev/null
@@ -1,11 +0,0 @@
-
-int main (){
-
- int input = -1024;
- unsigned int shift = 5;
- //printf("Before %d\n", input);
- input >>= shift;
- //printf("After %ud\n", input);
- return input;
-
-}
diff --git a/debug/CoqupTest.ml b/debug/CoqupTest.ml
index f961f64..2fe1389 100644
--- a/debug/CoqupTest.ml
+++ b/debug/CoqupTest.ml
@@ -1,4 +1,4 @@
-open Coqup
+open Vericert
open Test
open Camlcoq
diff --git a/debug/dune b/debug/dune
index 7f0c6a6..feee97c 100644
--- a/debug/dune
+++ b/debug/dune
@@ -1,5 +1,5 @@
(include_subdirs no)
(executable
- (name CoqupTest)
- (libraries coqup))
+ (name VericertTest)
+ (libraries vericert))
diff --git a/default.nix b/default.nix
index cd37308..a253285 100644
--- a/default.nix
+++ b/default.nix
@@ -25,7 +25,7 @@ let
} ) { };
in
stdenv.mkDerivation {
- name = "coqup";
+ name = "vericert";
src = ./.;
buildInputs = [ ncoq ocamlPackages.menhir dune
diff --git a/driver/CoqupDriver.ml b/driver/CoqupDriver.ml
index 0b64f48..f500499 100644
--- a/driver/CoqupDriver.ml
+++ b/driver/CoqupDriver.ml
@@ -9,7 +9,7 @@
(* under the terms of the INRIA Non-Commercial License Agreement. *)
(* *)
(* *********************************************************************)
-(* CoqUp: Verified high-level synthesis.
+(* Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -27,16 +27,16 @@
*)
open Printf
-open Coqup.Commandline
-open Coqup.Clflags
-open Coqup.CommonOptions
-open Coqup.Timing
-open Coqup.Driveraux
-open Coqup.Frontend
-open Coqup.Assembler
-open Coqup.Linker
-open Coqup.Diagnostics
-open Coqup.CoqupClflags
+open Vericert.Commandline
+open Vericert.Clflags
+open Vericert.CommonOptions
+open Vericert.Timing
+open Vericert.Driveraux
+open Vericert.Frontend
+open Vericert.Assembler
+open Vericert.Linker
+open Vericert.Diagnostics
+open Vericert.VericertClflags
(* Name used for version string etc. *)
let tool_name = "C verified high-level synthesis"
@@ -60,45 +60,45 @@ let compile_c_file sourcename ifile ofile =
let set_dest dst opt ext =
dst := if !opt then Some (output_filename sourcename ".c" ext)
else None in
- set_dest Coqup.Cprint.destination option_dparse ".parsed.c";
- set_dest Coqup.PrintCsyntax.destination option_dcmedium ".compcert.c";
- set_dest Coqup.PrintClight.destination option_dclight ".light.c";
- set_dest Coqup.PrintCminor.destination option_dcminor ".cm";
- set_dest Coqup.PrintRTL.destination option_drtl ".rtl";
- set_dest Coqup.PrintHTL.destination option_dhtl ".htl";
- set_dest Coqup.Regalloc.destination_alloctrace option_dalloctrace ".alloctrace";
- set_dest Coqup.PrintLTL.destination option_dltl ".ltl";
- set_dest Coqup.PrintMach.destination option_dmach ".mach";
- set_dest Coqup.AsmToJSON.destination option_sdump !sdump_suffix;
+ set_dest Vericert.Cprint.destination option_dparse ".parsed.c";
+ set_dest Vericert.PrintCsyntax.destination option_dcmedium ".compcert.c";
+ set_dest Vericert.PrintClight.destination option_dclight ".light.c";
+ set_dest Vericert.PrintCminor.destination option_dcminor ".cm";
+ set_dest Vericert.PrintRTL.destination option_drtl ".rtl";
+ set_dest Vericert.PrintHTL.destination option_dhtl ".htl";
+ set_dest Vericert.Regalloc.destination_alloctrace option_dalloctrace ".alloctrace";
+ set_dest Vericert.PrintLTL.destination option_dltl ".ltl";
+ set_dest Vericert.PrintMach.destination option_dmach ".mach";
+ set_dest Vericert.AsmToJSON.destination option_sdump !sdump_suffix;
(* Parse the ast *)
let csyntax = parse_c_file sourcename ifile in
if not !option_hls then begin
(* Convert to Asm *)
let asm =
- match Coqup.Compiler.apply_partial
- (Coqup.Compiler.transf_c_program csyntax)
- Coqup.Asmexpand.expand_program with
- | Coqup.Errors.OK asm ->
+ match Vericert.Compiler.apply_partial
+ (Vericert.Compiler.transf_c_program csyntax)
+ Vericert.Asmexpand.expand_program with
+ | Vericert.Errors.OK asm ->
asm
- | Coqup.Errors.Error msg ->
+ | Vericert.Errors.Error msg ->
let loc = file_loc sourcename in
fatal_error loc "%a" print_error msg in
(* Dump Asm in binary and JSON format *)
- Coqup.AsmToJSON.print_if asm sourcename;
+ Vericert.AsmToJSON.print_if asm sourcename;
(* Print Asm in text form *)
let oc = open_out ofile in
- Coqup.PrintAsm.print_program oc asm;
+ Vericert.PrintAsm.print_program oc asm;
close_out oc
end else begin
let verilog =
- match Coqup.Compiler0.transf_hls csyntax with
- | Coqup.Errors.OK v ->
+ match Vericert.Compiler0.transf_hls csyntax with
+ | Vericert.Errors.OK v ->
v
- | Coqup.Errors.Error msg ->
+ | Vericert.Errors.Error msg ->
let loc = file_loc sourcename in
fatal_error loc "%a" print_error msg in
let oc = open_out ofile in
- Coqup.PrintVerilog.print_program !option_debug_hls oc verilog;
+ Vericert.PrintVerilog.print_program !option_debug_hls oc verilog;
close_out oc
end
@@ -106,9 +106,9 @@ let compile_c_file sourcename ifile ofile =
let compile_i_file sourcename preproname =
if !option_interp then begin
- Coqup.Machine.config := Coqup.Machine.compcert_interpreter !Coqup.Machine.config;
+ Vericert.Machine.config := Vericert.Machine.compcert_interpreter !Vericert.Machine.config;
let csyntax = parse_c_file sourcename preproname in
- Coqup.Interp.execute csyntax;
+ Vericert.Interp.execute csyntax;
""
end else if !option_hls then begin
compile_c_file sourcename preproname
@@ -179,7 +179,7 @@ let process_h_file sourcename =
fatal_error no_loc "input file %s ignored (not in -E mode)\n" sourcename
let target_help =
- if Coqup.Configuration.arch = "arm" && Coqup.Configuration.model <> "armv6" then
+ if Vericert.Configuration.arch = "arm" && Vericert.Configuration.model <> "armv6" then
{|Target processor options:
-mthumb Use Thumb2 instruction encoding
-marm Use classic ARM instruction encoding
@@ -188,7 +188,7 @@ else
""
let toolchain_help =
- if not Coqup.Configuration.gnu_toolchain then begin
+ if not Vericert.Configuration.gnu_toolchain then begin
{|Toolchain options:
-t tof:env Select target processor for the diab toolchain
|} end else
@@ -216,7 +216,7 @@ Processing options:
|} ^
prepro_help ^
language_support_help ^
- Coqup.DebugInit.debugging_help ^
+ Vericert.DebugInit.debugging_help ^
{|Optimization options: (use -fno-<opt> to turn off -f<opt>)
-O Optimize the compiled code [on by default]
-O0 Do not optimize the compiled code
@@ -263,7 +263,7 @@ Code generation options: (use -fno-<opt> to turn off -f<opt>)
|} ^
general_help ^
warning_help ^
- {|Coqup.Interpreter mode:
+ {|Vericert.Interpreter mode:
-interp Execute given .c files using the reference interpreter
-quiet Suppress diagnostic messages for the interpreter
-trace Have the interpreter produce a detailed trace of reductions
@@ -275,7 +275,7 @@ let print_usage_and_exit () =
printf "%s" usage_string; exit 0
let enforce_buildnr nr =
- let build = int_of_string Coqup.Version.buildnr in
+ let build = int_of_string Vericert.Version.buildnr in
if nr != build then
fatal_error no_loc "Mismatching builds: This is CompCert build %d, but QSK requires build %d.\n\
Please use matching builds of QSK and CompCert." build nr
@@ -283,7 +283,7 @@ Please use matching builds of QSK and CompCert." build nr
let dump_mnemonics destfile =
let oc = open_out_bin destfile in
let pp = Format.formatter_of_out_channel oc in
- Coqup.AsmToJSON.pp_mnemonics pp;
+ Vericert.AsmToJSON.pp_mnemonics pp;
Format.pp_print_flush pp ();
close_out oc;
exit 0
@@ -320,7 +320,7 @@ let cmdline_actions =
(* Getting version info *)
@ version_options tool_name @
(* Enforcing CompCert build numbers for QSKs and mnemonics dump *)
- (if Coqup.Version.buildnr <> "" then
+ (if Vericert.Version.buildnr <> "" then
[ Exact "-qsk-enforce-build", Integer enforce_buildnr;
Exact "--qsk-enforce-build", Integer enforce_buildnr;
Exact "-dump-mnemonics", String dump_mnemonics;
@@ -338,7 +338,7 @@ let cmdline_actions =
(* Language support options *)
language_support_options
(* Debugging options *)
- @ Coqup.DebugInit.debugging_actions @
+ @ Vericert.DebugInit.debugging_actions @
(* Code generation options -- more below *)
[
Exact "-O0", Unit (unset_all optimization_options);
@@ -354,15 +354,15 @@ let cmdline_actions =
Exact "-falign-cond-branches", Integer(fun n -> check_align n; option_faligncondbranchs := n);] @
f_opt "common" option_fcommon @
(* Target processor options *)
- (if Coqup.Configuration.arch = "arm" then
- if Coqup.Configuration.model = "armv6" then
+ (if Vericert.Configuration.arch = "arm" then
+ if Vericert.Configuration.model = "armv6" then
[ Exact "-marm", Ignore ] (* Thumb needs ARMv6T2 or ARMv7 *)
else
[ Exact "-mthumb", Set option_mthumb;
Exact "-marm", Unset option_mthumb; ]
else []) @
(* Toolchain options *)
- (if not Coqup.Configuration.gnu_toolchain then
+ (if not Vericert.Configuration.gnu_toolchain then
[Exact "-t", String (fun arg -> push_linker_arg "-t"; push_linker_arg arg;
prepro_options := arg :: "-t" :: !prepro_options;
assembler_options := arg :: "-t" :: !assembler_options;)]
@@ -398,17 +398,17 @@ let cmdline_actions =
option_dasm := true);
Exact "-sdump", Set option_sdump;
Exact "-sdump-suffix", String (fun s -> option_sdump := true; sdump_suffix:= s);
- Exact "-sdump-folder", String (fun s -> Coqup.AsmToJSON.sdump_folder := s);] @
+ Exact "-sdump-folder", String (fun s -> Vericert.AsmToJSON.sdump_folder := s);] @
(* General options *)
general_options @
(* Diagnostic options *)
warning_options @
-(* Coqup.Interpreter mode *)
+(* Vericert.Interpreter mode *)
[ Exact "-interp", Set option_interp;
- Exact "-quiet", Unit (fun () -> Coqup.Interp.trace := 0);
- Exact "-trace", Unit (fun () -> Coqup.Interp.trace := 2);
- Exact "-random", Unit (fun () -> Coqup.Interp.mode := Coqup.Interp.Random);
- Exact "-all", Unit (fun () -> Coqup.Interp.mode := Coqup.Interp.All)
+ Exact "-quiet", Unit (fun () -> Vericert.Interp.trace := 0);
+ Exact "-trace", Unit (fun () -> Vericert.Interp.trace := 2);
+ Exact "-random", Unit (fun () -> Vericert.Interp.mode := Vericert.Interp.Random);
+ Exact "-all", Unit (fun () -> Vericert.Interp.mode := Vericert.Interp.All)
]
(* Optimization options *)
(* -f options: come in -f and -fno- variants *)
@@ -456,9 +456,9 @@ let _ =
Gc.major_heap_increment = 4194304 (* 4M *)
};
Printexc.record_backtrace true;
- Coqup.Frontend.init ();
+ Vericert.Frontend.init ();
parse_cmdline cmdline_actions;
- Coqup.DebugInit.init (); (* Initialize the debug functions *)
+ Vericert.DebugInit.init (); (* Initialize the debug functions *)
if nolink () && !option_o <> None && !num_source_files >= 2 then
fatal_error no_loc "ambiguous '-o' option (multiple source files)";
if !num_input_files = 0 then
diff --git a/driver/dune b/driver/dune
index 5dbfcad..b0c97bc 100644
--- a/driver/dune
+++ b/driver/dune
@@ -1,5 +1,5 @@
(include_subdirs no)
(executable
- (name CoqupDriver)
- (libraries coqup))
+ (name VericertDriver)
+ (libraries vericert))
diff --git a/dune b/dune
index 020ec08..92ac822 100644
--- a/dune
+++ b/dune
@@ -4,7 +4,7 @@
(include_subdirs unqualified)
(library
- (public_name coqup)
+ (public_name vericert)
(modules_without_implementation c debugTypes dwarfTypes)
(libraries menhirLib str unix)
(flags (:standard -warn-error -A)))
diff --git a/scripts/quartus_synth.tcl b/scripts/quartus_synth.tcl
deleted file mode 100644
index 971acc6..0000000
--- a/scripts/quartus_synth.tcl
+++ /dev/null
@@ -1,28 +0,0 @@
-# PRiME pre-KAPow kernel flow
-# Performs pre-KAPow run steps for instrumenting arbitrary Verilog for power monitoring
-# James Davis, 2015
-
-load_package flow
-
-cd kernel
-
-project_new kernel
-set_global_assignment -name FAMILY "Cyclone 10 GX"
-set_global_assignment -name SYSTEMVERILOG_FILE kernel.v
-set_global_assignment -name TOP_LEVEL_ENTITY top
-set_global_assignment -name INI_VARS "qatm_force_vqm=on;"
-set_instance_assignment -name VIRTUAL_PIN ON -to *
-
-execute_module -tool map
-
-execute_module -tool fit
-
-execute_module -tool eda -args "--simulation --tool=vcs"
-
-# set_global_assignment -name POWER_OUTPUT_SAF_NAME ${kernel}.asf
-# set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE "12.5 %"
-# set_global_assignment -name POWER_REPORT_SIGNAL_ACTIVITY ON
-# set_global_assignment -name POWER_REPORT_POWER_DISSIPATION ON
-# execute_module -tool pow
-
-project_close
diff --git a/src/Compiler.v b/src/Compiler.v
index 8820f14..7b17336 100644
--- a/src/Compiler.v
+++ b/src/Compiler.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*)
-From coqup Require Import HTLgenproof.
+From vericert Require Import HTLgenproof.
From compcert.common Require Import
Errors
@@ -47,7 +47,7 @@ From compcert.cfrontend Require
From compcert.driver Require
Compiler.
-From coqup Require
+From vericert Require
Verilog
Veriloggen
Veriloggenproof
@@ -82,19 +82,14 @@ Qed.
Definition transf_backend (r : RTL.program) : res Verilog.program :=
OK r
- @@ Tailcall.transf_program
@@@ Inlining.transf_program
- @@ Renumber.transf_program
- (* @@ Constprop.transf_program *)
- @@ Renumber.transf_program
- @@@ CSE.transf_program
- @@@ Deadcode.transf_program
- @@@ Unusedglob.transform_program
@@ print (print_RTL 1)
@@@ HTLgen.transl_program
@@ print print_HTL
@@ Veriloggen.transl_program.
+Check mkpass.
+
Definition transf_hls (p : Csyntax.program) : res Verilog.program :=
OK p
@@@ SimplExpr.transl_program
@@ -151,8 +146,8 @@ Proof.
exists p7; split. apply Inliningproof.transf_program_match; auto.
exists p8; split. apply HTLgenproof.transf_program_match; auto.
exists p9; split. apply Veriloggenproof.transf_program_match; auto.
- (* inv T. reflexivity. *)
-Admitted.
+ inv T. reflexivity.
+Qed.
Remark forward_simulation_identity:
forall sem, forward_simulation sem sem.
diff --git a/src/CoqupClflags.ml b/src/CoqupClflags.ml
index 5b40ce6..ca591de 100644
--- a/src/CoqupClflags.ml
+++ b/src/CoqupClflags.ml
@@ -1,4 +1,4 @@
-(* Coqup flags *)
+(* Vericert flags *)
let option_simulate = ref false
let option_hls = ref true
let option_debug_hls = ref false
diff --git a/src/Simulator.v b/src/Simulator.v
index 83d3e96..3df0c7f 100644
--- a/src/Simulator.v
+++ b/src/Simulator.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -20,8 +20,8 @@
From compcert Require Import Errors.
-From coqup Require Compiler Verilog Value.
-From coqup Require Import Coquplib.
+From vericert Require Compiler Verilog Value.
+From vericert Require Import Vericertlib.
Local Open Scope error_monad_scope.
diff --git a/src/common/Coquplib.v b/src/common/Coquplib.v
index 469eddc..d9176db 100644
--- a/src/common/Coquplib.v
+++ b/src/common/Coquplib.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -25,7 +25,7 @@ From Coq Require Export
Require Import Lia.
-From coqup Require Import Show.
+From vericert Require Import Show.
(* Depend on CompCert for the basic library, as they declare and prove some
useful theorems. *)
@@ -235,5 +235,3 @@ Definition debug_show {A B : Type} `{Show A} (a : A) (b : B) : B :=
Definition debug_show_msg {A B : Type} `{Show A} (s : string) (a : A) (b : B) : B :=
let unused := debug_print (s ++ show a) in b.
-
-Notation "f $ x" := (f x) (at level 60, right associativity, only parsing).
diff --git a/src/common/IntegerExtra.v b/src/common/IntegerExtra.v
index 8e32c2c..c9b5dbd 100644
--- a/src/common/IntegerExtra.v
+++ b/src/common/IntegerExtra.v
@@ -5,7 +5,7 @@ Require Import ZBinary.
From bbv Require Import ZLib.
From compcert Require Import Integers Coqlib.
-Require Import Coquplib.
+Require Import Vericertlib.
Local Open Scope Z_scope.
@@ -298,48 +298,44 @@ Module IntExtra.
(or (shl (repr (Byte.unsigned c)) (repr Byte.zwordsize))
(repr (Byte.unsigned d)))).
- Definition byte0 (n: int) : byte := Byte.repr $ unsigned n.
- Definition ibyte0 (n: int) : int := Int.repr $ Byte.unsigned $ byte0 n.
+ Definition byte1 (n: int) : byte := Byte.repr (unsigned n).
- Definition byte1 (n: int) : byte := Byte.repr $ unsigned $ shru n $ repr Byte.zwordsize.
- Definition ibyte1 (n: int) : int := Int.repr $ Byte.unsigned $ byte1 n.
+ Definition byte2 (n: int) : byte := Byte.repr (unsigned (shru n (repr Byte.zwordsize))).
- Definition byte2 (n: int) : byte := Byte.repr $ unsigned $ shru n $ repr (2 * Byte.zwordsize).
- Definition ibyte2 (n: int) : int := Int.repr $ Byte.unsigned $ byte2 n.
+ Definition byte3 (n: int) : byte := Byte.repr (unsigned (shru n (repr (2 * Byte.zwordsize)))).
- Definition byte3 (n: int) : byte := Byte.repr $ unsigned $ shru n $ repr (3 * Byte.zwordsize).
- Definition ibyte3 (n: int) : int := Int.repr $ Byte.unsigned $ byte3 n.
+ Definition byte4 (n: int) : byte := Byte.repr (unsigned (shru n (repr (3 * Byte.zwordsize)))).
- Lemma bits_byte0:
- forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte0 n) i = testbit n i.
+ Lemma bits_byte1:
+ forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte1 n) i = testbit n i.
Proof.
- intros. unfold byte0. rewrite Byte.testbit_repr; auto.
+ intros. unfold byte1. rewrite Byte.testbit_repr; auto.
Qed.
- Lemma bits_byte1:
- forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte1 n) i = testbit n (i + Byte.zwordsize).
+ Lemma bits_byte2:
+ forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte2 n) i = testbit n (i + Byte.zwordsize).
Proof.
- intros. unfold byte1. rewrite Byte.testbit_repr; auto.
+ intros. unfold byte2. rewrite Byte.testbit_repr; auto.
assert (zwordsize = 4 * Byte.zwordsize) by reflexivity.
fold (testbit (shru n (repr Byte.zwordsize)) i). rewrite bits_shru.
change (unsigned (repr Byte.zwordsize)) with Byte.zwordsize.
apply zlt_true. omega. omega.
Qed.
- Lemma bits_byte2:
- forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte2 n) i = testbit n (i + (2 * Byte.zwordsize)).
+ Lemma bits_byte3:
+ forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte3 n) i = testbit n (i + (2 * Byte.zwordsize)).
Proof.
- intros. unfold byte2. rewrite Byte.testbit_repr; auto.
+ intros. unfold byte3. rewrite Byte.testbit_repr; auto.
assert (zwordsize = 4 * Byte.zwordsize) by reflexivity.
fold (testbit (shru n (repr (2 * Byte.zwordsize))) i). rewrite bits_shru.
change (unsigned (repr (2 * Byte.zwordsize))) with (2 * Byte.zwordsize).
apply zlt_true. omega. omega.
Qed.
- Lemma bits_byte3:
- forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte3 n) i = testbit n (i + (3 * Byte.zwordsize)).
+ Lemma bits_byte4:
+ forall n i, 0 <= i < Byte.zwordsize -> Byte.testbit (byte4 n) i = testbit n (i + (3 * Byte.zwordsize)).
Proof.
- intros. unfold byte3. rewrite Byte.testbit_repr; auto.
+ intros. unfold byte4. rewrite Byte.testbit_repr; auto.
assert (zwordsize = 4 * Byte.zwordsize) by reflexivity.
fold (testbit (shru n (repr (3 * Byte.zwordsize))) i). rewrite bits_shru.
change (unsigned (repr (3 * Byte.zwordsize))) with (3 * Byte.zwordsize).
diff --git a/src/common/Maps.v b/src/common/Maps.v
index 3236417..b5a2fb2 100644
--- a/src/common/Maps.v
+++ b/src/common/Maps.v
@@ -1,4 +1,4 @@
-From coqup Require Import Coquplib.
+From vericert Require Import Vericertlib.
From compcert Require Export Maps.
From compcert Require Import Errors.
diff --git a/src/common/Monad.v b/src/common/Monad.v
index 628963e..8517186 100644
--- a/src/common/Monad.v
+++ b/src/common/Monad.v
@@ -20,10 +20,6 @@ Module MonadExtra(M : Monad).
Module MonadNotation.
- Notation "A ; B" :=
- (bind A (fun _ => B))
- (at level 200, B at level 200).
-
Notation "'do' X <- A ; B" :=
(bind A (fun X => B))
(at level 200, X ident, A at level 100, B at level 200).
diff --git a/src/common/Show.v b/src/common/Show.v
index c994df3..4c66725 100644
--- a/src/common/Show.v
+++ b/src/common/Show.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/common/Statemonad.v b/src/common/Statemonad.v
index ed1b9e7..2eada2f 100644
--- a/src/common/Statemonad.v
+++ b/src/common/Statemonad.v
@@ -1,5 +1,5 @@
From compcert Require Errors.
-From coqup Require Import Monad.
+From vericert Require Import Monad.
From Coq Require Import Lists.List.
Module Type State.
diff --git a/src/extraction/Extraction.v b/src/extraction/Extraction.v
index 5d10cd7..b1a885e 100644
--- a/src/extraction/Extraction.v
+++ b/src/extraction/Extraction.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*)
-From coqup Require Verilog ValueInt Compiler.
+From vericert Require Verilog Value Compiler.
From Coq Require DecidableClass.
@@ -134,7 +134,7 @@ Extract Constant Compiler.print_Mach => "PrintMach.print_if".
Extract Constant Compiler.print => "fun (f: 'a -> unit) (x: 'a) -> f x; x".
Extract Constant Compiler.time => "Timing.time_coq".
-Extract Constant Coquplib.debug_print => "print_newline".
+Extract Constant Vericertlib.debug_print => "print_newline".
(*Extraction Inline Compiler.apply_total Compiler.apply_partial.*)
@@ -167,7 +167,7 @@ Set Extraction AccessOpaque.
Cd "src/extraction".
Separate Extraction
- Verilog.module ValueInt.uvalueToZ coqup.Compiler.transf_hls
+ Verilog.module Value.uvalueToZ vericert.Compiler.transf_hls
Compiler.transf_c_program Compiler.transf_cminor_program
Cexec.do_initial_state Cexec.do_step Cexec.at_final_state
diff --git a/src/translation/HTLgen.v b/src/translation/HTLgen.v
index 1869a8f..8245a06 100644
--- a/src/translation/HTLgen.v
+++ b/src/translation/HTLgen.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
From compcert Require Import Maps.
From compcert Require Errors Globalenvs Integers.
From compcert Require Import AST RTL.
-From coqup Require Import Verilog HTL Coquplib AssocMap ValueInt Statemonad.
+From vericert Require Import Verilog HTL Vericertlib AssocMap ValueInt Statemonad.
Hint Resolve AssocMap.gempty : htlh.
Hint Resolve AssocMap.gso : htlh.
@@ -311,16 +311,26 @@ Definition check_address_parameter_unsigned (p : Z) : bool :=
Definition translate_eff_addressing (a: Op.addressing) (args: list reg) : mon expr :=
match a, args with (* TODO: We should be more methodical here; what are the possibilities?*)
| Op.Aindexed off, r1::nil =>
- ret (boplitz Vadd r1 off)
+ if (check_address_parameter_signed off)
+ then ret (boplitz Vadd r1 off)
+ else error (Errors.msg "Veriloggen: translate_eff_addressing (Aindexed): address misaligned")
| Op.Ascaled scale offset, r1::nil =>
- ret (Vbinop Vadd (boplitz Vmul r1 scale) (Vlit (ZToValue offset)))
+ if (check_address_parameter_signed scale) && (check_address_parameter_signed offset)
+ then ret (Vbinop Vadd (boplitz Vmul r1 scale) (Vlit (ZToValue offset)))
+ else error (Errors.msg "Veriloggen: translate_eff_addressing (Ascaled): address misaligned")
| Op.Aindexed2 offset, r1::r2::nil =>
- ret (Vbinop Vadd (bop Vadd r1 r2) (Vlit (ZToValue offset)))
+ if (check_address_parameter_signed offset)
+ then ret (Vbinop Vadd (bop Vadd r1 r2) (Vlit (ZToValue offset)))
+ else error (Errors.msg "Veriloggen: translate_eff_addressing (Aindexed2): address misaligned")
| Op.Aindexed2scaled scale offset, r1::r2::nil => (* Typical for dynamic array addressing *)
- ret (Vbinop Vadd (Vvar r1) (Vbinop Vadd (boplitz Vmul r2 scale) (Vlit (ZToValue offset))))
+ if (check_address_parameter_signed scale) && (check_address_parameter_signed offset)
+ then ret (Vbinop Vadd (Vvar r1) (Vbinop Vadd (boplitz Vmul r2 scale) (Vlit (ZToValue offset))))
+ else error (Errors.msg "Veriloggen: translate_eff_addressing (Aindexed2scaled): address misaligned")
| Op.Ainstack a, nil => (* We need to be sure that the base address is aligned *)
let a := Integers.Ptrofs.unsigned a in
- ret (Vlit (ZToValue a))
+ if (check_address_parameter_unsigned a)
+ then ret (Vlit (ZToValue a))
+ else error (Errors.msg "Veriloggen: translate_eff_addressing (Ainstack): address misaligned")
| _, _ => error (Errors.msg "Veriloggen: translate_eff_addressing unsuported addressing")
end.
@@ -402,38 +412,26 @@ Definition add_branch_instr (e: expr) (n n1 n2: node) : mon unit :=
| _, _ => Error (Errors.msg "Htlgen: add_branch_instr")
end.
-(* Definition translate_arr_access (mem : AST.memory_chunk) (addr : Op.addressing) *)
-(* (args : list reg) (stack : reg) : mon expr := *)
-(* match mem, addr, args with (* TODO: We should be more methodical here; what are the possibilities?*) *)
-(* | Mint32, Op.Aindexed off, r1::nil => *)
-(* if (check_address_parameter_signed off) *)
-(* then ret (Vvari stack (Vbinop Vdivu (boplitz Vadd r1 off) (Vlit (ZToValue 4)))) *)
-(* else error (Errors.msg "HTLgen: translate_arr_access address misaligned") *)
-(* | Mint32, Op.Aindexed2scaled scale offset, r1::r2::nil => (* Typical for dynamic array addressing *) *)
-(* if (check_address_parameter_signed scale) && (check_address_parameter_signed offset) *)
-(* then ret (Vvari stack *)
-(* (Vbinop Vdivu *)
-(* (Vbinop Vadd (boplitz Vadd r1 offset) (boplitz Vmul r2 scale)) *)
-(* (Vlit (ZToValue 4)))) *)
-(* else error (Errors.msg "HTLgen: translate_arr_access address misaligned") *)
-(* | Mint32, Op.Ainstack a, nil => (* We need to be sure that the base address is aligned *) *)
-(* let a := Integers.Ptrofs.unsigned a in *)
-(* if (check_address_parameter_unsigned a) *)
-(* then ret (Vvari stack (Vlit (ZToValue (a / 4)))) *)
-(* else error (Errors.msg "HTLgen: eff_addressing misaligned stack offset") *)
-(* | _, _, _ => error (Errors.msg "HTLgen: translate_arr_access unsuported addressing") *)
-(* end. *)
-
-Definition translate_arr_addressing (a: Op.addressing) (args: list reg) : mon expr :=
- match a, args with (* TODO: We should be more methodical here; what are the possibilities?*)
- | Op.Aindexed off, r1::nil =>
- ret (boplitz Vadd r1 off)
- | Op.Aindexed2scaled scale offset, r1::r2::nil => (* Typical for dynamic array addressing *)
- ret (Vbinop Vadd (boplitz Vadd r1 offset) (boplitz Vmul r2 scale))
- | Op.Ainstack a, nil => (* We need to be sure that the base address is aligned *)
+Definition translate_arr_access (mem : AST.memory_chunk) (addr : Op.addressing)
+ (args : list reg) (stack : reg) : mon expr :=
+ match mem, addr, args with (* TODO: We should be more methodical here; what are the possibilities?*)
+ | Mint32, Op.Aindexed off, r1::nil =>
+ if (check_address_parameter_signed off)
+ then ret (Vvari stack (Vbinop Vdivu (boplitz Vadd r1 off) (Vlit (ZToValue 4))))
+ else error (Errors.msg "HTLgen: translate_arr_access address misaligned")
+ | Mint32, Op.Aindexed2scaled scale offset, r1::r2::nil => (* Typical for dynamic array addressing *)
+ if (check_address_parameter_signed scale) && (check_address_parameter_signed offset)
+ then ret (Vvari stack
+ (Vbinop Vdivu
+ (Vbinop Vadd (boplitz Vadd r1 offset) (boplitz Vmul r2 scale))
+ (Vlit (ZToValue 4))))
+ else error (Errors.msg "HTLgen: translate_arr_access address misaligned")
+ | Mint32, Op.Ainstack a, nil => (* We need to be sure that the base address is aligned *)
let a := Integers.Ptrofs.unsigned a in
- ret (Vlit (ZToValue a))
- | _, _ => error (Errors.msg "Veriloggen: translate_arr_addressing unsuported addressing")
+ if (check_address_parameter_unsigned a)
+ then ret (Vvari stack (Vlit (ZToValue (a / 4))))
+ else error (Errors.msg "HTLgen: eff_addressing misaligned stack offset")
+ | _, _, _ => error (Errors.msg "HTLgen: translate_arr_access unsuported addressing")
end.
Fixpoint enumerate (i : nat) (ns : list node) {struct ns} : list (nat * node) :=
@@ -448,16 +446,6 @@ Definition tbl_to_case_expr (st : reg) (ns : list node) : list (expr * stmnt) :=
end)
(enumerate 0 ns).
-Definition create_single_cycle_load (stack : reg) (addr : expr) (dst : reg) : stmnt :=
- Vnonblock (Vvar dst) (Vload stack addr).
-
-Definition create_single_cycle_store (stack : reg) (addr : expr) (src : reg) : stmnt :=
- let l0 := Vnonblock (Vvari stack addr) (Vvarb0 src) in
- let l1 := Vnonblock (Vvari stack $ Vbinop Vadd addr (Vlit $ ZToValue 1)) (Vvarb1 src) in
- let l2 := Vnonblock (Vvari stack $ Vbinop Vadd addr (Vlit $ ZToValue 2)) (Vvarb2 src) in
- let l3 := Vnonblock (Vvari stack $ Vbinop Vadd addr (Vlit $ ZToValue 3)) (Vvarb3 src)
- in Vseq l0 $ Vseq l1 $ Vseq l2 $ l3.
-
Definition transf_instr (fin rtrn stack: reg) (ni: node * instruction) : mon unit :=
match ni with
(n, i) =>
@@ -472,25 +460,17 @@ Definition transf_instr (fin rtrn stack: reg) (ni: node * instruction) : mon uni
do _ <- declare_reg None dst 32;
add_instr n n' (nonblock dst instr)
else error (Errors.msg "State is larger than 2^32.")
- | Iload chunk addr args dst n' =>
- match chunk with
- | Mint32 =>
- if Z.leb (Z.pos n') Integers.Int.max_unsigned
- then do addr' <- translate_arr_addressing addr args;
- do _ <- declare_reg None dst 32;
- add_instr n n' $ create_single_cycle_load stack addr' dst
- else error (Errors.msg "State is larger than 2^32.")
- | _ => error (Errors.msg "Iload invalid chunk size.")
- end
- | Istore chunk addr args src n' =>
- match chunk with
- | Mint32 =>
- if Z.leb (Z.pos n') Integers.Int.max_unsigned
- then do addr' <- translate_arr_addressing addr args;
- add_instr n n' $ create_single_cycle_store stack addr' src
- else error (Errors.msg "State is larger than 2^32.")
- | _ => error (Errors.msg "Istore invalid chunk size.")
- end
+ | Iload mem addr args dst n' =>
+ if Z.leb (Z.pos n') Integers.Int.max_unsigned then
+ do src <- translate_arr_access mem addr args stack;
+ do _ <- declare_reg None dst 32;
+ add_instr n n' (nonblock dst src)
+ else error (Errors.msg "State is larger than 2^32.")
+ | Istore mem addr args src n' =>
+ if Z.leb (Z.pos n') Integers.Int.max_unsigned then
+ do dst <- translate_arr_access mem addr args stack;
+ add_instr n n' (Vnonblock dst (Vvar src)) (* TODO: Could juse use add_instr? reg exists. *)
+ else error (Errors.msg "State is larger than 2^32.")
| Icall _ _ _ _ _ => error (Errors.msg "Calls are not implemented.")
| Itailcall _ _ _ => error (Errors.msg "Tailcalls are not implemented.")
| Ibuiltin _ _ _ _ => error (Errors.msg "Builtin functions not implemented.")
@@ -596,7 +576,7 @@ Definition transf_module (f: function) : mon module :=
if stack_correct f.(fn_stacksize) then
do fin <- create_reg (Some Voutput) 1;
do rtrn <- create_reg (Some Voutput) 32;
- do (stack, stack_len) <- create_arr None 8 (Z.to_nat f.(fn_stacksize));
+ do (stack, stack_len) <- create_arr None 32 (Z.to_nat (f.(fn_stacksize) / 4));
do _ <- collectlist (transf_instr fin rtrn stack) (Maps.PTree.elements f.(RTL.fn_code));
do _ <- collectlist (fun r => declare_reg (Some Vinput) r 32) f.(RTL.fn_params);
do start <- create_reg (Some Vinput) 1;
diff --git a/src/translation/HTLgenproof.v b/src/translation/HTLgenproof.v
index 943b76e..ddf8c3a 100644
--- a/src/translation/HTLgenproof.v
+++ b/src/translation/HTLgenproof.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -18,8 +18,8 @@
From compcert Require RTL Registers AST.
From compcert Require Import Integers Globalenvs Memory Linking.
-From coqup Require Import Coquplib HTLgenspec HTLgen ValueInt AssocMap Array IntegerExtra ZExtra.
-From coqup Require HTL Verilog.
+From vericert Require Import Vericertlib HTLgenspec HTLgen ValueInt AssocMap Array IntegerExtra ZExtra.
+From vericert Require HTL Verilog.
Require Import Lia.
@@ -342,1944 +342,2122 @@ Section CORRECTNESS.
Hypothesis TRANSL : match_prog prog tprog.
+ Lemma TRANSL' :
+ Linking.match_program (fun cu f tf => transl_fundef f = Errors.OK tf) eq prog tprog.
+ Proof. intros; apply match_prog_matches; assumption. Qed.
-(* Lemma TRANSL' : *)
-(* Linking.match_program (fun cu f tf => transl_fundef f = Errors.OK tf) eq prog tprog. *)
-(* Proof. intros; apply match_prog_matches; assumption. Qed. *)
-
-(* Let ge : RTL.genv := Globalenvs.Genv.globalenv prog. *)
-(* Let tge : HTL.genv := Globalenvs.Genv.globalenv tprog. *)
-
-(* Lemma symbols_preserved: *)
-(* forall (s: AST.ident), Genv.find_symbol tge s = Genv.find_symbol ge s. *)
-(* Proof. intros. eapply (Genv.find_symbol_match TRANSL'). Qed. *)
-
-(* Lemma function_ptr_translated: *)
-(* forall (b: Values.block) (f: RTL.fundef), *)
-(* Genv.find_funct_ptr ge b = Some f -> *)
-(* exists tf, *)
-(* Genv.find_funct_ptr tge b = Some tf /\ transl_fundef f = Errors.OK tf. *)
-(* Proof. *)
-(* intros. exploit (Genv.find_funct_ptr_match TRANSL'); eauto. *)
-(* intros (cu & tf & P & Q & R); exists tf; auto. *)
-(* Qed. *)
-
-(* Lemma functions_translated: *)
-(* forall (v: Values.val) (f: RTL.fundef), *)
-(* Genv.find_funct ge v = Some f -> *)
-(* exists tf, *)
-(* Genv.find_funct tge v = Some tf /\ transl_fundef f = Errors.OK tf. *)
-(* Proof. *)
-(* intros. exploit (Genv.find_funct_match TRANSL'); eauto. *)
-(* intros (cu & tf & P & Q & R); exists tf; auto. *)
-(* Qed. *)
-
-(* Lemma senv_preserved: *)
-(* Senv.equiv (Genv.to_senv ge) (Genv.to_senv tge). *)
-(* Proof *)
-(* (Genv.senv_transf_partial TRANSL'). *)
-(* Hint Resolve senv_preserved : htlproof. *)
-
-(* Lemma ptrofs_inj : *)
-(* forall a b, *)
-(* Ptrofs.unsigned a = Ptrofs.unsigned b -> a = b. *)
-(* Proof. *)
-(* intros. rewrite <- Ptrofs.repr_unsigned. symmetry. rewrite <- Ptrofs.repr_unsigned. *)
-(* rewrite H. auto. *)
-(* Qed. *)
-
-(* Lemma op_stack_based : *)
-(* forall F V sp v m args rs op ge pc' res0 pc f e fin rtrn st stk, *)
-(* tr_instr fin rtrn st stk (RTL.Iop op args res0 pc') *)
-(* (Verilog.Vnonblock (Verilog.Vvar res0) e) *)
-(* (state_goto st pc') -> *)
-(* reg_stack_based_pointers sp rs -> *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') -> *)
-(* @Op.eval_operation F V ge (Values.Vptr sp Ptrofs.zero) op *)
-(* (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some v -> *)
-(* stack_based v sp. *)
-(* Proof. *)
-(* Ltac solve_no_ptr := *)
-(* match goal with *)
-(* | H: reg_stack_based_pointers ?sp ?rs |- stack_based (Registers.Regmap.get ?r ?rs) _ => *)
-(* solve [apply H] *)
-(* | H1: reg_stack_based_pointers ?sp ?rs, H2: Registers.Regmap.get _ _ = Values.Vptr ?b ?i *)
-(* |- context[Values.Vptr ?b _] => *)
-(* let H := fresh "H" in *)
-(* assert (H: stack_based (Values.Vptr b i) sp) by (rewrite <- H2; apply H1); simplify; solve [auto] *)
-(* | |- context[Registers.Regmap.get ?lr ?lrs] => *)
-(* destruct (Registers.Regmap.get lr lrs) eqn:?; simplify; auto *)
-(* | |- stack_based (?f _) _ => unfold f *)
-(* | |- stack_based (?f _ _) _ => unfold f *)
-(* | |- stack_based (?f _ _ _) _ => unfold f *)
-(* | |- stack_based (?f _ _ _ _) _ => unfold f *)
-(* | H: ?f _ _ = Some _ |- _ => *)
-(* unfold f in H; repeat (unfold_match H); inv H *)
-(* | H: ?f _ _ _ _ _ _ = Some _ |- _ => *)
-(* unfold f in H; repeat (unfold_match H); inv H *)
-(* | H: map (fun r : positive => Registers.Regmap.get r _) ?args = _ |- _ => *)
-(* destruct args; inv H *)
-(* | |- context[if ?c then _ else _] => destruct c; try discriminate *)
-(* | H: match _ with _ => _ end = Some _ |- _ => repeat (unfold_match H) *)
-(* | |- context[match ?g with _ => _ end] => destruct g; try discriminate *)
-(* | |- _ => simplify; solve [auto] *)
-(* end. *)
-(* intros F V sp v m args rs op g pc' res0 pc f e fin rtrn st stk INSTR RSBP SEL EVAL. *)
-(* inv INSTR. unfold translate_instr in H5. *)
-(* unfold_match H5; repeat (unfold_match H5); repeat (simplify; solve_no_ptr). *)
-(* Qed. *)
-
-(* Lemma int_inj : *)
-(* forall x y, *)
-(* Int.unsigned x = Int.unsigned y -> *)
-(* x = y. *)
-(* Proof. *)
-(* intros. rewrite <- Int.repr_unsigned at 1. rewrite <- Int.repr_unsigned. *)
-(* rewrite <- H. trivial. *)
-(* Qed. *)
-
-(* Lemma eval_correct : *)
-(* forall s sp op rs m v e asr asa f f' stk s' i pc res0 pc' args res ml st, *)
-(* match_states (RTL.State stk f sp pc rs m) (HTL.State res ml st asr asa) -> *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') -> *)
-(* Op.eval_operation ge sp op *)
-(* (List.map (fun r : BinNums.positive => Registers.Regmap.get r rs) args) m = Some v -> *)
-(* translate_instr op args s = OK e s' i -> *)
-(* exists v', Verilog.expr_runp f' asr asa e v' /\ val_value_lessdef v v'. *)
-(* Proof. *)
-(* Ltac eval_correct_tac := *)
-(* match goal with *)
-(* | |- context[valueToPtr] => unfold valueToPtr *)
-(* | |- context[valueToInt] => unfold valueToInt *)
-(* | |- context[bop] => unfold bop *)
-(* | |- context[boplit] => unfold boplit *)
-(* | |- val_value_lessdef Values.Vundef _ => solve [constructor] *)
-(* | H : val_value_lessdef _ _ |- val_value_lessdef (Values.Vint _) _ => constructor; inv H *)
-(* | |- val_value_lessdef (Values.Vint _) _ => constructor; auto *)
-(* | H : context[RTL.max_reg_function ?f] *)
-(* |- context[_ (Registers.Regmap.get ?r ?rs) (Registers.Regmap.get ?r0 ?rs)] => *)
-(* let HPle1 := fresh "HPle" in *)
-(* let HPle2 := fresh "HPle" in *)
-(* assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* assert (HPle2 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H in HPle1; apply H in HPle2; eexists; split; *)
-(* [econstructor; eauto; constructor; trivial | inv HPle1; inv HPle2; try (constructor; auto)] *)
-(* | H : context[RTL.max_reg_function ?f] *)
-(* |- context[_ (Registers.Regmap.get ?r ?rs) _] => *)
-(* let HPle1 := fresh "HPle" in *)
-(* assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H in HPle1; eexists; split; *)
-(* [econstructor; eauto; constructor; trivial | inv HPle1; try (constructor; auto)] *)
-(* | H : _ :: _ = _ :: _ |- _ => inv H *)
-(* | |- context[match ?d with _ => _ end] => destruct d eqn:?; try discriminate *)
-(* | |- Verilog.expr_runp _ _ _ _ _ => econstructor *)
-(* | |- val_value_lessdef (?f _ _) _ => unfold f *)
-(* | |- val_value_lessdef (?f _) _ => unfold f *)
-(* | H : ?f (Registers.Regmap.get _ _) _ = Some _ |- _ => *)
-(* unfold f in H; repeat (unfold_match H) *)
-(* | H1 : Registers.Regmap.get ?r ?rs = Values.Vint _, H2 : val_value_lessdef (Registers.Regmap.get ?r ?rs) _ *)
-(* |- _ => rewrite H1 in H2; inv H2 *)
-(* | |- _ => eexists; split; try constructor; solve [eauto] *)
-(* | H : context[RTL.max_reg_function ?f] |- context[_ (Verilog.Vvar ?r) (Verilog.Vvar ?r0)] => *)
-(* let HPle1 := fresh "H" in *)
-(* let HPle2 := fresh "H" in *)
-(* assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* assert (HPle2 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H in HPle1; apply H in HPle2; eexists; split; try constructor; eauto *)
-(* | H : context[RTL.max_reg_function ?f] |- context[Verilog.Vvar ?r] => *)
-(* let HPle := fresh "H" in *)
-(* assert (HPle : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H in HPle; eexists; split; try constructor; eauto *)
-(* | |- context[if ?c then _ else _] => destruct c eqn:?; try discriminate *)
-(* end. *)
-(* intros s sp op rs m v e asr asa f f' stk s' i pc pc' res0 args res ml st MSTATE INSTR EVAL TR_INSTR. *)
-(* inv MSTATE. inv MASSOC. unfold translate_instr in TR_INSTR; repeat (unfold_match TR_INSTR); inv TR_INSTR; *)
-(* unfold Op.eval_operation in EVAL; repeat (unfold_match EVAL); inv EVAL; *)
-(* repeat (simplify; eval_correct_tac; unfold valueToInt in *)
-(* - pose proof Integers.Ptrofs.agree32_sub as H2; unfold Integers.Ptrofs.agree32 in H2. *)
-(* unfold Ptrofs.of_int. simpl. *)
-(* apply ptrofs_inj. assert (Archi.ptr64 = false) by auto. eapply H2 in H3. *)
-(* rewrite Ptrofs.unsigned_repr. apply H3. replace Ptrofs.max_unsigned with Int.max_unsigned; auto. *)
-(* apply Int.unsigned_range_2. *)
-(* auto. rewrite Ptrofs.unsigned_repr. replace Ptrofs.max_unsigned with Int.max_unsigned; auto. *)
-(* apply Int.unsigned_range_2. rewrite Ptrofs.unsigned_repr. auto. *)
-(* replace Ptrofs.max_unsigned with Int.max_unsigned; auto. *)
-(* apply Int.unsigned_range_2. *)
-(* - pose proof Integers.Ptrofs.agree32_sub as AGR; unfold Integers.Ptrofs.agree32 in AGR. *)
-(* assert (ARCH: Archi.ptr64 = false) by auto. eapply AGR in ARCH. *)
-(* apply int_inj. unfold Ptrofs.to_int. rewrite Int.unsigned_repr. *)
-(* apply ARCH. Search Ptrofs.unsigned. pose proof Ptrofs.unsigned_range_2. *)
-(* replace Ptrofs.max_unsigned with Int.max_unsigned; auto. *)
-(* pose proof Ptrofs.agree32_of_int. unfold Ptrofs.agree32 in H2. *)
-(* eapply H2 in ARCH. apply ARCH. *)
-(* pose proof Ptrofs.agree32_of_int. unfold Ptrofs.agree32 in H2. *)
-(* eapply H2 in ARCH. apply ARCH. *)
-(* - admit. (* mulhs *) *)
-(* - admit. (* mulhu *) *)
-(* - rewrite H0 in Heqb. rewrite H1 in Heqb. discriminate. *)
-(* - rewrite Heqb in Heqb0. discriminate. *)
-(* - rewrite H0 in Heqb. rewrite H1 in Heqb. discriminate. *)
-(* - rewrite Heqb in Heqb0. discriminate. *)
-(* - admit. *)
-(* - admit. (* ror *) *)
-(* - admit. (* addressing *) *)
-(* - admit. (* eval_condition *) *)
-(* - admit. (* select *) *)
-(* Admitted. *)
-
-(* Lemma eval_cond_correct : *)
-(* forall cond (args : list Registers.reg) s1 c s' i rs args m b f asr asa, *)
-(* translate_condition cond args s1 = OK c s' i -> *)
-(* Op.eval_condition *)
-(* cond *)
-(* (List.map (fun r : BinNums.positive => Registers.Regmap.get r rs) args) *)
-(* m = Some b -> *)
-(* Verilog.expr_runp f asr asa c (boolToValue b). *)
-(* Admitted. *)
-
-(* (** The proof of semantic preservation for the translation of instructions *)
-(* is a simulation argument based on diagrams of the following form: *)
-(* << *)
-(* match_states *)
-(* code st rs ---------------- State m st assoc *)
-(* || | *)
-(* || | *)
-(* || | *)
-(* \/ v *)
-(* code st rs' --------------- State m st assoc' *)
-(* match_states *)
-(* >> *)
-(* where [tr_code c data control fin rtrn st] is assumed to hold. *)
-
-(* The precondition and postcondition is that that should hold is [match_assocmaps rs assoc]. *)
-(* *) *)
-
-(* Definition transl_instr_prop (instr : RTL.instruction) : Prop := *)
-(* forall m asr asa fin rtrn st stmt trans res, *)
-(* tr_instr fin rtrn st (m.(HTL.mod_stk)) instr stmt trans -> *)
-(* exists asr' asa', *)
-(* HTL.step tge (HTL.State res m st asr asa) Events.E0 (HTL.State res m st asr' asa'). *)
-
-(* Opaque combine. *)
-
-(* Ltac tac0 := *)
-(* match goal with *)
-(* | [ |- context[Verilog.merge_arrs _ _] ] => unfold Verilog.merge_arrs *)
-(* | [ |- context[Verilog.merge_arr] ] => unfold Verilog.merge_arr *)
-(* | [ |- context[Verilog.merge_regs _ _] ] => unfold Verilog.merge_regs; crush; unfold_merge *)
-(* | [ |- context[reg_stack_based_pointers] ] => unfold reg_stack_based_pointers; intros *)
-(* | [ |- context[Verilog.arr_assocmap_set _ _ _ _] ] => unfold Verilog.arr_assocmap_set *)
-
-(* | [ |- context[HTL.empty_stack] ] => unfold HTL.empty_stack *)
-
-(* | [ |- context[_ # ?d <- _ ! ?d] ] => rewrite AssocMap.gss *)
-(* | [ |- context[_ # ?d <- _ ! ?s] ] => rewrite AssocMap.gso *)
-(* | [ |- context[(AssocMap.empty _) ! _] ] => rewrite AssocMap.gempty *)
-
-(* | [ |- context[array_get_error _ (combine Verilog.merge_cell (arr_repeat None _) _)] ] => *)
-(* rewrite combine_lookup_first *)
-
-(* | [ |- state_st_wf _ _ ] => unfold state_st_wf; inversion 1 *)
-(* | [ |- context[match_states _ _] ] => econstructor; auto *)
-(* | [ |- match_arrs _ _ _ _ _ ] => econstructor; auto *)
-(* | [ |- match_assocmaps _ _ _ # _ <- (posToValue _) ] => *)
-(* apply regs_lessdef_add_greater; [> unfold Plt; lia | assumption] *)
-
-(* | [ H : ?asa ! ?r = Some _ |- Verilog.arr_assocmap_lookup ?asa ?r _ = Some _ ] => *)
-(* unfold Verilog.arr_assocmap_lookup; setoid_rewrite H; f_equal *)
-(* | [ |- context[(AssocMap.combine _ _ _) ! _] ] => *)
-(* try (rewrite AssocMap.gcombine; [> | reflexivity]) *)
-
-(* | [ |- context[Registers.Regmap.get ?d (Registers.Regmap.set ?d _ _)] ] => *)
-(* rewrite Registers.Regmap.gss *)
-(* | [ |- context[Registers.Regmap.get ?s (Registers.Regmap.set ?d _ _)] ] => *)
-(* destruct (Pos.eq_dec s d) as [EQ|EQ]; *)
-(* [> rewrite EQ | rewrite Registers.Regmap.gso; auto] *)
-
-(* | [ H : opt_val_value_lessdef _ _ |- _ ] => invert H *)
-(* | [ H : context[Z.of_nat (Z.to_nat _)] |- _ ] => rewrite Z2Nat.id in H; [> solve crush |] *)
-(* | [ H : _ ! _ = Some _ |- _] => setoid_rewrite H *)
-(* end. *)
-
-(* Ltac small_tac := repeat (crush; try array; try ptrofs); crush; auto. *)
-(* Ltac big_tac := repeat (crush; try array; try ptrofs; try tac0); crush; auto. *)
-
-(* Lemma transl_inop_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : RTL.regset) (m : mem) (pc' : RTL.node), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Inop pc') -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2. *)
-(* Proof. *)
-(* intros s f sp pc rs m pc' H R1 MSTATE. *)
-(* inv_state. *)
-
-(* unfold match_prog in TRANSL. *)
-(* econstructor. *)
-(* split. *)
-(* apply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* inv CONST; assumption. *)
-(* inv CONST; assumption. *)
-(* (* processing of state *) *)
-(* econstructor. *)
-(* crush. *)
-(* econstructor. *)
-(* econstructor. *)
-(* econstructor. *)
-
-(* all: invert MARR; big_tac. *)
-
-(* inv CONST; constructor; simplify; rewrite AssocMap.gso; auto; lia. *)
-
-(* Unshelve. auto. *)
-(* Qed. *)
-(* Hint Resolve transl_inop_correct : htlproof. *)
-
-(* Lemma transl_iop_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : Registers.Regmap.t Values.val) (m : mem) (op : Op.operation) (args : list Registers.reg) *)
-(* (res0 : Registers.reg) (pc' : RTL.node) (v : Values.val), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') -> *)
-(* Op.eval_operation ge sp op (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some v -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ *)
-(* match_states (RTL.State s f sp pc' (Registers.Regmap.set res0 v rs) m) R2. *)
-(* Proof. *)
-(* intros s f sp pc rs m op args res0 pc' v H H0 R1 MSTATE. *)
-(* inv_state. inv MARR. *)
-(* exploit eval_correct; eauto. intros. inversion H1. inversion H2. *)
-(* econstructor. split. *)
-(* apply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* inv CONST. assumption. *)
-(* inv CONST. assumption. *)
-(* econstructor; simpl; trivial. *)
-(* constructor; trivial. *)
-(* econstructor; simpl; eauto. *)
-(* simpl. econstructor. econstructor. *)
-(* apply H5. simplify. *)
-
-(* all: big_tac. *)
-
-(* assert (HPle: Ple res0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_def; eauto; simpl; auto). *)
-
-(* unfold Ple in HPle. lia. *)
-(* apply regs_lessdef_add_match. assumption. *)
-(* apply regs_lessdef_add_greater. unfold Plt; lia. assumption. *)
-(* assert (HPle: Ple res0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_def; eauto; simpl; auto). *)
-(* unfold Ple in HPle; lia. *)
-(* eapply op_stack_based; eauto. *)
-(* inv CONST. constructor; simplify. rewrite AssocMap.gso. rewrite AssocMap.gso. *)
-(* assumption. lia. *)
-(* assert (HPle: Ple res0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_def; eauto; simpl; auto). *)
-(* unfold Ple in HPle. lia. *)
-(* rewrite AssocMap.gso. rewrite AssocMap.gso. *)
-(* assumption. lia. *)
-(* assert (HPle: Ple res0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_def; eauto; simpl; auto). *)
-(* unfold Ple in HPle. lia. *)
-(* Unshelve. trivial. *)
-(* Qed. *)
-(* Hint Resolve transl_iop_correct : htlproof. *)
-
-(* Ltac tac := *)
-(* repeat match goal with *)
-(* | [ _ : error _ _ = OK _ _ _ |- _ ] => discriminate *)
-(* | [ _ : context[if (?x && ?y) then _ else _] |- _ ] => *)
-(* let EQ1 := fresh "EQ" in *)
-(* let EQ2 := fresh "EQ" in *)
-(* destruct x eqn:EQ1; destruct y eqn:EQ2; simpl in * *)
-(* | [ _ : context[if ?x then _ else _] |- _ ] => *)
-(* let EQ := fresh "EQ" in *)
-(* destruct x eqn:EQ; simpl in * *)
-(* | [ H : ret _ _ = _ |- _ ] => invert H *)
-(* | [ _ : context[match ?x with | _ => _ end] |- _ ] => destruct x *)
-(* end. *)
-
-(* Ltac inv_arr_access := *)
-(* match goal with *)
-(* | [ _ : translate_arr_access ?chunk ?addr ?args _ _ = OK ?c _ _ |- _] => *)
-(* destruct c, chunk, addr, args; crush; tac; crush *)
-(* end. *)
-
-(* Lemma transl_iload_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : Registers.Regmap.t Values.val) (m : mem) (chunk : AST.memory_chunk) *)
-(* (addr : Op.addressing) (args : list Registers.reg) (dst : Registers.reg) *)
-(* (pc' : RTL.node) (a v : Values.val), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Iload chunk addr args dst pc') -> *)
-(* Op.eval_addressing ge sp addr (map (fun r : positive => Registers.Regmap.get r rs) args) = Some a -> *)
-(* Mem.loadv chunk m a = Some v -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ *)
-(* match_states (RTL.State s f sp pc' (Registers.Regmap.set dst v rs) m) R2. *)
-(* Proof. *)
-(* intros s f sp pc rs m chunk addr args dst pc' a v H H0 H1 R1 MSTATE. *)
-(* inv_state. inv_arr_access. *)
-
-(* + (** Preamble *) *)
-(* invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-
-(* unfold reg_stack_based_pointers in RSBP. *)
-(* pose proof (RSBP r0) as RSBPr0. *)
-
-(* destruct (Registers.Regmap.get r0 rs) eqn:EQr0; crush. *)
-
-(* rewrite ARCHI in H1. crush. *)
-(* subst. *)
-
-(* pose proof MASSOC as MASSOC'. *)
-(* invert MASSOC'. *)
-(* pose proof (H0 r0). *)
-(* assert (HPler0 : Ple r0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; crush; eauto). *)
-(* apply H6 in HPler0. *)
-(* invert HPler0; try congruence. *)
-(* rewrite EQr0 in H8. *)
-(* invert H8. *)
-(* clear H0. clear H6. *)
-
-(* unfold check_address_parameter_signed in *; *)
-(* unfold check_address_parameter_unsigned in *; crush. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* (*assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE. *)
-(* { rewrite HeqOFFSET. *)
-(* apply PtrofsExtra.add_mod; crush. *)
-(* rewrite Integers.Ptrofs.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* apply PtrofsExtra.of_int_mod. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. } *)
-
-(* (** Read bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); auto. *)
-(* split; try lia; apply Integers.Ptrofs.unsigned_range_2. *)
-(* small_tac. } *)
-
-(* (** Normalisation proof *) *)
-(* assert (Integers.Ptrofs.repr *)
-(* (4 * Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET) *)
-(* as NORMALISE. *)
-(* { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity. *)
-(* rewrite <- PtrofsExtra.mul_unsigned. *)
-(* apply PtrofsExtra.mul_divu; crush; auto. } *)
-
-(* (** Normalised bounds proof *) *)
-(* assert (0 <= *)
-(* Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)) *)
-(* < (RTL.fn_stacksize f / 4)) *)
-(* as NORMALISE_BOUND. *)
-(* { split. *)
-(* apply Integers.Ptrofs.unsigned_range_2. *)
-(* assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity. *)
-(* unfold Integers.Ptrofs.divu at 2 in H0. *)
-(* rewrite H0. clear H0. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush. *)
-(* apply Zmult_lt_reg_r with (p := 4); try lia. *)
-(* repeat rewrite ZLib.div_mul_undo; try lia. *)
-(* apply Z.div_pos; small_tac. *)
-(* apply Z.div_le_upper_bound; small_tac. } *)
-
-(* inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ]; *)
-(* clear NORMALISE_BOUND. *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. crush. *)
-(* econstructor. econstructor. econstructor. crush. *)
-(* econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-
-(* all: big_tac. *)
-
-(* 1: { *)
-(* assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. *)
-(* } *)
-
-(* 2: { *)
-(* assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. *)
-(* } *)
-
-(* (** Match assocmaps *) *)
-(* apply regs_lessdef_add_match; big_tac. *)
-
-(* (** Equality proof *) *)
-(* match goal with *)
-(* | [ |- context [valueToNat ?x] ] => *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat x) *)
-(* as EXPR_OK by admit *)
-(* end. *)
-(* rewrite <- EXPR_OK. *)
-
-(* specialize (H7 (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4)))). *)
-(* exploit H7; big_tac. *)
-
-(* (** RSBP preservation *) *)
-(* unfold arr_stack_based_pointers in ASBP. *)
-(* specialize (ASBP (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))). *)
-(* exploit ASBP; big_tac. *)
-(* rewrite NORMALISE in H0. rewrite H1 in H0. assumption. *)
-
-(* + (** Preamble *) *)
-(* invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-
-(* unfold reg_stack_based_pointers in RSBP. *)
-(* pose proof (RSBP r0) as RSBPr0. *)
-(* pose proof (RSBP r1) as RSBPr1. *)
-
-(* destruct (Registers.Regmap.get r0 rs) eqn:EQr0; *)
-(* destruct (Registers.Regmap.get r1 rs) eqn:EQr1; crush. *)
-
-(* rewrite ARCHI in H1. crush. *)
-(* subst. *)
-(* clear RSBPr1. *)
-
-(* pose proof MASSOC as MASSOC'. *)
-(* invert MASSOC'. *)
-(* pose proof (H0 r0). *)
-(* pose proof (H0 r1). *)
-(* assert (HPler0 : Ple r0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; crush; eauto). *)
-(* assert (HPler1 : Ple r1 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; simpl; auto). *)
-(* apply H6 in HPler0. *)
-(* apply H8 in HPler1. *)
-(* invert HPler0; invert HPler1; try congruence. *)
-(* rewrite EQr0 in H9. *)
-(* rewrite EQr1 in H11. *)
-(* invert H9. invert H11. *)
-(* clear H0. clear H6. clear H8. *)
-
-(* unfold check_address_parameter_signed in *; *)
-(* unfold check_address_parameter_unsigned in *; crush. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int *)
-(* (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z)) *)
-(* (Integers.Int.repr z0)))) as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE. *)
-(* { rewrite HeqOFFSET. *)
-(* apply PtrofsExtra.add_mod; crush; try lia. *)
-(* rewrite Integers.Ptrofs.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* apply PtrofsExtra.of_int_mod. *)
-(* apply IntExtra.add_mod; crush. *)
-(* apply IntExtra.mul_mod2; crush. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. } *)
-
-(* (** Read bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); auto. *)
-(* split; try lia; apply Integers.Ptrofs.unsigned_range_2. *)
-(* small_tac. } *)
-
-(* (** Normalisation proof *) *)
-(* assert (Integers.Ptrofs.repr *)
-(* (4 * Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET) *)
-(* as NORMALISE. *)
-(* { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity. *)
-(* rewrite <- PtrofsExtra.mul_unsigned. *)
-(* apply PtrofsExtra.mul_divu; crush. } *)
-
-(* (** Normalised bounds proof *) *)
-(* assert (0 <= *)
-(* Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)) *)
-(* < (RTL.fn_stacksize f / 4)) *)
-(* as NORMALISE_BOUND. *)
-(* { split. *)
-(* apply Integers.Ptrofs.unsigned_range_2. *)
-(* assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity. *)
-(* unfold Integers.Ptrofs.divu at 2 in H0. *)
-(* rewrite H0. clear H0. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush. *)
-(* apply Zmult_lt_reg_r with (p := 4); try lia. *)
-(* repeat rewrite ZLib.div_mul_undo; try lia. *)
-(* apply Z.div_pos; small_tac. *)
-(* apply Z.div_le_upper_bound; lia. } *)
-
-(* inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ]; *)
-(* clear NORMALISE_BOUND. *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. crush. *)
-(* econstructor. econstructor. econstructor. crush. *)
-(* econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ6]). *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. *)
-
-(* all: big_tac. *)
-
-(* 1: { assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. } *)
-
-(* 2: { assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. } *)
-
-(* (** Match assocmaps *) *)
-(* apply regs_lessdef_add_match; big_tac. *)
-
-(* (** Equality proof *) *)
-(* match goal with *)
-(* | [ |- context [valueToNat ?x] ] => *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat x) *)
-(* as EXPR_OK by admit *)
-(* end. *)
-(* rewrite <- EXPR_OK. *)
-
-(* specialize (H7 (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4)))). *)
-(* exploit H7; big_tac. *)
-
-(* (** RSBP preservation *) *)
-(* unfold arr_stack_based_pointers in ASBP. *)
-(* specialize (ASBP (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))). *)
-(* exploit ASBP; big_tac. *)
-(* rewrite NORMALISE in H0. rewrite H1 in H0. assumption. *)
-
-(* + invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-(* rewrite ARCHI in H0. crush. *)
-
-(* unfold check_address_parameter_unsigned in *; *)
-(* unfold check_address_parameter_signed in *; crush. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* rewrite ZERO in H1. clear ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l in H1. *)
-
-(* remember i0 as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* rename H0 into MOD_PRESERVE. *)
-
-(* (** Read bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); big_tac. } *)
-
-(* (** Normalisation proof *) *)
-(* assert (Integers.Ptrofs.repr *)
-(* (4 * Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET) *)
-(* as NORMALISE. *)
-(* { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity. *)
-(* rewrite <- PtrofsExtra.mul_unsigned. *)
-(* apply PtrofsExtra.mul_divu; crush. } *)
-
-(* (** Normalised bounds proof *) *)
-(* assert (0 <= *)
-(* Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)) *)
-(* < (RTL.fn_stacksize f / 4)) *)
-(* as NORMALISE_BOUND. *)
-(* { split. *)
-(* apply Integers.Ptrofs.unsigned_range_2. *)
-(* assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity. *)
-(* unfold Integers.Ptrofs.divu at 2 in H0. *)
-(* rewrite H0. clear H0. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush. *)
-(* apply Zmult_lt_reg_r with (p := 4); try lia. *)
-(* repeat rewrite ZLib.div_mul_undo; try lia. *)
-(* apply Z.div_pos; small_tac. *)
-(* apply Z.div_le_upper_bound; lia. } *)
-
-(* inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ]; *)
-(* clear NORMALISE_BOUND. *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. crush. *)
-(* econstructor. econstructor. econstructor. econstructor. crush. *)
-
-(* all: big_tac. *)
-
-(* 1: { assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. } *)
-
-(* 2: { assert (HPle : Ple dst (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_def. eassumption. auto. *)
-(* apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. } *)
-
-(* (** Match assocmaps *) *)
-(* apply regs_lessdef_add_match; big_tac. *)
-
-(* (** Equality proof *) *)
-(* match goal with (* Prevents issues with evars *) *)
-(* | [ |- context [valueToNat ?x] ] => *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat x) *)
-(* as EXPR_OK by admit *)
-(* end. *)
-(* rewrite <- EXPR_OK. *)
-
-(* specialize (H7 (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4)))). *)
-(* exploit H7; big_tac. *)
-
-(* (** RSBP preservation *) *)
-(* unfold arr_stack_based_pointers in ASBP. *)
-(* specialize (ASBP (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))). *)
-(* exploit ASBP; big_tac. *)
-(* rewrite NORMALISE in H0. rewrite H1 in H0. assumption.*) *)
-(* Admitted. *)
-(* Hint Resolve transl_iload_correct : htlproof. *)
-
-(* Lemma transl_istore_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : Registers.Regmap.t Values.val) (m : mem) (chunk : AST.memory_chunk) *)
-(* (addr : Op.addressing) (args : list Registers.reg) (src : Registers.reg) *)
-(* (pc' : RTL.node) (a : Values.val) (m' : mem), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Istore chunk addr args src pc') -> *)
-(* Op.eval_addressing ge sp addr (map (fun r : positive => Registers.Regmap.get r rs) args) = Some a -> *)
-(* Mem.storev chunk m a (Registers.Regmap.get src rs) = Some m' -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m') R2. *)
-(* Proof. *)
-(* (* intros s f sp pc rs m chunk addr args src pc' a m' H H0 H1 R1 MSTATES. *)
-(* inv_state. inv_arr_access. *)
-
-(* + (** Preamble *) *)
-(* invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-
-(* unfold reg_stack_based_pointers in RSBP. *)
-(* pose proof (RSBP r0) as RSBPr0. *)
-
-(* destruct (Registers.Regmap.get r0 rs) eqn:EQr0; crush. *)
-
-(* rewrite ARCHI in H1. crush. *)
-(* subst. *)
-
-(* pose proof MASSOC as MASSOC'. *)
-(* invert MASSOC'. *)
-(* pose proof (H0 r0). *)
-(* assert (HPler0 : Ple r0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; crush; eauto). *)
-(* apply H6 in HPler0. *)
-(* invert HPler0; try congruence. *)
-(* rewrite EQr0 in H8. *)
-(* invert H8. *)
-(* clear H0. clear H6. *)
-
-(* unfold check_address_parameter_unsigned in *; *)
-(* unfold check_address_parameter_signed in *; crush. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE. *)
-(* { rewrite HeqOFFSET. *)
-(* apply PtrofsExtra.add_mod; crush; try lia. *)
-(* rewrite Integers.Ptrofs.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* apply PtrofsExtra.of_int_mod. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. } *)
-
-(* (** Write bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); big_tac. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. *)
-(* eapply Verilog.stmnt_runp_Vnonblock_arr. crush. *)
-(* econstructor. *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ7]). *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ8]). *)
-(* econstructor. *)
-(* econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-
-(* all: crush. *)
-
-(* (** State Lookup *) *)
-(* unfold Verilog.merge_regs. *)
-(* crush. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Match states *) *)
-(* rewrite assumption_32bit. *)
-(* econstructor; eauto. *)
-
-(* (** Match assocmaps *) *)
-(* unfold Verilog.merge_regs. crush. unfold_merge. *)
-(* apply regs_lessdef_add_greater. *)
-(* unfold Plt; lia. *)
-(* assumption. *)
-
-(* (** States well formed *) *)
-(* unfold state_st_wf. inversion 1. crush. *)
-(* unfold Verilog.merge_regs. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Equality proof *) *)
-(* match goal with *)
-(* | [ |- context [valueToNat ?x] ] => *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat x) *)
-(* as EXPR_OK by admit *)
-(* end. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET. *)
-
-(* econstructor. *)
-(* repeat split; crush. *)
-(* unfold HTL.empty_stack. *)
-(* crush. *)
-(* unfold Verilog.merge_arrs. *)
-
-(* rewrite AssocMap.gcombine. *)
-(* 2: { reflexivity. } *)
-(* unfold Verilog.arr_assocmap_set. *)
-(* rewrite AssocMap.gss. *)
-(* unfold Verilog.merge_arr. *)
-(* rewrite AssocMap.gss. *)
-(* setoid_rewrite H5. *)
-(* reflexivity. *)
-
-(* rewrite combine_length. *)
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* apply list_repeat_len. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. *)
-(* rewrite H4. reflexivity. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET. *)
-
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* constructor. *)
-(* erewrite combine_lookup_second. *)
-(* simpl. *)
-(* assert (Ple src (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H0 in H13. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H13; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-
-(* assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption). *)
-(* rewrite Z.mul_comm in H13. *)
-(* rewrite Z_div_mult in H13; try lia. *)
-(* replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H13 by reflexivity. *)
-(* rewrite <- PtrofsExtra.divu_unsigned in H13; unfold_constants; try lia. *)
-(* rewrite H13. rewrite EXPR_OK. *)
-(* rewrite array_get_error_set_bound. *)
-(* reflexivity. *)
-(* unfold arr_length, arr_repeat. simpl. *)
-(* rewrite list_repeat_len. lia. *)
-
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* rewrite Z2Nat.id in H15; try lia. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H15; try lia. *)
-(* rewrite ZLib.div_mul_undo in H15; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-
-(* rewrite <- EXPR_OK. *)
-(* rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia). *)
-(* destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4). *)
-(* apply Z.mul_cancel_r with (p := 4) in e; try lia. *)
-(* rewrite ZLib.div_mul_undo in e; try lia. *)
-(* rewrite combine_lookup_first. *)
-(* eapply H7; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-(* rewrite array_gso. *)
-(* unfold array_get_error. *)
-(* unfold arr_repeat. *)
-(* crush. *)
-(* apply list_repeat_lookup. *)
-(* lia. *)
-(* unfold_constants. *)
-(* intro. *)
-(* apply Z2Nat.inj_iff in H13; try lia. *)
-(* apply Z.div_pos; try lia. *)
-(* apply Integers.Ptrofs.unsigned_range. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* unfold arr_stack_based_pointers. *)
-(* intros. *)
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* crush. *)
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* crush. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor. *)
-(* destruct (Archi.ptr64); try discriminate. *)
-(* pose proof (RSBP src). rewrite EQ_SRC in H0. *)
-(* assumption. *)
-
-(* simpl. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* invert H0. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H14; try lia. *)
-(* rewrite ZLib.div_mul_undo in H14; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-(* apply ASBP; assumption. *)
-
-(* unfold stack_bounds in *. intros. *)
-(* simpl. *)
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. right. simpl. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush; try lia. *)
-(* apply ZExtra.mod_0_bounds; crush; try lia. } *)
-(* crush. *)
-(* exploit (BOUNDS ptr); try lia. intros. crush. *)
-(* exploit (BOUNDS ptr v); try lia. intros. *)
-(* invert H0. *)
-(* match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity. *)
-(* assert (Mem.valid_access m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) Writable). *)
-(* { pose proof H1. eapply Mem.store_valid_access_2 in H0. *)
-(* exact H0. eapply Mem.store_valid_access_3. eassumption. } *)
-(* pose proof (Mem.valid_access_store m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) v). *)
-(* apply X in H0. invert H0. congruence. *)
-
-(* + (** Preamble *) *)
-(* invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-
-(* unfold reg_stack_based_pointers in RSBP. *)
-(* pose proof (RSBP r0) as RSBPr0. *)
-(* pose proof (RSBP r1) as RSBPr1. *)
-
-(* destruct (Registers.Regmap.get r0 rs) eqn:EQr0; *)
-(* destruct (Registers.Regmap.get r1 rs) eqn:EQr1; crush. *)
-
-(* rewrite ARCHI in H1. crush. *)
-(* subst. *)
-(* clear RSBPr1. *)
-
-(* pose proof MASSOC as MASSOC'. *)
-(* invert MASSOC'. *)
-(* pose proof (H0 r0). *)
-(* pose proof (H0 r1). *)
-(* assert (HPler0 : Ple r0 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; crush; eauto). *)
-(* assert (HPler1 : Ple r1 (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; simpl; auto). *)
-(* apply H6 in HPler0. *)
-(* apply H8 in HPler1. *)
-(* invert HPler0; invert HPler1; try congruence. *)
-(* rewrite EQr0 in H9. *)
-(* rewrite EQr1 in H11. *)
-(* invert H9. invert H11. *)
-(* clear H0. clear H6. clear H8. *)
-
-(* unfold check_address_parameter_signed in *; *)
-(* unfold check_address_parameter_unsigned in *; crush. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int *)
-(* (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z)) *)
-(* (Integers.Int.repr z0)))) as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE. *)
-(* { rewrite HeqOFFSET. *)
-(* apply PtrofsExtra.add_mod; crush; try lia. *)
-(* rewrite Integers.Ptrofs.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* apply PtrofsExtra.of_int_mod. *)
-(* apply IntExtra.add_mod; crush. *)
-(* apply IntExtra.mul_mod2; crush. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. *)
-(* rewrite Integers.Int.unsigned_repr_eq. *)
-(* rewrite <- Zmod_div_mod; crush. } *)
-
-(* (** Write bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); auto. *)
-(* split; try lia; apply Integers.Ptrofs.unsigned_range_2. *)
-(* small_tac. } *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. *)
-(* eapply Verilog.stmnt_runp_Vnonblock_arr. crush. *)
-(* econstructor. *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ9]). *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ10]). *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ11]). *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. *)
-(* eapply Verilog.erun_Vbinop with (EQ := ?[EQ12]). *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-
-(* all: crush. *)
-
-(* (** State Lookup *) *)
-(* unfold Verilog.merge_regs. *)
-(* crush. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Match states *) *)
-(* rewrite assumption_32bit. *)
-(* econstructor; eauto. *)
-
-(* (** Match assocmaps *) *)
-(* unfold Verilog.merge_regs. crush. unfold_merge. *)
-(* apply regs_lessdef_add_greater. *)
-(* unfold Plt; lia. *)
-(* assumption. *)
-
-(* (** States well formed *) *)
-(* unfold state_st_wf. inversion 1. crush. *)
-(* unfold Verilog.merge_regs. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Equality proof *) *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat (vdiv *)
-(* (vplus (vplus asr # r0 (ZToValue 32 z0) ?EQ11) (vmul asr # r1 (ZToValue 32 z) ?EQ12) *)
-(* ?EQ10) (ZToValue 32 4) ?EQ9)) *)
-(* as EXPR_OK by admit. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET. *)
-
-(* econstructor. *)
-(* repeat split; crush. *)
-(* unfold HTL.empty_stack. *)
-(* crush. *)
-(* unfold Verilog.merge_arrs. *)
-
-(* rewrite AssocMap.gcombine. *)
-(* 2: { reflexivity. } *)
-(* unfold Verilog.arr_assocmap_set. *)
-(* rewrite AssocMap.gss. *)
-(* unfold Verilog.merge_arr. *)
-(* rewrite AssocMap.gss. *)
-(* setoid_rewrite H5. *)
-(* reflexivity. *)
-
-(* rewrite combine_length. *)
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* apply list_repeat_len. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. *)
-(* rewrite H4. reflexivity. *)
-
-(* remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0)) *)
-(* (Integers.Ptrofs.of_int *)
-(* (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z)) *)
-(* (Integers.Int.repr z0)))) as OFFSET. *)
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* constructor. *)
-(* erewrite combine_lookup_second. *)
-(* simpl. *)
-(* assert (Ple src (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H0 in H16. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H16; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-
-(* assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption). *)
-(* rewrite Z.mul_comm in H16. *)
-(* rewrite Z_div_mult in H16; try lia. *)
-(* replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H16 by reflexivity. *)
-(* rewrite <- PtrofsExtra.divu_unsigned in H16; unfold_constants; try lia. *)
-(* rewrite H16. rewrite EXPR_OK. *)
-(* rewrite array_get_error_set_bound. *)
-(* reflexivity. *)
-(* unfold arr_length, arr_repeat. simpl. *)
-(* rewrite list_repeat_len. lia. *)
-
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* rewrite Z2Nat.id in H18; try lia. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H18; try lia. *)
-(* rewrite ZLib.div_mul_undo in H18; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-
-(* rewrite <- EXPR_OK. *)
-(* rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia). *)
-(* destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4). *)
-(* apply Z.mul_cancel_r with (p := 4) in e; try lia. *)
-(* rewrite ZLib.div_mul_undo in e; try lia. *)
-(* rewrite combine_lookup_first. *)
-(* eapply H7; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-(* rewrite array_gso. *)
-(* unfold array_get_error. *)
-(* unfold arr_repeat. *)
-(* crush. *)
-(* apply list_repeat_lookup. *)
-(* lia. *)
-(* unfold_constants. *)
-(* intro. *)
-(* apply Z2Nat.inj_iff in H16; try lia. *)
-(* apply Z.div_pos; try lia. *)
-(* apply Integers.Ptrofs.unsigned_range. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* unfold arr_stack_based_pointers. *)
-(* intros. *)
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* crush. *)
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* crush. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor. *)
-(* destruct (Archi.ptr64); try discriminate. *)
-(* pose proof (RSBP src). rewrite EQ_SRC in H0. *)
-(* assumption. *)
-
-(* simpl. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* invert H0. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H17; try lia. *)
-(* rewrite ZLib.div_mul_undo in H17; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-(* apply ASBP; assumption. *)
-
-(* unfold stack_bounds in *. intros. *)
-(* simpl. *)
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. right. simpl. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush; try lia. *)
-(* apply ZExtra.mod_0_bounds; crush; try lia. } *)
-(* crush. *)
-(* exploit (BOUNDS ptr); try lia. intros. crush. *)
-(* exploit (BOUNDS ptr v); try lia. intros. *)
-(* invert H0. *)
-(* match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity. *)
-(* assert (Mem.valid_access m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) Writable). *)
-(* { pose proof H1. eapply Mem.store_valid_access_2 in H0. *)
-(* exact H0. eapply Mem.store_valid_access_3. eassumption. } *)
-(* pose proof (Mem.valid_access_store m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) v). *)
-(* apply X in H0. invert H0. congruence. *)
-
-(* + invert MARR. crush. *)
-
-(* unfold Op.eval_addressing in H0. *)
-(* destruct (Archi.ptr64) eqn:ARCHI; crush. *)
-(* rewrite ARCHI in H0. crush. *)
-
-(* unfold check_address_parameter_unsigned in *; *)
-(* unfold check_address_parameter_signed in *; crush. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* rewrite ZERO in H1. clear ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l in H1. *)
-
-(* remember i0 as OFFSET. *)
-
-(* (** Modular preservation proof *) *)
-(* rename H0 into MOD_PRESERVE. *)
-
-(* (** Write bounds proof *) *)
-(* assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH. *)
-(* { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto. *)
-(* unfold stack_bounds in BOUNDS. *)
-(* exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); auto. *)
-(* crush. *)
-(* replace (Integers.Ptrofs.repr 0) with (Integers.Ptrofs.zero) by reflexivity. *)
-(* small_tac. } *)
-
-(* (** Start of proof proper *) *)
-(* eexists. split. *)
-(* eapply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* apply assumption_32bit. *)
-(* econstructor. econstructor. econstructor. *)
-(* eapply Verilog.stmnt_runp_Vnonblock_arr. crush. *)
-(* econstructor. econstructor. econstructor. econstructor. *)
-
-(* all: crush. *)
-
-(* (** State Lookup *) *)
-(* unfold Verilog.merge_regs. *)
-(* crush. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Match states *) *)
-(* rewrite assumption_32bit. *)
-(* econstructor; eauto. *)
-
-(* (** Match assocmaps *) *)
-(* unfold Verilog.merge_regs. crush. unfold_merge. *)
-(* apply regs_lessdef_add_greater. *)
-(* unfold Plt; lia. *)
-(* assumption. *)
-
-(* (** States well formed *) *)
-(* unfold state_st_wf. inversion 1. crush. *)
-(* unfold Verilog.merge_regs. *)
-(* unfold_merge. *)
-(* apply AssocMap.gss. *)
-
-(* (** Equality proof *) *)
-(* assert (Z.to_nat *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.divu *)
-(* OFFSET *)
-(* (Integers.Ptrofs.repr 4))) *)
-(* = *)
-(* valueToNat (ZToValue 32 (Integers.Ptrofs.unsigned OFFSET / 4))) *)
-(* as EXPR_OK by admit. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET. *)
-
-(* econstructor. *)
-(* repeat split; crush. *)
-(* unfold HTL.empty_stack. *)
-(* crush. *)
-(* unfold Verilog.merge_arrs. *)
-
-(* rewrite AssocMap.gcombine. *)
-(* 2: { reflexivity. } *)
-(* unfold Verilog.arr_assocmap_set. *)
-(* rewrite AssocMap.gss. *)
-(* unfold Verilog.merge_arr. *)
-(* rewrite AssocMap.gss. *)
-(* setoid_rewrite H5. *)
-(* reflexivity. *)
-
-(* rewrite combine_length. *)
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* apply list_repeat_len. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. *)
-(* rewrite H4. reflexivity. *)
-
-(* remember i0 as OFFSET. *)
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* constructor. *)
-(* erewrite combine_lookup_second. *)
-(* simpl. *)
-(* assert (Ple src (RTL.max_reg_function f)) *)
-(* by (eapply RTL.max_reg_function_use; eauto; simpl; auto); *)
-(* apply H0 in H8. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H8; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-
-(* assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption). *)
-(* rewrite Z.mul_comm in H8. *)
-(* rewrite Z_div_mult in H8; try lia. *)
-(* replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H8 by reflexivity. *)
-(* rewrite <- PtrofsExtra.divu_unsigned in H8; unfold_constants; try lia. *)
-(* rewrite H8. rewrite EXPR_OK. *)
-(* rewrite array_get_error_set_bound. *)
-(* reflexivity. *)
-(* unfold arr_length, arr_repeat. simpl. *)
-(* rewrite list_repeat_len. lia. *)
-
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* rewrite Z2Nat.id in H11; try lia. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H11; try lia. *)
-(* rewrite ZLib.div_mul_undo in H11; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-
-(* rewrite <- EXPR_OK. *)
-(* rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia). *)
-(* destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4). *)
-(* apply Z.mul_cancel_r with (p := 4) in e; try lia. *)
-(* rewrite ZLib.div_mul_undo in e; try lia. *)
-(* rewrite combine_lookup_first. *)
-(* eapply H7; eauto. *)
-
-(* rewrite <- array_set_len. *)
-(* unfold arr_repeat. crush. *)
-(* rewrite list_repeat_len. auto. *)
-(* rewrite array_gso. *)
-(* unfold array_get_error. *)
-(* unfold arr_repeat. *)
-(* crush. *)
-(* apply list_repeat_lookup. *)
-(* lia. *)
-(* unfold_constants. *)
-(* intro. *)
-(* apply Z2Nat.inj_iff in H8; try lia. *)
-(* apply Z.div_pos; try lia. *)
-(* apply Integers.Ptrofs.unsigned_range. *)
-
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* unfold arr_stack_based_pointers. *)
-(* intros. *)
-(* destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET). *)
-
-(* crush. *)
-(* erewrite Mem.load_store_same. *)
-(* 2: { rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite e. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* exact H1. *)
-(* apply Integers.Ptrofs.unsigned_range_2. } *)
-(* crush. *)
-(* destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor. *)
-(* destruct (Archi.ptr64); try discriminate. *)
-(* pose proof (RSBP src). rewrite EQ_SRC in H0. *)
-(* assumption. *)
-
-(* simpl. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr. *)
-(* simpl. *)
-(* destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto. *)
-(* right. *)
-(* apply ZExtra.mod_0_bounds; try lia. *)
-(* apply ZLib.Z_mod_mult'. *)
-(* invert H0. *)
-(* apply Zmult_lt_compat_r with (p := 4) in H9; try lia. *)
-(* rewrite ZLib.div_mul_undo in H9; try lia. *)
-(* split; try lia. *)
-(* apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia. *)
-(* } *)
-(* apply ASBP; assumption. *)
-
-(* unfold stack_bounds in *. intros. *)
-(* simpl. *)
-(* assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity. *)
-(* erewrite Mem.load_store_other with (m1 := m). *)
-(* 2: { exact H1. } *)
-(* 2: { right. right. simpl. *)
-(* rewrite ZERO. *)
-(* rewrite Integers.Ptrofs.add_zero_l. *)
-(* rewrite Integers.Ptrofs.unsigned_repr; crush; try lia. *)
-(* apply ZExtra.mod_0_bounds; crush; try lia. } *)
-(* crush. *)
-(* exploit (BOUNDS ptr); try lia. intros. crush. *)
-(* exploit (BOUNDS ptr v); try lia. intros. *)
-(* invert H0. *)
-(* match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity. *)
-(* assert (Mem.valid_access m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) Writable). *)
-(* { pose proof H1. eapply Mem.store_valid_access_2 in H0. *)
-(* exact H0. eapply Mem.store_valid_access_3. eassumption. } *)
-(* pose proof (Mem.valid_access_store m AST.Mint32 sp' *)
-(* (Integers.Ptrofs.unsigned *)
-(* (Integers.Ptrofs.add (Integers.Ptrofs.repr 0) *)
-(* (Integers.Ptrofs.repr ptr))) v). *)
-(* apply X in H0. invert H0. congruence.*) *)
-(* Admitted. *)
-(* Hint Resolve transl_istore_correct : htlproof. *)
-
-(* Lemma transl_icond_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : Registers.Regmap.t Values.val) (m : mem) (cond : Op.condition) (args : list Registers.reg) *)
-(* (ifso ifnot : RTL.node) (b : bool) (pc' : RTL.node), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Icond cond args ifso ifnot) -> *)
-(* Op.eval_condition cond (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some b -> *)
-(* pc' = (if b then ifso else ifnot) -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2. *)
-(* Proof. *)
-(* intros s f sp pc rs m cond args ifso ifnot b pc' H H0 H1 R1 MSTATE. *)
-(* inv_state. *)
-
-(* eexists. split. apply Smallstep.plus_one. *)
-(* eapply HTL.step_module; eauto. *)
-(* inv CONST; assumption. *)
-(* inv CONST; assumption. *)
-(* (* eapply Verilog.stmnt_runp_Vnonblock_reg with *)
-(* (rhsval := if b then posToValue 32 ifso else posToValue 32 ifnot). *)
-(* constructor. *)
-
-(* simpl. *)
-(* destruct b. *)
-(* eapply Verilog.erun_Vternary_true. *)
-(* eapply eval_cond_correct; eauto. *)
-(* constructor. *)
-(* apply boolToValue_ValueToBool. *)
-(* eapply Verilog.erun_Vternary_false. *)
-(* eapply eval_cond_correct; eauto. *)
-(* constructor. *)
-(* apply boolToValue_ValueToBool. *)
-(* constructor. *)
-
-(* big_tac. *)
-
-(* invert MARR. *)
-(* destruct b; rewrite assumption_32bit; big_tac. *)
-
-(* Unshelve. *)
-(* constructor. *)
-(* Qed.*) *)
-(* Admitted. *)
-(* Hint Resolve transl_icond_correct : htlproof. *)
-
-(* Lemma transl_ijumptable_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive) *)
-(* (rs : Registers.Regmap.t Values.val) (m : mem) (arg : Registers.reg) (tbl : list RTL.node) *)
-(* (n : Integers.Int.int) (pc' : RTL.node), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Ijumptable arg tbl) -> *)
-(* Registers.Regmap.get arg rs = Values.Vint n -> *)
-(* list_nth_z tbl (Integers.Int.unsigned n) = Some pc' -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f sp pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2. *)
-(* Proof. *)
-(* intros s f sp pc rs m arg tbl n pc' H H0 H1 R1 MSTATE. *)
-(* Admitted. *)
-(* Hint Resolve transl_ijumptable_correct : htlproof. *)
-
-(* Lemma transl_ireturn_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (stk : Values.block) *)
-(* (pc : positive) (rs : RTL.regset) (m : mem) (or : option Registers.reg) *)
-(* (m' : mem), *)
-(* (RTL.fn_code f) ! pc = Some (RTL.Ireturn or) -> *)
-(* Mem.free m stk 0 (RTL.fn_stacksize f) = Some m' -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.State s f (Values.Vptr stk Integers.Ptrofs.zero) pc rs m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ *)
-(* match_states (RTL.Returnstate s (Registers.regmap_optget or Values.Vundef rs) m') R2. *)
-(* Proof. *)
-(* intros s f stk pc rs m or m' H H0 R1 MSTATE. *)
-(* inv_state. *)
-
-(* - econstructor. split. *)
-(* eapply Smallstep.plus_two. *)
-
-(* eapply HTL.step_module; eauto. *)
-(* inv CONST; assumption. *)
-(* inv CONST; assumption. *)
-(* constructor. *)
-(* econstructor; simpl; trivial. *)
-(* econstructor; simpl; trivial. *)
-(* constructor. *)
-(* econstructor; simpl; trivial. *)
-(* constructor. *)
-
-(* constructor. constructor. *)
-
-(* unfold state_st_wf in WF; big_tac; eauto. *)
-(* destruct wf as [HCTRL HDATA]. apply HCTRL. *)
-(* apply AssocMapExt.elements_iff. eexists. *)
-(* match goal with H: control ! pc = Some _ |- _ => apply H end. *)
-
-(* apply HTL.step_finish. *)
-(* unfold Verilog.merge_regs. *)
-(* unfold_merge; simpl. *)
-(* rewrite AssocMap.gso. *)
-(* apply AssocMap.gss. lia. *)
-(* apply AssocMap.gss. *)
-(* rewrite Events.E0_left. reflexivity. *)
-
-(* constructor; auto. *)
-(* constructor. *)
-
-(* (* FIXME: Duplication *) *)
-(* - econstructor. split. *)
-(* eapply Smallstep.plus_two. *)
-(* eapply HTL.step_module; eauto. *)
-(* inv CONST; assumption. *)
-(* inv CONST; assumption. *)
-(* constructor. *)
-(* econstructor; simpl; trivial. *)
-(* econstructor; simpl; trivial. *)
-(* constructor. constructor. constructor. *)
-(* constructor. constructor. constructor. *)
-
-(* unfold state_st_wf in WF; big_tac; eauto. *)
-
-(* destruct wf as [HCTRL HDATA]. apply HCTRL. *)
-(* apply AssocMapExt.elements_iff. eexists. *)
-(* match goal with H: control ! pc = Some _ |- _ => apply H end. *)
-
-(* apply HTL.step_finish. *)
-(* unfold Verilog.merge_regs. *)
-(* unfold_merge. *)
-(* rewrite AssocMap.gso. *)
-(* apply AssocMap.gss. simpl; lia. *)
-(* apply AssocMap.gss. *)
-(* rewrite Events.E0_left. trivial. *)
-
-(* constructor; auto. *)
-
-(* simpl. inversion MASSOC. subst. *)
-(* unfold find_assocmap, AssocMapExt.get_default. rewrite AssocMap.gso. *)
-(* apply H1. eapply RTL.max_reg_function_use. eauto. simpl; tauto. *)
-(* assert (HPle : Ple r (RTL.max_reg_function f)). *)
-(* eapply RTL.max_reg_function_use. eassumption. simpl; auto. *)
-(* apply ZExtra.Ple_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. *)
-
-(* Unshelve. *)
-(* all: constructor. *)
-(* Qed. *)
-(* Hint Resolve transl_ireturn_correct : htlproof. *)
-
-(* Lemma transl_callstate_correct: *)
-(* forall (s : list RTL.stackframe) (f : RTL.function) (args : list Values.val) *)
-(* (m : mem) (m' : Mem.mem') (stk : Values.block), *)
-(* Mem.alloc m 0 (RTL.fn_stacksize f) = (m', stk) -> *)
-(* forall R1 : HTL.state, *)
-(* match_states (RTL.Callstate s (AST.Internal f) args m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ *)
-(* match_states *)
-(* (RTL.State s f (Values.Vptr stk Integers.Ptrofs.zero) (RTL.fn_entrypoint f) *)
-(* (RTL.init_regs args (RTL.fn_params f)) m') R2. *)
-(* Proof. *)
-(* intros s f args m m' stk H R1 MSTATE. *)
-
-(* inversion MSTATE; subst. inversion TF; subst. *)
-(* econstructor. split. apply Smallstep.plus_one. *)
-(* eapply HTL.step_call. crush. *)
-
-(* apply match_state with (sp' := stk); eauto. *)
-
-(* all: big_tac. *)
-
-(* apply regs_lessdef_add_greater. unfold Plt; lia. *)
-(* apply regs_lessdef_add_greater. unfold Plt; lia. *)
-(* apply regs_lessdef_add_greater. unfold Plt; lia. *)
-(* apply init_reg_assoc_empty. *)
-
-(* constructor. *)
-
-(* destruct (Mem.load AST.Mint32 m' stk *)
-(* (Integers.Ptrofs.unsigned (Integers.Ptrofs.add *)
-(* Integers.Ptrofs.zero *)
-(* (Integers.Ptrofs.repr (4 * ptr))))) eqn:LOAD. *)
-(* pose proof Mem.load_alloc_same as LOAD_ALLOC. *)
-(* pose proof H as ALLOC. *)
-(* eapply LOAD_ALLOC in ALLOC. *)
-(* 2: { exact LOAD. } *)
-(* ptrofs. rewrite LOAD. *)
-(* rewrite ALLOC. *)
-(* repeat constructor. *)
-
-(* ptrofs. rewrite LOAD. *)
-(* repeat constructor. *)
-
-(* unfold reg_stack_based_pointers. intros. *)
-(* unfold RTL.init_regs; crush. *)
-(* destruct (RTL.fn_params f); *)
-(* rewrite Registers.Regmap.gi; constructor. *)
-
-(* unfold arr_stack_based_pointers. intros. *)
-(* crush. *)
-(* destruct (Mem.load AST.Mint32 m' stk *)
-(* (Integers.Ptrofs.unsigned (Integers.Ptrofs.add *)
-(* Integers.Ptrofs.zero *)
-(* (Integers.Ptrofs.repr (4 * ptr))))) eqn:LOAD. *)
-(* pose proof Mem.load_alloc_same as LOAD_ALLOC. *)
-(* pose proof H as ALLOC. *)
-(* eapply LOAD_ALLOC in ALLOC. *)
-(* 2: { exact LOAD. } *)
-(* rewrite ALLOC. *)
-(* repeat constructor. *)
-(* constructor. *)
-
-(* Transparent Mem.alloc. (* TODO: Since there are opaque there's probably a lemma. *) *)
-(* Transparent Mem.load. *)
-(* Transparent Mem.store. *)
-(* unfold stack_bounds. *)
-(* split. *)
-
-(* unfold Mem.alloc in H. *)
-(* invert H. *)
-(* crush. *)
-(* unfold Mem.load. *)
-(* intros. *)
-(* match goal with | |- context[if ?x then _ else _] => destruct x end; try congruence. *)
-(* invert v0. unfold Mem.range_perm in H4. *)
-(* unfold Mem.perm in H4. crush. *)
-(* unfold Mem.perm_order' in H4. *)
-(* small_tac. *)
-(* exploit (H4 ptr). rewrite Integers.Ptrofs.unsigned_repr; small_tac. intros. *)
-(* rewrite Maps.PMap.gss in H8. *)
-(* match goal with | H8 : context[if ?x then _ else _] |- _ => destruct x eqn:EQ end; try contradiction. *)
-(* crush. *)
-(* apply proj_sumbool_true in H10. lia. *)
-
-(* unfold Mem.alloc in H. *)
-(* invert H. *)
-(* crush. *)
-(* unfold Mem.store. *)
-(* intros. *)
-(* match goal with | |- context[if ?x then _ else _] => destruct x end; try congruence. *)
-(* invert v0. unfold Mem.range_perm in H4. *)
-(* unfold Mem.perm in H4. crush. *)
-(* unfold Mem.perm_order' in H4. *)
-(* small_tac. *)
-(* exploit (H4 ptr). rewrite Integers.Ptrofs.unsigned_repr; small_tac. intros. *)
-(* rewrite Maps.PMap.gss in H8. *)
-(* match goal with | H8 : context[if ?x then _ else _] |- _ => destruct x eqn:EQ end; try contradiction. *)
-(* crush. *)
-(* apply proj_sumbool_true in H10. lia. *)
-(* constructor. simplify. rewrite AssocMap.gss. *)
-(* simplify. rewrite AssocMap.gso. apply AssocMap.gss. simplify. lia. *)
-(* Opaque Mem.alloc. *)
-(* Opaque Mem.load. *)
-(* Opaque Mem.store. *)
-(* Qed. *)
-(* Hint Resolve transl_callstate_correct : htlproof. *)
-
-(* Lemma transl_returnstate_correct: *)
-(* forall (res0 : Registers.reg) (f : RTL.function) (sp : Values.val) (pc : RTL.node) *)
-(* (rs : RTL.regset) (s : list RTL.stackframe) (vres : Values.val) (m : mem) *)
-(* (R1 : HTL.state), *)
-(* match_states (RTL.Returnstate (RTL.Stackframe res0 f sp pc rs :: s) vres m) R1 -> *)
-(* exists R2 : HTL.state, *)
-(* Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ *)
-(* match_states (RTL.State s f sp pc (Registers.Regmap.set res0 vres rs) m) R2. *)
-(* Proof. *)
-(* intros res0 f sp pc rs s vres m R1 MSTATE. *)
-(* inversion MSTATE. inversion MF. *)
-(* Qed. *)
-(* Hint Resolve transl_returnstate_correct : htlproof. *)
-
-(* Lemma option_inv : *)
-(* forall A x y, *)
-(* @Some A x = Some y -> x = y. *)
-(* Proof. intros. inversion H. trivial. Qed. *)
-
-(* Lemma main_tprog_internal : *)
-(* forall b, *)
-(* Globalenvs.Genv.find_symbol tge tprog.(AST.prog_main) = Some b -> *)
-(* exists f, Genv.find_funct_ptr (Genv.globalenv tprog) b = Some (AST.Internal f). *)
-(* Proof. *)
-(* intros. *)
-(* destruct TRANSL. unfold main_is_internal in H1. *)
-(* repeat (unfold_match H1). replace b with b0. *)
-(* exploit function_ptr_translated; eauto. intros [tf [A B]]. *)
-(* unfold transl_fundef, AST.transf_partial_fundef, Errors.bind in B. *)
-(* unfold_match B. inv B. econstructor. apply A. *)
-
-(* apply option_inv. rewrite <- Heqo. rewrite <- H. *)
-(* rewrite symbols_preserved. replace (AST.prog_main tprog) with (AST.prog_main prog). *)
-(* trivial. symmetry; eapply Linking.match_program_main; eauto. *)
-(* Qed. *)
-
-(* Lemma transl_initial_states : *)
-(* forall s1 : Smallstep.state (RTL.semantics prog), *)
-(* Smallstep.initial_state (RTL.semantics prog) s1 -> *)
-(* exists s2 : Smallstep.state (HTL.semantics tprog), *)
-(* Smallstep.initial_state (HTL.semantics tprog) s2 /\ match_states s1 s2. *)
-(* Proof. *)
-(* induction 1. *)
-(* destruct TRANSL. unfold main_is_internal in H4. *)
-(* repeat (unfold_match H4). *)
-(* assert (f = AST.Internal f1). apply option_inv. *)
-(* rewrite <- Heqo0. rewrite <- H1. replace b with b0. *)
-(* auto. apply option_inv. rewrite <- H0. rewrite <- Heqo. *)
-(* trivial. *)
-(* exploit function_ptr_translated; eauto. *)
-(* intros [tf [A B]]. *)
-(* unfold transl_fundef, Errors.bind in B. *)
-(* unfold AST.transf_partial_fundef, Errors.bind in B. *)
-(* repeat (unfold_match B). inversion B. subst. *)
-(* exploit main_tprog_internal; eauto; intros. *)
-(* rewrite symbols_preserved. replace (AST.prog_main tprog) with (AST.prog_main prog). *)
-(* apply Heqo. symmetry; eapply Linking.match_program_main; eauto. *)
-(* inversion H5. *)
-(* econstructor; split. econstructor. *)
-(* apply (Genv.init_mem_transf_partial TRANSL'); eauto. *)
-(* replace (AST.prog_main tprog) with (AST.prog_main prog). *)
-(* rewrite symbols_preserved; eauto. *)
-(* symmetry; eapply Linking.match_program_main; eauto. *)
-(* apply H6. *)
-
-(* constructor. *)
-(* apply transl_module_correct. *)
-(* assert (Some (AST.Internal x) = Some (AST.Internal m)). *)
-(* replace (AST.fundef HTL.module) with (HTL.fundef). *)
-(* rewrite <- H6. setoid_rewrite <- A. trivial. *)
-(* trivial. inv H7. assumption. *)
-(* Qed. *)
-(* Hint Resolve transl_initial_states : htlproof. *)
-
-(* Lemma transl_final_states : *)
-(* forall (s1 : Smallstep.state (RTL.semantics prog)) *)
-(* (s2 : Smallstep.state (HTL.semantics tprog)) *)
-(* (r : Integers.Int.int), *)
-(* match_states s1 s2 -> *)
-(* Smallstep.final_state (RTL.semantics prog) s1 r -> *)
-(* Smallstep.final_state (HTL.semantics tprog) s2 r. *)
-(* Proof. *)
-(* intros. inv H0. inv H. inv H4. invert MF. constructor. reflexivity. *)
-(* Qed. *)
-(* Hint Resolve transl_final_states : htlproof. *)
-
-(* Theorem transl_step_correct: *)
-(* forall (S1 : RTL.state) t S2, *)
-(* RTL.step ge S1 t S2 -> *)
-(* forall (R1 : HTL.state), *)
-(* match_states S1 R1 -> *)
-(* exists R2, Smallstep.plus HTL.step tge R1 t R2 /\ match_states S2 R2. *)
-(* Proof. *)
-(* induction 1; eauto with htlproof; (intros; inv_state). *)
-(* Qed. *)
-(* Hint Resolve transl_step_correct : htlproof. *)
+ Let ge : RTL.genv := Globalenvs.Genv.globalenv prog.
+ Let tge : HTL.genv := Globalenvs.Genv.globalenv tprog.
+
+ Lemma symbols_preserved:
+ forall (s: AST.ident), Genv.find_symbol tge s = Genv.find_symbol ge s.
+ Proof. intros. eapply (Genv.find_symbol_match TRANSL'). Qed.
+
+ Lemma function_ptr_translated:
+ forall (b: Values.block) (f: RTL.fundef),
+ Genv.find_funct_ptr ge b = Some f ->
+ exists tf,
+ Genv.find_funct_ptr tge b = Some tf /\ transl_fundef f = Errors.OK tf.
+ Proof.
+ intros. exploit (Genv.find_funct_ptr_match TRANSL'); eauto.
+ intros (cu & tf & P & Q & R); exists tf; auto.
+ Qed.
+
+ Lemma functions_translated:
+ forall (v: Values.val) (f: RTL.fundef),
+ Genv.find_funct ge v = Some f ->
+ exists tf,
+ Genv.find_funct tge v = Some tf /\ transl_fundef f = Errors.OK tf.
+ Proof.
+ intros. exploit (Genv.find_funct_match TRANSL'); eauto.
+ intros (cu & tf & P & Q & R); exists tf; auto.
+ Qed.
+
+ Lemma senv_preserved:
+ Senv.equiv (Genv.to_senv ge) (Genv.to_senv tge).
+ Proof
+ (Genv.senv_transf_partial TRANSL').
+ Hint Resolve senv_preserved : htlproof.
+
+ Lemma ptrofs_inj :
+ forall a b,
+ Ptrofs.unsigned a = Ptrofs.unsigned b -> a = b.
+ Proof.
+ intros. rewrite <- Ptrofs.repr_unsigned. symmetry. rewrite <- Ptrofs.repr_unsigned.
+ rewrite H. auto.
+ Qed.
+
+ Lemma op_stack_based :
+ forall F V sp v m args rs op ge pc' res0 pc f e fin rtrn st stk,
+ tr_instr fin rtrn st stk (RTL.Iop op args res0 pc')
+ (Verilog.Vnonblock (Verilog.Vvar res0) e)
+ (state_goto st pc') ->
+ reg_stack_based_pointers sp rs ->
+ (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') ->
+ @Op.eval_operation F V ge (Values.Vptr sp Ptrofs.zero) op
+ (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some v ->
+ stack_based v sp.
+ Proof.
+ Ltac solve_no_ptr :=
+ match goal with
+ | H: reg_stack_based_pointers ?sp ?rs |- stack_based (Registers.Regmap.get ?r ?rs) _ =>
+ solve [apply H]
+ | H1: reg_stack_based_pointers ?sp ?rs, H2: Registers.Regmap.get _ _ = Values.Vptr ?b ?i
+ |- context[Values.Vptr ?b _] =>
+ let H := fresh "H" in
+ assert (H: stack_based (Values.Vptr b i) sp) by (rewrite <- H2; apply H1); simplify; solve [auto]
+ | |- context[Registers.Regmap.get ?lr ?lrs] =>
+ destruct (Registers.Regmap.get lr lrs) eqn:?; simplify; auto
+ | |- stack_based (?f _) _ => unfold f
+ | |- stack_based (?f _ _) _ => unfold f
+ | |- stack_based (?f _ _ _) _ => unfold f
+ | |- stack_based (?f _ _ _ _) _ => unfold f
+ | H: ?f _ _ = Some _ |- _ =>
+ unfold f in H; repeat (unfold_match H); inv H
+ | H: ?f _ _ _ _ _ _ = Some _ |- _ =>
+ unfold f in H; repeat (unfold_match H); inv H
+ | H: map (fun r : positive => Registers.Regmap.get r _) ?args = _ |- _ =>
+ destruct args; inv H
+ | |- context[if ?c then _ else _] => destruct c; try discriminate
+ | H: match _ with _ => _ end = Some _ |- _ => repeat (unfold_match H)
+ | H: match _ with _ => _ end = OK _ _ _ |- _ => repeat (unfold_match H)
+ | |- context[match ?g with _ => _ end] => destruct g; try discriminate
+ | |- _ => simplify; solve [auto]
+ end.
+ intros F V sp v m args rs op g pc' res0 pc f e fin rtrn st stk INSTR RSBP SEL EVAL.
+ inv INSTR. unfold translate_instr in H5.
+ unfold_match H5; repeat (unfold_match H5); repeat (simplify; solve_no_ptr).
+ Qed.
+
+ Lemma int_inj :
+ forall x y,
+ Int.unsigned x = Int.unsigned y ->
+ x = y.
+ Proof.
+ intros. rewrite <- Int.repr_unsigned at 1. rewrite <- Int.repr_unsigned.
+ rewrite <- H. trivial.
+ Qed.
+
+ Lemma eval_correct :
+ forall s sp op rs m v e asr asa f f' stk s' i pc res0 pc' args res ml st,
+ match_states (RTL.State stk f sp pc rs m) (HTL.State res ml st asr asa) ->
+ (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') ->
+ Op.eval_operation ge sp op
+ (List.map (fun r : BinNums.positive => Registers.Regmap.get r rs) args) m = Some v ->
+ translate_instr op args s = OK e s' i ->
+ exists v', Verilog.expr_runp f' asr asa e v' /\ val_value_lessdef v v'.
+ Proof.
+ Ltac eval_correct_tac :=
+ match goal with
+ | |- context[valueToPtr] => unfold valueToPtr
+ | |- context[valueToInt] => unfold valueToInt
+ | |- context[bop] => unfold bop
+ | H : context[bop] |- _ => unfold bop in H
+ | |- context[boplit] => unfold boplit
+ | H : context[boplit] |- _ => unfold boplit in H
+ | |- context[boplitz] => unfold boplitz
+ | H : context[boplitz] |- _ => unfold boplitz in H
+ | |- val_value_lessdef Values.Vundef _ => solve [constructor]
+ | H : val_value_lessdef _ _ |- val_value_lessdef (Values.Vint _) _ => constructor; inv H
+ | |- val_value_lessdef (Values.Vint _) _ => constructor; auto
+ | H : ret _ _ = OK _ _ _ |- _ => inv H
+ | H : context[RTL.max_reg_function ?f]
+ |- context[_ (Registers.Regmap.get ?r ?rs) (Registers.Regmap.get ?r0 ?rs)] =>
+ let HPle1 := fresh "HPle" in
+ let HPle2 := fresh "HPle" in
+ assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ assert (HPle2 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H in HPle1; apply H in HPle2; eexists; split;
+ [econstructor; eauto; constructor; trivial | inv HPle1; inv HPle2; try (constructor; auto)]
+ | H : context[RTL.max_reg_function ?f]
+ |- context[_ (Registers.Regmap.get ?r ?rs) _] =>
+ let HPle1 := fresh "HPle" in
+ assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H in HPle1; eexists; split;
+ [econstructor; eauto; constructor; trivial | inv HPle1; try (constructor; auto)]
+ | H : _ :: _ = _ :: _ |- _ => inv H
+ | |- context[match ?d with _ => _ end] => destruct d eqn:?; try discriminate
+ | H : match ?d with _ => _ end = _ |- _ => repeat unfold_match H
+ | H : match ?d with _ => _ end _ = _ |- _ => repeat unfold_match H
+ | |- Verilog.expr_runp _ _ _ _ _ => econstructor
+ | |- val_value_lessdef (?f _ _) _ => unfold f
+ | |- val_value_lessdef (?f _) _ => unfold f
+ | H : ?f (Registers.Regmap.get _ _) _ = Some _ |- _ =>
+ unfold f in H; repeat (unfold_match H)
+ | H1 : Registers.Regmap.get ?r ?rs = Values.Vint _, H2 : val_value_lessdef (Registers.Regmap.get ?r ?rs) _
+ |- _ => rewrite H1 in H2; inv H2
+ | |- _ => eexists; split; try constructor; solve [eauto]
+ | H : context[RTL.max_reg_function ?f] |- context[_ (Verilog.Vvar ?r) (Verilog.Vvar ?r0)] =>
+ let HPle1 := fresh "H" in
+ let HPle2 := fresh "H" in
+ assert (HPle1 : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ assert (HPle2 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H in HPle1; apply H in HPle2; eexists; split; try constructor; eauto
+ | H : context[RTL.max_reg_function ?f] |- context[Verilog.Vvar ?r] =>
+ let HPle := fresh "H" in
+ assert (HPle : Ple r (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H in HPle; eexists; split; try constructor; eauto
+ | |- context[if ?c then _ else _] => destruct c eqn:?; try discriminate
+ | H : ?b = _ |- _ = boolToValue ?b => rewrite H
+ end.
+ Ltac inv_lessdef := lazymatch goal with
+ | H2 : context[RTL.max_reg_function ?f], H : Registers.Regmap.get ?r ?rs = _,
+ H1 : Registers.Regmap.get ?r0 ?rs = _ |- _ =>
+ let HPle1 := fresh "HPle" in
+ assert (HPle1 : Ple r (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H2 in HPle1; inv HPle1;
+ let HPle2 := fresh "HPle" in
+ assert (HPle2 : Ple r0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H2 in HPle2; inv HPle2
+ | H2 : context[RTL.max_reg_function ?f], H : Registers.Regmap.get ?r ?rs = _ |- _ =>
+ let HPle1 := fresh "HPle" in
+ assert (HPle1 : Ple r (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H2 in HPle1; inv HPle1
+ end.
+ Ltac solve_cond :=
+ match goal with
+ | H : context[match _ with _ => _ end] |- _ => repeat (unfold_merge H)
+ | H : ?f = _ |- context[boolToValue ?f] => rewrite H; solve [auto]
+ | H : Values.Vptr _ _ = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vint _ |- _ =>
+ rewrite H2 in H; discriminate
+ | H : Values.Vundef = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vint _ |- _ =>
+ rewrite H2 in H; discriminate
+ | H : Values.Vint _ = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vundef |- _ =>
+ rewrite H2 in H; discriminate
+ | H : Values.Vint _ = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vptr _ _ |- _ =>
+ rewrite H2 in H; discriminate
+ | H : Values.Vundef = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vptr _ _ |- _ =>
+ rewrite H2 in H; discriminate
+ | H : Values.Vptr _ _ = Registers.Regmap.get ?r ?rs,
+ H2 : Registers.Regmap.get ?r ?rs = Values.Vundef |- _ =>
+ rewrite H2 in H; discriminate
+ | |- context[val_value_lessdef Values.Vundef _] =>
+ econstructor; split; econstructor; econstructor; auto; solve [constructor]
+ | H1 : Registers.Regmap.get ?r ?rs = Values.Vint _,
+ H2 : Values.Vint _ = Registers.Regmap.get ?r ?rs,
+ H3 : Registers.Regmap.get ?r0 ?rs = Values.Vint _,
+ H4 : Values.Vint _ = Registers.Regmap.get ?r0 ?rs|- _ =>
+ rewrite H1 in H2; rewrite H3 in H4; inv H2; inv H4; unfold valueToInt in *; constructor
+ | H1 : Registers.Regmap.get ?r ?rs = Values.Vptr _ _,
+ H2 : Values.Vptr _ _ = Registers.Regmap.get ?r ?rs,
+ H3 : Registers.Regmap.get ?r0 ?rs = Values.Vptr _ _,
+ H4 : Values.Vptr _ _ = Registers.Regmap.get ?r0 ?rs|- _ =>
+ rewrite H1 in H2; rewrite H3 in H4; inv H2; inv H4; unfold valueToInt in *; constructor;
+ unfold Ptrofs.ltu, Int.ltu in *; unfold Ptrofs.of_int in *;
+ repeat (rewrite Ptrofs.unsigned_repr in *; auto using Int.unsigned_range_2)
+ | H : _ :: _ = _ :: _ |- _ => inv H
+ | H : ret _ _ = OK _ _ _ |- _ => inv H
+ | |- _ =>
+ eexists; split; [ econstructor; econstructor; auto
+ | simplify; inv_lessdef; repeat (unfold valueToPtr, valueToInt in *; solve_cond);
+ unfold valueToPtr in *
+ ]
+ end.
+ intros s sp op rs m v e asr asa f f' stk s' i pc pc' res0 args res ml st MSTATE INSTR EVAL TR_INSTR.
+ inv MSTATE. inv MASSOC. unfold translate_instr in TR_INSTR; repeat (unfold_match TR_INSTR); inv TR_INSTR;
+ unfold Op.eval_operation in EVAL; repeat (unfold_match EVAL); inv EVAL;
+ repeat (simplify; eval_correct_tac; unfold valueToInt in *).
+ - pose proof Integers.Ptrofs.agree32_sub as H2; unfold Integers.Ptrofs.agree32 in H2.
+ unfold Ptrofs.of_int. simpl.
+ apply ptrofs_inj. assert (Archi.ptr64 = false) by auto. eapply H2 in H3.
+ rewrite Ptrofs.unsigned_repr. apply H3. replace Ptrofs.max_unsigned with Int.max_unsigned; auto.
+ apply Int.unsigned_range_2.
+ auto. rewrite Ptrofs.unsigned_repr. replace Ptrofs.max_unsigned with Int.max_unsigned; auto.
+ apply Int.unsigned_range_2. rewrite Ptrofs.unsigned_repr. auto.
+ replace Ptrofs.max_unsigned with Int.max_unsigned; auto.
+ apply Int.unsigned_range_2.
+ - pose proof Integers.Ptrofs.agree32_sub as AGR; unfold Integers.Ptrofs.agree32 in AGR.
+ assert (ARCH: Archi.ptr64 = false) by auto. eapply AGR in ARCH.
+ apply int_inj. unfold Ptrofs.to_int. rewrite Int.unsigned_repr.
+ apply ARCH. Search Ptrofs.unsigned. pose proof Ptrofs.unsigned_range_2.
+ replace Ptrofs.max_unsigned with Int.max_unsigned; auto.
+ pose proof Ptrofs.agree32_of_int. unfold Ptrofs.agree32 in H2.
+ eapply H2 in ARCH. apply ARCH.
+ pose proof Ptrofs.agree32_of_int. unfold Ptrofs.agree32 in H2.
+ eapply H2 in ARCH. apply ARCH.
+ - rewrite H0 in Heqb. rewrite H1 in Heqb. discriminate.
+ - rewrite Heqb in Heqb0. discriminate.
+ - rewrite H0 in Heqb. rewrite H1 in Heqb. discriminate.
+ - rewrite Heqb in Heqb0. discriminate.
+ (*- unfold Int.ror. unfold Int.or. unfold Int.shru, Int.shl, Int.sub. unfold intToValue. unfold Int.modu,
+ Search Int.repr.
+ repeat (rewrite Int.unsigned_repr). auto.*)
+ - unfold Op.eval_addressing32 in *. repeat (unfold_match H2); inv H2.
+ + unfold translate_eff_addressing in *. repeat (unfold_match H1).
+ destruct v0; inv Heql; rewrite H2; inv H1; repeat eval_correct_tac.
+ pose proof Integers.Ptrofs.agree32_add as AGR; unfold Integers.Ptrofs.agree32 in AGR. unfold ZToValue.
+ apply ptrofs_inj. unfold Ptrofs.of_int. rewrite Ptrofs.unsigned_repr.
+ apply AGR. auto. rewrite H2 in H0. inv H0. unfold valueToPtr. unfold Ptrofs.of_int.
+ rewrite Ptrofs.unsigned_repr. auto. replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ rewrite Ptrofs.unsigned_repr. auto. replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ + unfold translate_eff_addressing in *. repeat (unfold_match H1). inv H1.
+ inv Heql. unfold boplitz. repeat (simplify; eval_correct_tac).
+ all: repeat (unfold_match Heqv).
+ * inv Heqv. unfold valueToInt in *. inv H2. inv H0. unfold valueToInt in *. trivial.
+ * constructor. unfold valueToPtr, ZToValue in *.
+ pose proof Integers.Ptrofs.agree32_add as AGR; unfold Integers.Ptrofs.agree32 in AGR. unfold ZToValue.
+ apply ptrofs_inj. unfold Ptrofs.of_int. rewrite Ptrofs.unsigned_repr.
+ apply AGR. auto. inv Heqv. rewrite Int.add_commut.
+ apply AGR. auto. inv H1. inv H0. unfold valueToPtr. unfold Ptrofs.of_int.
+ rewrite Ptrofs.unsigned_repr. auto. replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ unfold Ptrofs.of_int.
+ rewrite Ptrofs.unsigned_repr. inv H0. auto. replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ rewrite Ptrofs.unsigned_repr. auto. replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ apply Int.unsigned_range_2.
+ * constructor. unfold valueToPtr, ZToValue in *.
+ pose proof Integers.Ptrofs.agree32_add as AGR; unfold Integers.Ptrofs.agree32 in AGR. unfold ZToValue.
+ apply ptrofs_inj. unfold Ptrofs.of_int. rewrite Ptrofs.unsigned_repr.
+ apply AGR. auto. inv Heqv.
+ apply AGR. auto. inv H0. unfold valueToPtr, Ptrofs.of_int. rewrite Ptrofs.unsigned_repr. auto.
+ replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ inv H1. unfold valueToPtr, Ptrofs.of_int. rewrite Ptrofs.unsigned_repr. auto.
+ replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2.
+ rewrite Ptrofs.unsigned_repr. auto.
+ replace Ptrofs.max_unsigned with Int.max_unsigned by auto.
+ apply Int.unsigned_range_2. apply Int.unsigned_range_2.
+ + unfold translate_eff_addressing in *. repeat (unfold_match H1). inv H1.
+ inv Heql. unfold boplitz. repeat (simplify; eval_correct_tac).
+ all: repeat (unfold_match Heqv).
+ * unfold Values.Val.mul in Heqv. repeat (unfold_match Heqv). inv Heqv. inv H3.
+ unfold valueToInt, ZToValue. auto.
+ * unfold Values.Val.mul in Heqv. repeat (unfold_match Heqv).
+ * unfold Values.Val.mul in Heqv. repeat (unfold_match Heqv).
+ * constructor. unfold valueToPtr, ZToValue. unfold Values.Val.mul in Heqv. repeat (unfold_match Heqv).
+ + unfold translate_eff_addressing in *. repeat (unfold_match H1). inv H1.
+ inv Heql. unfold boplitz. repeat (simplify; eval_correct_tac).
+ all: repeat (unfold_match Heqv).
+ unfold valueToPtr, ZToValue.
+ repeat unfold_match Heqv0. unfold Values.Val.mul in Heqv1. repeat unfold_match Heqv1.
+ inv Heqv1. inv Heqv0. unfold valueToInt in *.
+ assert (HPle1 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto).
+ apply H in HPle1. inv HPle1. unfold valueToInt in *. rewrite Heqv2 in H2. inv H2. auto.
+ rewrite Heqv2 in H2. inv H2.
+ rewrite Heqv2 in H3. discriminate.
+ repeat unfold_match Heqv0. unfold Values.Val.mul in Heqv1. repeat unfold_match Heqv1.
+ repeat unfold_match Heqv0. unfold Values.Val.mul in Heqv1. repeat unfold_match Heqv1.
+ constructor. unfold valueToPtr, ZToValue. inv Heqv0. inv Heqv1.
+ assert (HPle1 : Ple r0 (RTL.max_reg_function f)) by (eapply RTL.max_reg_function_use; eauto; simpl; auto).
+ apply H in HPle1. inv HPle1. unfold valueToInt in *. rewrite Heqv2 in H3. inv H3.
+
+ pose proof Integers.Ptrofs.agree32_add as AGR; unfold Integers.Ptrofs.agree32 in AGR. unfold ZToValue.
+ apply ptrofs_inj. unfold Ptrofs.of_int. rewrite Ptrofs.unsigned_repr.
+ apply AGR. auto. inv H2. unfold valueToPtr, Ptrofs.of_int. rewrite Ptrofs.unsigned_repr. auto.
+ replace Ptrofs.max_unsigned with Int.max_unsigned by auto. apply Int.unsigned_range_2.
+ apply Ptrofs.unsigned_repr. apply Int.unsigned_range_2. apply Int.unsigned_range_2.
+
+ rewrite Heqv2 in H3. inv H3.
+
+ rewrite Heqv2 in H4. inv H4.
+ + unfold translate_eff_addressing in *. repeat (unfold_match H1). inv H1.
+ inv Heql. unfold boplitz. repeat (simplify; eval_correct_tac).
+ all: repeat (unfold_match Heqv).
+ eexists. split. constructor.
+ constructor. unfold valueToPtr, ZToValue. rewrite Ptrofs.add_zero_l. unfold Ptrofs.of_int.
+ rewrite Int.unsigned_repr. symmetry. apply Ptrofs.repr_unsigned.
+ unfold check_address_parameter_unsigned in *. apply Ptrofs.unsigned_range_2.
+ - unfold translate_condition in *; repeat unfold_match H1;
+ unfold translate_comparison in *; repeat unfold_match H1; inv H1;
+ unfold translate_comparisonu, translate_comparison_imm, translate_comparison_immu in *;
+ unfold Op.eval_condition, Values.Val.of_optbool, Values.Val.cmp_bool, Values.Val.cmpu_bool, bop in *;
+ simplify;
+ repeat (match goal with |- context[match ?d with _ => _ end] => destruct d eqn:? end;
+ match goal with H : context[match ?d with _ => _ end] |- _ => repeat unfold_match H end);
+ try (match goal with |- context[if ?d then _ else _] => destruct d eqn:? end);
+ simplify; repeat solve_cond;
+ try (match goal with H : ?f = _ |- context[boolToValue ?f] => rewrite H; solve [auto] end);
+ try (match goal with H : context[match ?d with _ => _ end] |- _ => repeat unfold_match H end);
+ simplify; repeat solve_cond.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ + rewrite H3 in H0. inv H0. constructor. unfold valueToInt, intToValue in *. rewrite H1. auto.
+ - admit. (* select *)
+ Admitted.
+
+ Lemma eval_cond_correct :
+ exists v' : value,
+ Verilog.expr_runp f' asr asa e v' /\
+ val_value_lessdef
+ (Values.Val.of_optbool
+ (Op.eval_condition cond
+ (map (fun r : positive => Registers.Regmap.get r rs) args) m)) v'
+ Admitted.
+
+ (** The proof of semantic preservation for the translation of instructions
+ is a simulation argument based on diagrams of the following form:
+<<
+ match_states
+ code st rs ---------------- State m st assoc
+ || |
+ || |
+ || |
+ \/ v
+ code st rs' --------------- State m st assoc'
+ match_states
+>>
+ where [tr_code c data control fin rtrn st] is assumed to hold.
+
+ The precondition and postcondition is that that should hold is [match_assocmaps rs assoc].
+ *)
+
+ Definition transl_instr_prop (instr : RTL.instruction) : Prop :=
+ forall m asr asa fin rtrn st stmt trans res,
+ tr_instr fin rtrn st (m.(HTL.mod_stk)) instr stmt trans ->
+ exists asr' asa',
+ HTL.step tge (HTL.State res m st asr asa) Events.E0 (HTL.State res m st asr' asa').
+
+ Opaque combine.
+
+ Ltac tac0 :=
+ match goal with
+ | [ |- context[Verilog.merge_arrs _ _] ] => unfold Verilog.merge_arrs
+ | [ |- context[Verilog.merge_arr] ] => unfold Verilog.merge_arr
+ | [ |- context[Verilog.merge_regs _ _] ] => unfold Verilog.merge_regs; crush; unfold_merge
+ | [ |- context[reg_stack_based_pointers] ] => unfold reg_stack_based_pointers; intros
+ | [ |- context[Verilog.arr_assocmap_set _ _ _ _] ] => unfold Verilog.arr_assocmap_set
+
+ | [ |- context[HTL.empty_stack] ] => unfold HTL.empty_stack
+
+ | [ |- context[_ # ?d <- _ ! ?d] ] => rewrite AssocMap.gss
+ | [ |- context[_ # ?d <- _ ! ?s] ] => rewrite AssocMap.gso
+ | [ |- context[(AssocMap.empty _) ! _] ] => rewrite AssocMap.gempty
+
+ | [ |- context[array_get_error _ (combine Verilog.merge_cell (arr_repeat None _) _)] ] =>
+ rewrite combine_lookup_first
+
+ | [ |- state_st_wf _ _ ] => unfold state_st_wf; inversion 1
+ | [ |- context[match_states _ _] ] => econstructor; auto
+ | [ |- match_arrs _ _ _ _ _ ] => econstructor; auto
+ | [ |- match_assocmaps _ _ _ # _ <- (posToValue _) ] =>
+ apply regs_lessdef_add_greater; [> unfold Plt; lia | assumption]
+
+ | [ H : ?asa ! ?r = Some _ |- Verilog.arr_assocmap_lookup ?asa ?r _ = Some _ ] =>
+ unfold Verilog.arr_assocmap_lookup; setoid_rewrite H; f_equal
+ | [ |- context[(AssocMap.combine _ _ _) ! _] ] =>
+ try (rewrite AssocMap.gcombine; [> | reflexivity])
+
+ | [ |- context[Registers.Regmap.get ?d (Registers.Regmap.set ?d _ _)] ] =>
+ rewrite Registers.Regmap.gss
+ | [ |- context[Registers.Regmap.get ?s (Registers.Regmap.set ?d _ _)] ] =>
+ destruct (Pos.eq_dec s d) as [EQ|EQ];
+ [> rewrite EQ | rewrite Registers.Regmap.gso; auto]
+
+ | [ H : opt_val_value_lessdef _ _ |- _ ] => invert H
+ | [ H : context[Z.of_nat (Z.to_nat _)] |- _ ] => rewrite Z2Nat.id in H; [> solve crush |]
+ | [ H : _ ! _ = Some _ |- _] => setoid_rewrite H
+ end.
+
+ Ltac small_tac := repeat (crush; try array; try ptrofs); crush; auto.
+ Ltac big_tac := repeat (crush; try array; try ptrofs; try tac0); crush; auto.
+
+ Lemma transl_inop_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : RTL.regset) (m : mem) (pc' : RTL.node),
+ (RTL.fn_code f) ! pc = Some (RTL.Inop pc') ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2.
+ Proof.
+ intros s f sp pc rs m pc' H R1 MSTATE.
+ inv_state.
+
+ unfold match_prog in TRANSL.
+ econstructor.
+ split.
+ apply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ inv CONST; assumption.
+ inv CONST; assumption.
+ (* processing of state *)
+ econstructor.
+ crush.
+ econstructor.
+ econstructor.
+ econstructor.
+
+ all: invert MARR; big_tac.
+
+ inv CONST; constructor; simplify; rewrite AssocMap.gso; auto; lia.
+
+ Unshelve. exact tt.
+ Qed.
+ Hint Resolve transl_inop_correct : htlproof.
+
+ Lemma transl_iop_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : Registers.Regmap.t Values.val) (m : mem) (op : Op.operation) (args : list Registers.reg)
+ (res0 : Registers.reg) (pc' : RTL.node) (v : Values.val),
+ (RTL.fn_code f) ! pc = Some (RTL.Iop op args res0 pc') ->
+ Op.eval_operation ge sp op (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some v ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\
+ match_states (RTL.State s f sp pc' (Registers.Regmap.set res0 v rs) m) R2.
+ Proof.
+ intros s f sp pc rs m op args res0 pc' v H H0 R1 MSTATE.
+ inv_state. inv MARR.
+ exploit eval_correct; eauto. intros. inversion H1. inversion H2.
+ econstructor. split.
+ apply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ inv CONST. assumption.
+ inv CONST. assumption.
+ econstructor; simpl; trivial.
+ constructor; trivial.
+ econstructor; simpl; eauto.
+ simpl. econstructor. econstructor.
+ apply H5. simplify.
+
+ all: big_tac.
+
+ assert (HPle: Ple res0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_def; eauto; simpl; auto).
+
+ unfold Ple in HPle. lia.
+ apply regs_lessdef_add_match. assumption.
+ apply regs_lessdef_add_greater. unfold Plt; lia. assumption.
+ assert (HPle: Ple res0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_def; eauto; simpl; auto).
+ unfold Ple in HPle; lia.
+ eapply op_stack_based; eauto.
+ inv CONST. constructor; simplify. rewrite AssocMap.gso. rewrite AssocMap.gso.
+ assumption. lia.
+ assert (HPle: Ple res0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_def; eauto; simpl; auto).
+ unfold Ple in HPle. lia.
+ rewrite AssocMap.gso. rewrite AssocMap.gso.
+ assumption. lia.
+ assert (HPle: Ple res0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_def; eauto; simpl; auto).
+ unfold Ple in HPle. lia.
+ Unshelve. exact tt.
+ Qed.
+ Hint Resolve transl_iop_correct : htlproof.
+
+ Ltac tac :=
+ repeat match goal with
+ | [ _ : error _ _ = OK _ _ _ |- _ ] => discriminate
+ | [ _ : context[if (?x && ?y) then _ else _] |- _ ] =>
+ let EQ1 := fresh "EQ" in
+ let EQ2 := fresh "EQ" in
+ destruct x eqn:EQ1; destruct y eqn:EQ2; simpl in *
+ | [ _ : context[if ?x then _ else _] |- _ ] =>
+ let EQ := fresh "EQ" in
+ destruct x eqn:EQ; simpl in *
+ | [ H : ret _ _ = _ |- _ ] => invert H
+ | [ _ : context[match ?x with | _ => _ end] |- _ ] => destruct x
+ end.
+
+ Ltac inv_arr_access :=
+ match goal with
+ | [ _ : translate_arr_access ?chunk ?addr ?args _ _ = OK ?c _ _ |- _] =>
+ destruct c, chunk, addr, args; crush; tac; crush
+ end.
+
+ Lemma transl_iload_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : Registers.Regmap.t Values.val) (m : mem) (chunk : AST.memory_chunk)
+ (addr : Op.addressing) (args : list Registers.reg) (dst : Registers.reg)
+ (pc' : RTL.node) (a v : Values.val),
+ (RTL.fn_code f) ! pc = Some (RTL.Iload chunk addr args dst pc') ->
+ Op.eval_addressing ge sp addr (map (fun r : positive => Registers.Regmap.get r rs) args) = Some a ->
+ Mem.loadv chunk m a = Some v ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\
+ match_states (RTL.State s f sp pc' (Registers.Regmap.set dst v rs) m) R2.
+ Proof.
+ intros s f sp pc rs m chunk addr args dst pc' a v H H0 H1 R1 MSTATE.
+ inv_state. inv_arr_access.
+
+ + (** Preamble *)
+ invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+
+ unfold reg_stack_based_pointers in RSBP.
+ pose proof (RSBP r0) as RSBPr0.
+
+ destruct (Registers.Regmap.get r0 rs) eqn:EQr0; crush.
+
+ rewrite ARCHI in H1. crush.
+ subst.
+
+ pose proof MASSOC as MASSOC'.
+ invert MASSOC'.
+ pose proof (H0 r0).
+ assert (HPler0 : Ple r0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; crush; eauto).
+ apply H6 in HPler0.
+ invert HPler0; try congruence.
+ rewrite EQr0 in H8.
+ invert H8.
+ clear H0. clear H6.
+
+ unfold check_address_parameter_signed in *;
+ unfold check_address_parameter_unsigned in *; crush.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET.
+
+ (** Modular preservation proof *)
+ (*assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE.
+ { rewrite HeqOFFSET.
+ apply PtrofsExtra.add_mod; crush.
+ rewrite Integers.Ptrofs.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ apply PtrofsExtra.of_int_mod.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush. }
+
+ (** Read bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); auto.
+ split; try lia; apply Integers.Ptrofs.unsigned_range_2.
+ small_tac. }
+
+ (** Normalisation proof *)
+ assert (Integers.Ptrofs.repr
+ (4 * Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET)
+ as NORMALISE.
+ { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity.
+ rewrite <- PtrofsExtra.mul_unsigned.
+ apply PtrofsExtra.mul_divu; crush; auto. }
+
+ (** Normalised bounds proof *)
+ assert (0 <=
+ Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))
+ < (RTL.fn_stacksize f / 4))
+ as NORMALISE_BOUND.
+ { split.
+ apply Integers.Ptrofs.unsigned_range_2.
+ assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity.
+ unfold Integers.Ptrofs.divu at 2 in H0.
+ rewrite H0. clear H0.
+ rewrite Integers.Ptrofs.unsigned_repr; crush.
+ apply Zmult_lt_reg_r with (p := 4); try lia.
+ repeat rewrite ZLib.div_mul_undo; try lia.
+ apply Z.div_pos; small_tac.
+ apply Z.div_le_upper_bound; small_tac. }
+
+ inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ];
+ clear NORMALISE_BOUND.
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor. crush.
+ econstructor. econstructor. econstructor. crush.
+ econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+
+ all: big_tac.
+
+ 1: {
+ assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption.
+ }
+
+ 2: {
+ assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption.
+ }
+
+ (** Match assocmaps *)
+ apply regs_lessdef_add_match; big_tac.
+
+ (** Equality proof *)
+ match goal with
+ | [ |- context [valueToNat ?x] ] =>
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat x)
+ as EXPR_OK by admit
+ end.
+ rewrite <- EXPR_OK.
+
+ specialize (H7 (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))).
+ exploit H7; big_tac.
+
+ (** RSBP preservation *)
+ unfold arr_stack_based_pointers in ASBP.
+ specialize (ASBP (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))).
+ exploit ASBP; big_tac.
+ rewrite NORMALISE in H0. rewrite H1 in H0. assumption.
+
+ + (** Preamble *)
+ invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+
+ unfold reg_stack_based_pointers in RSBP.
+ pose proof (RSBP r0) as RSBPr0.
+ pose proof (RSBP r1) as RSBPr1.
+
+ destruct (Registers.Regmap.get r0 rs) eqn:EQr0;
+ destruct (Registers.Regmap.get r1 rs) eqn:EQr1; crush.
+
+ rewrite ARCHI in H1. crush.
+ subst.
+ clear RSBPr1.
+
+ pose proof MASSOC as MASSOC'.
+ invert MASSOC'.
+ pose proof (H0 r0).
+ pose proof (H0 r1).
+ assert (HPler0 : Ple r0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; crush; eauto).
+ assert (HPler1 : Ple r1 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto).
+ apply H6 in HPler0.
+ apply H8 in HPler1.
+ invert HPler0; invert HPler1; try congruence.
+ rewrite EQr0 in H9.
+ rewrite EQr1 in H11.
+ invert H9. invert H11.
+ clear H0. clear H6. clear H8.
+
+ unfold check_address_parameter_signed in *;
+ unfold check_address_parameter_unsigned in *; crush.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int
+ (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z))
+ (Integers.Int.repr z0)))) as OFFSET.
+
+ (** Modular preservation proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE.
+ { rewrite HeqOFFSET.
+ apply PtrofsExtra.add_mod; crush; try lia.
+ rewrite Integers.Ptrofs.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ apply PtrofsExtra.of_int_mod.
+ apply IntExtra.add_mod; crush.
+ apply IntExtra.mul_mod2; crush.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush. }
+
+ (** Read bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); auto.
+ split; try lia; apply Integers.Ptrofs.unsigned_range_2.
+ small_tac. }
+
+ (** Normalisation proof *)
+ assert (Integers.Ptrofs.repr
+ (4 * Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET)
+ as NORMALISE.
+ { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity.
+ rewrite <- PtrofsExtra.mul_unsigned.
+ apply PtrofsExtra.mul_divu; crush. }
+
+ (** Normalised bounds proof *)
+ assert (0 <=
+ Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))
+ < (RTL.fn_stacksize f / 4))
+ as NORMALISE_BOUND.
+ { split.
+ apply Integers.Ptrofs.unsigned_range_2.
+ assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity.
+ unfold Integers.Ptrofs.divu at 2 in H0.
+ rewrite H0. clear H0.
+ rewrite Integers.Ptrofs.unsigned_repr; crush.
+ apply Zmult_lt_reg_r with (p := 4); try lia.
+ repeat rewrite ZLib.div_mul_undo; try lia.
+ apply Z.div_pos; small_tac.
+ apply Z.div_le_upper_bound; lia. }
+
+ inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ];
+ clear NORMALISE_BOUND.
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor. crush.
+ econstructor. econstructor. econstructor. crush.
+ econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor.
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ6]).
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor.
+
+ all: big_tac.
+
+ 1: { assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. }
+
+ 2: { assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. }
+
+ (** Match assocmaps *)
+ apply regs_lessdef_add_match; big_tac.
+
+ (** Equality proof *)
+ match goal with
+ | [ |- context [valueToNat ?x] ] =>
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat x)
+ as EXPR_OK by admit
+ end.
+ rewrite <- EXPR_OK.
+
+ specialize (H7 (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))).
+ exploit H7; big_tac.
+
+ (** RSBP preservation *)
+ unfold arr_stack_based_pointers in ASBP.
+ specialize (ASBP (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))).
+ exploit ASBP; big_tac.
+ rewrite NORMALISE in H0. rewrite H1 in H0. assumption.
+
+ + invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+ rewrite ARCHI in H0. crush.
+
+ unfold check_address_parameter_unsigned in *;
+ unfold check_address_parameter_signed in *; crush.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ rewrite ZERO in H1. clear ZERO.
+ rewrite Integers.Ptrofs.add_zero_l in H1.
+
+ remember i0 as OFFSET.
+
+ (** Modular preservation proof *)
+ rename H0 into MOD_PRESERVE.
+
+ (** Read bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as READ_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET)); big_tac. }
+
+ (** Normalisation proof *)
+ assert (Integers.Ptrofs.repr
+ (4 * Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))) = OFFSET)
+ as NORMALISE.
+ { replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) at 1 by reflexivity.
+ rewrite <- PtrofsExtra.mul_unsigned.
+ apply PtrofsExtra.mul_divu; crush. }
+
+ (** Normalised bounds proof *)
+ assert (0 <=
+ Integers.Ptrofs.unsigned (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4))
+ < (RTL.fn_stacksize f / 4))
+ as NORMALISE_BOUND.
+ { split.
+ apply Integers.Ptrofs.unsigned_range_2.
+ assert (forall x y, Integers.Ptrofs.divu x y = Integers.Ptrofs.divu x y ) by reflexivity.
+ unfold Integers.Ptrofs.divu at 2 in H0.
+ rewrite H0. clear H0.
+ rewrite Integers.Ptrofs.unsigned_repr; crush.
+ apply Zmult_lt_reg_r with (p := 4); try lia.
+ repeat rewrite ZLib.div_mul_undo; try lia.
+ apply Z.div_pos; small_tac.
+ apply Z.div_le_upper_bound; lia. }
+
+ inversion NORMALISE_BOUND as [ NORMALISE_BOUND_LOW NORMALISE_BOUND_HIGH ];
+ clear NORMALISE_BOUND.
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor. crush.
+ econstructor. econstructor. econstructor. econstructor. crush.
+
+ all: big_tac.
+
+ 1: { assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. }
+
+ 2: { assert (HPle : Ple dst (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_def. eassumption. auto.
+ apply ZExtra.Pge_not_eq. apply ZExtra.Ple_Plt_Succ. assumption. }
+
+ (** Match assocmaps *)
+ apply regs_lessdef_add_match; big_tac.
+
+ (** Equality proof *)
+ match goal with (* Prevents issues with evars *)
+ | [ |- context [valueToNat ?x] ] =>
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat x)
+ as EXPR_OK by admit
+ end.
+ rewrite <- EXPR_OK.
+
+ specialize (H7 (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))).
+ exploit H7; big_tac.
+
+ (** RSBP preservation *)
+ unfold arr_stack_based_pointers in ASBP.
+ specialize (ASBP (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu OFFSET (Integers.Ptrofs.repr 4)))).
+ exploit ASBP; big_tac.
+ rewrite NORMALISE in H0. rewrite H1 in H0. assumption.*)
+ Admitted.
+ Hint Resolve transl_iload_correct : htlproof.
+
+ Lemma transl_istore_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : Registers.Regmap.t Values.val) (m : mem) (chunk : AST.memory_chunk)
+ (addr : Op.addressing) (args : list Registers.reg) (src : Registers.reg)
+ (pc' : RTL.node) (a : Values.val) (m' : mem),
+ (RTL.fn_code f) ! pc = Some (RTL.Istore chunk addr args src pc') ->
+ Op.eval_addressing ge sp addr (map (fun r : positive => Registers.Regmap.get r rs) args) = Some a ->
+ Mem.storev chunk m a (Registers.Regmap.get src rs) = Some m' ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m') R2.
+ Proof.
+(* intros s f sp pc rs m chunk addr args src pc' a m' H H0 H1 R1 MSTATES.
+ inv_state. inv_arr_access.
+
+ + (** Preamble *)
+ invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+
+ unfold reg_stack_based_pointers in RSBP.
+ pose proof (RSBP r0) as RSBPr0.
+
+ destruct (Registers.Regmap.get r0 rs) eqn:EQr0; crush.
+
+ rewrite ARCHI in H1. crush.
+ subst.
+
+ pose proof MASSOC as MASSOC'.
+ invert MASSOC'.
+ pose proof (H0 r0).
+ assert (HPler0 : Ple r0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; crush; eauto).
+ apply H6 in HPler0.
+ invert HPler0; try congruence.
+ rewrite EQr0 in H8.
+ invert H8.
+ clear H0. clear H6.
+
+ unfold check_address_parameter_unsigned in *;
+ unfold check_address_parameter_signed in *; crush.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET.
+
+ (** Modular preservation proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE.
+ { rewrite HeqOFFSET.
+ apply PtrofsExtra.add_mod; crush; try lia.
+ rewrite Integers.Ptrofs.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ apply PtrofsExtra.of_int_mod.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush. }
+
+ (** Write bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); big_tac.
+ apply Integers.Ptrofs.unsigned_range_2. }
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor.
+ eapply Verilog.stmnt_runp_Vnonblock_arr. crush.
+ econstructor.
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ7]).
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ8]).
+ econstructor.
+ econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+
+ all: crush.
+
+ (** State Lookup *)
+ unfold Verilog.merge_regs.
+ crush.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Match states *)
+ rewrite assumption_32bit.
+ econstructor; eauto.
+
+ (** Match assocmaps *)
+ unfold Verilog.merge_regs. crush. unfold_merge.
+ apply regs_lessdef_add_greater.
+ unfold Plt; lia.
+ assumption.
+
+ (** States well formed *)
+ unfold state_st_wf. inversion 1. crush.
+ unfold Verilog.merge_regs.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Equality proof *)
+ match goal with
+ | [ |- context [valueToNat ?x] ] =>
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat x)
+ as EXPR_OK by admit
+ end.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET.
+
+ econstructor.
+ repeat split; crush.
+ unfold HTL.empty_stack.
+ crush.
+ unfold Verilog.merge_arrs.
+
+ rewrite AssocMap.gcombine.
+ 2: { reflexivity. }
+ unfold Verilog.arr_assocmap_set.
+ rewrite AssocMap.gss.
+ unfold Verilog.merge_arr.
+ rewrite AssocMap.gss.
+ setoid_rewrite H5.
+ reflexivity.
+
+ rewrite combine_length.
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ apply list_repeat_len.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len.
+ rewrite H4. reflexivity.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int (Integers.Int.repr z))) as OFFSET.
+
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ constructor.
+ erewrite combine_lookup_second.
+ simpl.
+ assert (Ple src (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H0 in H13.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H13; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+
+ assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption).
+ rewrite Z.mul_comm in H13.
+ rewrite Z_div_mult in H13; try lia.
+ replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H13 by reflexivity.
+ rewrite <- PtrofsExtra.divu_unsigned in H13; unfold_constants; try lia.
+ rewrite H13. rewrite EXPR_OK.
+ rewrite array_get_error_set_bound.
+ reflexivity.
+ unfold arr_length, arr_repeat. simpl.
+ rewrite list_repeat_len. lia.
+
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ rewrite Z2Nat.id in H15; try lia.
+ apply Zmult_lt_compat_r with (p := 4) in H15; try lia.
+ rewrite ZLib.div_mul_undo in H15; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+
+ rewrite <- EXPR_OK.
+ rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia).
+ destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4).
+ apply Z.mul_cancel_r with (p := 4) in e; try lia.
+ rewrite ZLib.div_mul_undo in e; try lia.
+ rewrite combine_lookup_first.
+ eapply H7; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+ rewrite array_gso.
+ unfold array_get_error.
+ unfold arr_repeat.
+ crush.
+ apply list_repeat_lookup.
+ lia.
+ unfold_constants.
+ intro.
+ apply Z2Nat.inj_iff in H13; try lia.
+ apply Z.div_pos; try lia.
+ apply Integers.Ptrofs.unsigned_range.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ unfold arr_stack_based_pointers.
+ intros.
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ crush.
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ crush.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor.
+ destruct (Archi.ptr64); try discriminate.
+ pose proof (RSBP src). rewrite EQ_SRC in H0.
+ assumption.
+
+ simpl.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ invert H0.
+ apply Zmult_lt_compat_r with (p := 4) in H14; try lia.
+ rewrite ZLib.div_mul_undo in H14; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+ apply ASBP; assumption.
+
+ unfold stack_bounds in *. intros.
+ simpl.
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right. right. simpl.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr; crush; try lia.
+ apply ZExtra.mod_0_bounds; crush; try lia. }
+ crush.
+ exploit (BOUNDS ptr); try lia. intros. crush.
+ exploit (BOUNDS ptr v); try lia. intros.
+ invert H0.
+ match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity.
+ assert (Mem.valid_access m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) Writable).
+ { pose proof H1. eapply Mem.store_valid_access_2 in H0.
+ exact H0. eapply Mem.store_valid_access_3. eassumption. }
+ pose proof (Mem.valid_access_store m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) v).
+ apply X in H0. invert H0. congruence.
+
+ + (** Preamble *)
+ invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+
+ unfold reg_stack_based_pointers in RSBP.
+ pose proof (RSBP r0) as RSBPr0.
+ pose proof (RSBP r1) as RSBPr1.
+
+ destruct (Registers.Regmap.get r0 rs) eqn:EQr0;
+ destruct (Registers.Regmap.get r1 rs) eqn:EQr1; crush.
+
+ rewrite ARCHI in H1. crush.
+ subst.
+ clear RSBPr1.
+
+ pose proof MASSOC as MASSOC'.
+ invert MASSOC'.
+ pose proof (H0 r0).
+ pose proof (H0 r1).
+ assert (HPler0 : Ple r0 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; crush; eauto).
+ assert (HPler1 : Ple r1 (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto).
+ apply H6 in HPler0.
+ apply H8 in HPler1.
+ invert HPler0; invert HPler1; try congruence.
+ rewrite EQr0 in H9.
+ rewrite EQr1 in H11.
+ invert H9. invert H11.
+ clear H0. clear H6. clear H8.
+
+ unfold check_address_parameter_signed in *;
+ unfold check_address_parameter_unsigned in *; crush.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int
+ (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z))
+ (Integers.Int.repr z0)))) as OFFSET.
+
+ (** Modular preservation proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET mod 4 = 0) as MOD_PRESERVE.
+ { rewrite HeqOFFSET.
+ apply PtrofsExtra.add_mod; crush; try lia.
+ rewrite Integers.Ptrofs.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ apply PtrofsExtra.of_int_mod.
+ apply IntExtra.add_mod; crush.
+ apply IntExtra.mul_mod2; crush.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush.
+ rewrite Integers.Int.unsigned_repr_eq.
+ rewrite <- Zmod_div_mod; crush. }
+
+ (** Write bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); auto.
+ split; try lia; apply Integers.Ptrofs.unsigned_range_2.
+ small_tac. }
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor.
+ eapply Verilog.stmnt_runp_Vnonblock_arr. crush.
+ econstructor.
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ9]).
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ10]).
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ11]).
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor.
+ eapply Verilog.erun_Vbinop with (EQ := ?[EQ12]).
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+ econstructor. econstructor. econstructor. econstructor.
+
+ all: crush.
+
+ (** State Lookup *)
+ unfold Verilog.merge_regs.
+ crush.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Match states *)
+ rewrite assumption_32bit.
+ econstructor; eauto.
+
+ (** Match assocmaps *)
+ unfold Verilog.merge_regs. crush. unfold_merge.
+ apply regs_lessdef_add_greater.
+ unfold Plt; lia.
+ assumption.
+
+ (** States well formed *)
+ unfold state_st_wf. inversion 1. crush.
+ unfold Verilog.merge_regs.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Equality proof *)
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat (vdiv
+ (vplus (vplus asr # r0 (ZToValue 32 z0) ?EQ11) (vmul asr # r1 (ZToValue 32 z) ?EQ12)
+ ?EQ10) (ZToValue 32 4) ?EQ9))
+ as EXPR_OK by admit.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET.
+
+ econstructor.
+ repeat split; crush.
+ unfold HTL.empty_stack.
+ crush.
+ unfold Verilog.merge_arrs.
+
+ rewrite AssocMap.gcombine.
+ 2: { reflexivity. }
+ unfold Verilog.arr_assocmap_set.
+ rewrite AssocMap.gss.
+ unfold Verilog.merge_arr.
+ rewrite AssocMap.gss.
+ setoid_rewrite H5.
+ reflexivity.
+
+ rewrite combine_length.
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ apply list_repeat_len.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len.
+ rewrite H4. reflexivity.
+
+ remember (Integers.Ptrofs.add (Integers.Ptrofs.repr (uvalueToZ asr # r0))
+ (Integers.Ptrofs.of_int
+ (Integers.Int.add (Integers.Int.mul (valueToInt asr # r1) (Integers.Int.repr z))
+ (Integers.Int.repr z0)))) as OFFSET.
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ constructor.
+ erewrite combine_lookup_second.
+ simpl.
+ assert (Ple src (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H0 in H16.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H16; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+
+ assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption).
+ rewrite Z.mul_comm in H16.
+ rewrite Z_div_mult in H16; try lia.
+ replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H16 by reflexivity.
+ rewrite <- PtrofsExtra.divu_unsigned in H16; unfold_constants; try lia.
+ rewrite H16. rewrite EXPR_OK.
+ rewrite array_get_error_set_bound.
+ reflexivity.
+ unfold arr_length, arr_repeat. simpl.
+ rewrite list_repeat_len. lia.
+
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ rewrite Z2Nat.id in H18; try lia.
+ apply Zmult_lt_compat_r with (p := 4) in H18; try lia.
+ rewrite ZLib.div_mul_undo in H18; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+
+ rewrite <- EXPR_OK.
+ rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia).
+ destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4).
+ apply Z.mul_cancel_r with (p := 4) in e; try lia.
+ rewrite ZLib.div_mul_undo in e; try lia.
+ rewrite combine_lookup_first.
+ eapply H7; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+ rewrite array_gso.
+ unfold array_get_error.
+ unfold arr_repeat.
+ crush.
+ apply list_repeat_lookup.
+ lia.
+ unfold_constants.
+ intro.
+ apply Z2Nat.inj_iff in H16; try lia.
+ apply Z.div_pos; try lia.
+ apply Integers.Ptrofs.unsigned_range.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ unfold arr_stack_based_pointers.
+ intros.
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ crush.
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ crush.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor.
+ destruct (Archi.ptr64); try discriminate.
+ pose proof (RSBP src). rewrite EQ_SRC in H0.
+ assumption.
+
+ simpl.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ invert H0.
+ apply Zmult_lt_compat_r with (p := 4) in H17; try lia.
+ rewrite ZLib.div_mul_undo in H17; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+ apply ASBP; assumption.
+
+ unfold stack_bounds in *. intros.
+ simpl.
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right. right. simpl.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr; crush; try lia.
+ apply ZExtra.mod_0_bounds; crush; try lia. }
+ crush.
+ exploit (BOUNDS ptr); try lia. intros. crush.
+ exploit (BOUNDS ptr v); try lia. intros.
+ invert H0.
+ match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity.
+ assert (Mem.valid_access m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) Writable).
+ { pose proof H1. eapply Mem.store_valid_access_2 in H0.
+ exact H0. eapply Mem.store_valid_access_3. eassumption. }
+ pose proof (Mem.valid_access_store m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) v).
+ apply X in H0. invert H0. congruence.
+
+ + invert MARR. crush.
+
+ unfold Op.eval_addressing in H0.
+ destruct (Archi.ptr64) eqn:ARCHI; crush.
+ rewrite ARCHI in H0. crush.
+
+ unfold check_address_parameter_unsigned in *;
+ unfold check_address_parameter_signed in *; crush.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ rewrite ZERO in H1. clear ZERO.
+ rewrite Integers.Ptrofs.add_zero_l in H1.
+
+ remember i0 as OFFSET.
+
+ (** Modular preservation proof *)
+ rename H0 into MOD_PRESERVE.
+
+ (** Write bounds proof *)
+ assert (Integers.Ptrofs.unsigned OFFSET < f.(RTL.fn_stacksize)) as WRITE_BOUND_HIGH.
+ { destruct (Integers.Ptrofs.unsigned OFFSET <? f.(RTL.fn_stacksize)) eqn:EQ; crush; auto.
+ unfold stack_bounds in BOUNDS.
+ exploit (BOUNDS (Integers.Ptrofs.unsigned OFFSET) (Registers.Regmap.get src rs)); auto.
+ crush.
+ replace (Integers.Ptrofs.repr 0) with (Integers.Ptrofs.zero) by reflexivity.
+ small_tac. }
+
+ (** Start of proof proper *)
+ eexists. split.
+ eapply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ apply assumption_32bit.
+ econstructor. econstructor. econstructor.
+ eapply Verilog.stmnt_runp_Vnonblock_arr. crush.
+ econstructor. econstructor. econstructor. econstructor.
+
+ all: crush.
+
+ (** State Lookup *)
+ unfold Verilog.merge_regs.
+ crush.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Match states *)
+ rewrite assumption_32bit.
+ econstructor; eauto.
+
+ (** Match assocmaps *)
+ unfold Verilog.merge_regs. crush. unfold_merge.
+ apply regs_lessdef_add_greater.
+ unfold Plt; lia.
+ assumption.
+
+ (** States well formed *)
+ unfold state_st_wf. inversion 1. crush.
+ unfold Verilog.merge_regs.
+ unfold_merge.
+ apply AssocMap.gss.
+
+ (** Equality proof *)
+ assert (Z.to_nat
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.divu
+ OFFSET
+ (Integers.Ptrofs.repr 4)))
+ =
+ valueToNat (ZToValue 32 (Integers.Ptrofs.unsigned OFFSET / 4)))
+ as EXPR_OK by admit.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ inversion MASSOC; revert HeqOFFSET; subst; clear MASSOC; intros HeqOFFSET.
+
+ econstructor.
+ repeat split; crush.
+ unfold HTL.empty_stack.
+ crush.
+ unfold Verilog.merge_arrs.
+
+ rewrite AssocMap.gcombine.
+ 2: { reflexivity. }
+ unfold Verilog.arr_assocmap_set.
+ rewrite AssocMap.gss.
+ unfold Verilog.merge_arr.
+ rewrite AssocMap.gss.
+ setoid_rewrite H5.
+ reflexivity.
+
+ rewrite combine_length.
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ apply list_repeat_len.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len.
+ rewrite H4. reflexivity.
+
+ remember i0 as OFFSET.
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ constructor.
+ erewrite combine_lookup_second.
+ simpl.
+ assert (Ple src (RTL.max_reg_function f))
+ by (eapply RTL.max_reg_function_use; eauto; simpl; auto);
+ apply H0 in H8.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; constructor; invert H8; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+
+ assert (4 * ptr / 4 = Integers.Ptrofs.unsigned OFFSET / 4) by (f_equal; assumption).
+ rewrite Z.mul_comm in H8.
+ rewrite Z_div_mult in H8; try lia.
+ replace 4 with (Integers.Ptrofs.unsigned (Integers.Ptrofs.repr 4)) in H8 by reflexivity.
+ rewrite <- PtrofsExtra.divu_unsigned in H8; unfold_constants; try lia.
+ rewrite H8. rewrite EXPR_OK.
+ rewrite array_get_error_set_bound.
+ reflexivity.
+ unfold arr_length, arr_repeat. simpl.
+ rewrite list_repeat_len. lia.
+
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ rewrite Z2Nat.id in H11; try lia.
+ apply Zmult_lt_compat_r with (p := 4) in H11; try lia.
+ rewrite ZLib.div_mul_undo in H11; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+
+ rewrite <- EXPR_OK.
+ rewrite PtrofsExtra.divu_unsigned; auto; try (unfold_constants; lia).
+ destruct (ptr ==Z Integers.Ptrofs.unsigned OFFSET / 4).
+ apply Z.mul_cancel_r with (p := 4) in e; try lia.
+ rewrite ZLib.div_mul_undo in e; try lia.
+ rewrite combine_lookup_first.
+ eapply H7; eauto.
+
+ rewrite <- array_set_len.
+ unfold arr_repeat. crush.
+ rewrite list_repeat_len. auto.
+ rewrite array_gso.
+ unfold array_get_error.
+ unfold arr_repeat.
+ crush.
+ apply list_repeat_lookup.
+ lia.
+ unfold_constants.
+ intro.
+ apply Z2Nat.inj_iff in H8; try lia.
+ apply Z.div_pos; try lia.
+ apply Integers.Ptrofs.unsigned_range.
+
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ unfold arr_stack_based_pointers.
+ intros.
+ destruct (4 * ptr ==Z Integers.Ptrofs.unsigned OFFSET).
+
+ crush.
+ erewrite Mem.load_store_same.
+ 2: { rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite e.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ exact H1.
+ apply Integers.Ptrofs.unsigned_range_2. }
+ crush.
+ destruct (Registers.Regmap.get src rs) eqn:EQ_SRC; try constructor.
+ destruct (Archi.ptr64); try discriminate.
+ pose proof (RSBP src). rewrite EQ_SRC in H0.
+ assumption.
+
+ simpl.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr.
+ simpl.
+ destruct (Z_le_gt_dec (4 * ptr + 4) (Integers.Ptrofs.unsigned OFFSET)); eauto.
+ right.
+ apply ZExtra.mod_0_bounds; try lia.
+ apply ZLib.Z_mod_mult'.
+ invert H0.
+ apply Zmult_lt_compat_r with (p := 4) in H9; try lia.
+ rewrite ZLib.div_mul_undo in H9; try lia.
+ split; try lia.
+ apply Z.le_trans with (m := RTL.fn_stacksize f); crush; lia.
+ }
+ apply ASBP; assumption.
+
+ unfold stack_bounds in *. intros.
+ simpl.
+ assert (Integers.Ptrofs.repr 0 = Integers.Ptrofs.zero) as ZERO by reflexivity.
+ erewrite Mem.load_store_other with (m1 := m).
+ 2: { exact H1. }
+ 2: { right. right. simpl.
+ rewrite ZERO.
+ rewrite Integers.Ptrofs.add_zero_l.
+ rewrite Integers.Ptrofs.unsigned_repr; crush; try lia.
+ apply ZExtra.mod_0_bounds; crush; try lia. }
+ crush.
+ exploit (BOUNDS ptr); try lia. intros. crush.
+ exploit (BOUNDS ptr v); try lia. intros.
+ invert H0.
+ match goal with | |- ?x = _ => destruct x eqn:EQ end; try reflexivity.
+ assert (Mem.valid_access m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) Writable).
+ { pose proof H1. eapply Mem.store_valid_access_2 in H0.
+ exact H0. eapply Mem.store_valid_access_3. eassumption. }
+ pose proof (Mem.valid_access_store m AST.Mint32 sp'
+ (Integers.Ptrofs.unsigned
+ (Integers.Ptrofs.add (Integers.Ptrofs.repr 0)
+ (Integers.Ptrofs.repr ptr))) v).
+ apply X in H0. invert H0. congruence.*)
+ Admitted.
+ Hint Resolve transl_istore_correct : htlproof.
+
+ Lemma transl_icond_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : Registers.Regmap.t Values.val) (m : mem) (cond : Op.condition) (args : list Registers.reg)
+ (ifso ifnot : RTL.node) (b : bool) (pc' : RTL.node),
+ (RTL.fn_code f) ! pc = Some (RTL.Icond cond args ifso ifnot) ->
+ Op.eval_condition cond (map (fun r : positive => Registers.Regmap.get r rs) args) m = Some b ->
+ pc' = (if b then ifso else ifnot) ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2.
+ Proof.
+ intros s f sp pc rs m cond args ifso ifnot b pc' H H0 H1 R1 MSTATE.
+ inv_state.
+
+ eexists. split. apply Smallstep.plus_one.
+ eapply HTL.step_module; eauto.
+ inv CONST; assumption.
+ inv CONST; assumption.
+(* eapply Verilog.stmnt_runp_Vnonblock_reg with
+ (rhsval := if b then posToValue 32 ifso else posToValue 32 ifnot).
+ constructor.
+
+ simpl.
+ destruct b.
+ eapply Verilog.erun_Vternary_true.
+ eapply eval_cond_correct; eauto.
+ constructor.
+ apply boolToValue_ValueToBool.
+ eapply Verilog.erun_Vternary_false.
+ eapply eval_cond_correct; eauto.
+ constructor.
+ apply boolToValue_ValueToBool.
+ constructor.
+
+ big_tac.
+
+ invert MARR.
+ destruct b; rewrite assumption_32bit; big_tac.
+
+ Unshelve.
+ constructor.
+ Qed.*)
+ Admitted.
+ Hint Resolve transl_icond_correct : htlproof.
+
+ Lemma transl_ijumptable_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (sp : Values.val) (pc : positive)
+ (rs : Registers.Regmap.t Values.val) (m : mem) (arg : Registers.reg) (tbl : list RTL.node)
+ (n : Integers.Int.int) (pc' : RTL.node),
+ (RTL.fn_code f) ! pc = Some (RTL.Ijumptable arg tbl) ->
+ Registers.Regmap.get arg rs = Values.Vint n ->
+ list_nth_z tbl (Integers.Int.unsigned n) = Some pc' ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f sp pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\ match_states (RTL.State s f sp pc' rs m) R2.
+ Proof.
+ intros s f sp pc rs m arg tbl n pc' H H0 H1 R1 MSTATE.
+ Admitted.
+ Hint Resolve transl_ijumptable_correct : htlproof.
+
+ Lemma transl_ireturn_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (stk : Values.block)
+ (pc : positive) (rs : RTL.regset) (m : mem) (or : option Registers.reg)
+ (m' : mem),
+ (RTL.fn_code f) ! pc = Some (RTL.Ireturn or) ->
+ Mem.free m stk 0 (RTL.fn_stacksize f) = Some m' ->
+ forall R1 : HTL.state,
+ match_states (RTL.State s f (Values.Vptr stk Integers.Ptrofs.zero) pc rs m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\
+ match_states (RTL.Returnstate s (Registers.regmap_optget or Values.Vundef rs) m') R2.
+ Proof.
+ intros s f stk pc rs m or m' H H0 R1 MSTATE.
+ inv_state.
+
+ - econstructor. split.
+ eapply Smallstep.plus_two.
+
+ eapply HTL.step_module; eauto.
+ inv CONST; assumption.
+ inv CONST; assumption.
+ constructor.
+ econstructor; simpl; trivial.
+ econstructor; simpl; trivial.
+ constructor.
+ econstructor; simpl; trivial.
+ constructor.
+
+ constructor. constructor.
+
+ unfold state_st_wf in WF; big_tac; eauto.
+ destruct wf as [HCTRL HDATA]. apply HCTRL.
+ apply AssocMapExt.elements_iff. eexists.
+ match goal with H: control ! pc = Some _ |- _ => apply H end.
+
+ apply HTL.step_finish.
+ unfold Verilog.merge_regs.
+ unfold_merge; simpl.
+ rewrite AssocMap.gso.
+ apply AssocMap.gss. lia.
+ apply AssocMap.gss.
+ rewrite Events.E0_left. reflexivity.
+
+ constructor; auto.
+ constructor.
+
+ (* FIXME: Duplication *)
+ - econstructor. split.
+ eapply Smallstep.plus_two.
+ eapply HTL.step_module; eauto.
+ inv CONST; assumption.
+ inv CONST; assumption.
+ constructor.
+ econstructor; simpl; trivial.
+ econstructor; simpl; trivial.
+ constructor. constructor. constructor.
+ constructor. constructor. constructor.
+
+ unfold state_st_wf in WF; big_tac; eauto.
+
+ destruct wf as [HCTRL HDATA]. apply HCTRL.
+ apply AssocMapExt.elements_iff. eexists.
+ match goal with H: control ! pc = Some _ |- _ => apply H end.
+
+ apply HTL.step_finish.
+ unfold Verilog.merge_regs.
+ unfold_merge.
+ rewrite AssocMap.gso.
+ apply AssocMap.gss. simpl; lia.
+ apply AssocMap.gss.
+ rewrite Events.E0_left. trivial.
+
+ constructor; auto.
+
+ simpl. inversion MASSOC. subst.
+ unfold find_assocmap, AssocMapExt.get_default. rewrite AssocMap.gso.
+ apply H1. eapply RTL.max_reg_function_use. eauto. simpl; tauto.
+ assert (HPle : Ple r (RTL.max_reg_function f)).
+ eapply RTL.max_reg_function_use. eassumption. simpl; auto.
+ apply ZExtra.Ple_not_eq. apply ZExtra.Ple_Plt_Succ. assumption.
+
+ Unshelve.
+ all: constructor.
+ Qed.
+ Hint Resolve transl_ireturn_correct : htlproof.
+
+ Lemma transl_callstate_correct:
+ forall (s : list RTL.stackframe) (f : RTL.function) (args : list Values.val)
+ (m : mem) (m' : Mem.mem') (stk : Values.block),
+ Mem.alloc m 0 (RTL.fn_stacksize f) = (m', stk) ->
+ forall R1 : HTL.state,
+ match_states (RTL.Callstate s (AST.Internal f) args m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\
+ match_states
+ (RTL.State s f (Values.Vptr stk Integers.Ptrofs.zero) (RTL.fn_entrypoint f)
+ (RTL.init_regs args (RTL.fn_params f)) m') R2.
+ Proof.
+ intros s f args m m' stk H R1 MSTATE.
+
+ inversion MSTATE; subst. inversion TF; subst.
+ econstructor. split. apply Smallstep.plus_one.
+ eapply HTL.step_call. crush.
+
+ apply match_state with (sp' := stk); eauto.
+
+ all: big_tac.
+
+ apply regs_lessdef_add_greater. unfold Plt; lia.
+ apply regs_lessdef_add_greater. unfold Plt; lia.
+ apply regs_lessdef_add_greater. unfold Plt; lia.
+ apply init_reg_assoc_empty.
+
+ constructor.
+
+ destruct (Mem.load AST.Mint32 m' stk
+ (Integers.Ptrofs.unsigned (Integers.Ptrofs.add
+ Integers.Ptrofs.zero
+ (Integers.Ptrofs.repr (4 * ptr))))) eqn:LOAD.
+ pose proof Mem.load_alloc_same as LOAD_ALLOC.
+ pose proof H as ALLOC.
+ eapply LOAD_ALLOC in ALLOC.
+ 2: { exact LOAD. }
+ ptrofs. rewrite LOAD.
+ rewrite ALLOC.
+ repeat constructor.
+
+ ptrofs. rewrite LOAD.
+ repeat constructor.
+
+ unfold reg_stack_based_pointers. intros.
+ unfold RTL.init_regs; crush.
+ destruct (RTL.fn_params f);
+ rewrite Registers.Regmap.gi; constructor.
+
+ unfold arr_stack_based_pointers. intros.
+ crush.
+ destruct (Mem.load AST.Mint32 m' stk
+ (Integers.Ptrofs.unsigned (Integers.Ptrofs.add
+ Integers.Ptrofs.zero
+ (Integers.Ptrofs.repr (4 * ptr))))) eqn:LOAD.
+ pose proof Mem.load_alloc_same as LOAD_ALLOC.
+ pose proof H as ALLOC.
+ eapply LOAD_ALLOC in ALLOC.
+ 2: { exact LOAD. }
+ rewrite ALLOC.
+ repeat constructor.
+ constructor.
+
+ Transparent Mem.alloc. (* TODO: Since there are opaque there's probably a lemma. *)
+ Transparent Mem.load.
+ Transparent Mem.store.
+ unfold stack_bounds.
+ split.
+
+ unfold Mem.alloc in H.
+ invert H.
+ crush.
+ unfold Mem.load.
+ intros.
+ match goal with | |- context[if ?x then _ else _] => destruct x end; try congruence.
+ invert v0. unfold Mem.range_perm in H4.
+ unfold Mem.perm in H4. crush.
+ unfold Mem.perm_order' in H4.
+ small_tac.
+ exploit (H4 ptr). rewrite Integers.Ptrofs.unsigned_repr; small_tac. intros.
+ rewrite Maps.PMap.gss in H8.
+ match goal with | H8 : context[if ?x then _ else _] |- _ => destruct x eqn:EQ end; try contradiction.
+ crush.
+ apply proj_sumbool_true in H10. lia.
+
+ unfold Mem.alloc in H.
+ invert H.
+ crush.
+ unfold Mem.store.
+ intros.
+ match goal with | |- context[if ?x then _ else _] => destruct x end; try congruence.
+ invert v0. unfold Mem.range_perm in H4.
+ unfold Mem.perm in H4. crush.
+ unfold Mem.perm_order' in H4.
+ small_tac.
+ exploit (H4 ptr). rewrite Integers.Ptrofs.unsigned_repr; small_tac. intros.
+ rewrite Maps.PMap.gss in H8.
+ match goal with | H8 : context[if ?x then _ else _] |- _ => destruct x eqn:EQ end; try contradiction.
+ crush.
+ apply proj_sumbool_true in H10. lia.
+ constructor. simplify. rewrite AssocMap.gss.
+ simplify. rewrite AssocMap.gso. apply AssocMap.gss. simplify. lia.
+ Opaque Mem.alloc.
+ Opaque Mem.load.
+ Opaque Mem.store.
+ Qed.
+ Hint Resolve transl_callstate_correct : htlproof.
+
+ Lemma transl_returnstate_correct:
+ forall (res0 : Registers.reg) (f : RTL.function) (sp : Values.val) (pc : RTL.node)
+ (rs : RTL.regset) (s : list RTL.stackframe) (vres : Values.val) (m : mem)
+ (R1 : HTL.state),
+ match_states (RTL.Returnstate (RTL.Stackframe res0 f sp pc rs :: s) vres m) R1 ->
+ exists R2 : HTL.state,
+ Smallstep.plus HTL.step tge R1 Events.E0 R2 /\
+ match_states (RTL.State s f sp pc (Registers.Regmap.set res0 vres rs) m) R2.
+ Proof.
+ intros res0 f sp pc rs s vres m R1 MSTATE.
+ inversion MSTATE. inversion MF.
+ Qed.
+ Hint Resolve transl_returnstate_correct : htlproof.
+
+ Lemma option_inv :
+ forall A x y,
+ @Some A x = Some y -> x = y.
+ Proof. intros. inversion H. trivial. Qed.
+
+ Lemma main_tprog_internal :
+ forall b,
+ Globalenvs.Genv.find_symbol tge tprog.(AST.prog_main) = Some b ->
+ exists f, Genv.find_funct_ptr (Genv.globalenv tprog) b = Some (AST.Internal f).
+ Proof.
+ intros.
+ destruct TRANSL. unfold main_is_internal in H1.
+ repeat (unfold_match H1). replace b with b0.
+ exploit function_ptr_translated; eauto. intros [tf [A B]].
+ unfold transl_fundef, AST.transf_partial_fundef, Errors.bind in B.
+ unfold_match B. inv B. econstructor. apply A.
+
+ apply option_inv. rewrite <- Heqo. rewrite <- H.
+ rewrite symbols_preserved. replace (AST.prog_main tprog) with (AST.prog_main prog).
+ trivial. symmetry; eapply Linking.match_program_main; eauto.
+ Qed.
+
+ Lemma transl_initial_states :
+ forall s1 : Smallstep.state (RTL.semantics prog),
+ Smallstep.initial_state (RTL.semantics prog) s1 ->
+ exists s2 : Smallstep.state (HTL.semantics tprog),
+ Smallstep.initial_state (HTL.semantics tprog) s2 /\ match_states s1 s2.
+ Proof.
+ induction 1.
+ destruct TRANSL. unfold main_is_internal in H4.
+ repeat (unfold_match H4).
+ assert (f = AST.Internal f1). apply option_inv.
+ rewrite <- Heqo0. rewrite <- H1. replace b with b0.
+ auto. apply option_inv. rewrite <- H0. rewrite <- Heqo.
+ trivial.
+ exploit function_ptr_translated; eauto.
+ intros [tf [A B]].
+ unfold transl_fundef, Errors.bind in B.
+ unfold AST.transf_partial_fundef, Errors.bind in B.
+ repeat (unfold_match B). inversion B. subst.
+ exploit main_tprog_internal; eauto; intros.
+ rewrite symbols_preserved. replace (AST.prog_main tprog) with (AST.prog_main prog).
+ apply Heqo. symmetry; eapply Linking.match_program_main; eauto.
+ inversion H5.
+ econstructor; split. econstructor.
+ apply (Genv.init_mem_transf_partial TRANSL'); eauto.
+ replace (AST.prog_main tprog) with (AST.prog_main prog).
+ rewrite symbols_preserved; eauto.
+ symmetry; eapply Linking.match_program_main; eauto.
+ apply H6.
+
+ constructor.
+ apply transl_module_correct.
+ assert (Some (AST.Internal x) = Some (AST.Internal m)).
+ replace (AST.fundef HTL.module) with (HTL.fundef).
+ rewrite <- H6. setoid_rewrite <- A. trivial.
+ trivial. inv H7. assumption.
+ Qed.
+ Hint Resolve transl_initial_states : htlproof.
+
+ Lemma transl_final_states :
+ forall (s1 : Smallstep.state (RTL.semantics prog))
+ (s2 : Smallstep.state (HTL.semantics tprog))
+ (r : Integers.Int.int),
+ match_states s1 s2 ->
+ Smallstep.final_state (RTL.semantics prog) s1 r ->
+ Smallstep.final_state (HTL.semantics tprog) s2 r.
+ Proof.
+ intros. inv H0. inv H. inv H4. invert MF. constructor. reflexivity.
+ Qed.
+ Hint Resolve transl_final_states : htlproof.
+
+ Theorem transl_step_correct:
+ forall (S1 : RTL.state) t S2,
+ RTL.step ge S1 t S2 ->
+ forall (R1 : HTL.state),
+ match_states S1 R1 ->
+ exists R2, Smallstep.plus HTL.step tge R1 t R2 /\ match_states S2 R2.
+ Proof.
+ induction 1; eauto with htlproof; (intros; inv_state).
+ Qed.
+ Hint Resolve transl_step_correct : htlproof.
Theorem transf_program_correct:
Smallstep.forward_simulation (RTL.semantics prog) (HTL.semantics tprog).
Proof.
- (* eapply Smallstep.forward_simulation_plus; eauto with htlproof. *)
- (* apply senv_preserved. *)
- (* Qed. *)
- Admitted.
+ eapply Smallstep.forward_simulation_plus; eauto with htlproof.
+ apply senv_preserved.
+ Qed.
End CORRECTNESS.
diff --git a/src/translation/HTLgenspec.v b/src/translation/HTLgenspec.v
index 82b6da9..93d5612 100644
--- a/src/translation/HTLgenspec.v
+++ b/src/translation/HTLgenspec.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -18,7 +18,7 @@
From compcert Require RTL Op Maps Errors.
From compcert Require Import Maps Integers.
-From coqup Require Import Coquplib Verilog ValueInt HTL HTLgen AssocMap.
+From vericert Require Import Vericertlib Verilog ValueInt HTL HTLgen AssocMap.
Require Import Lia.
Hint Resolve Maps.PTree.elements_keys_norepet : htlspec.
@@ -138,19 +138,16 @@ Inductive tr_instr (fin rtrn st stk : reg) : RTL.instruction -> stmnt -> stmnt -
tr_instr fin rtrn st stk (RTL.Ireturn (Some r))
(Vseq (block fin (Vlit (ZToValue 1%Z))) (block rtrn (Vvar r))) Vskip
| tr_instr_Iload :
- forall chunk addr args s s' i e dst n,
+ forall mem addr args s s' i c dst n,
Z.pos n <= Int.max_unsigned ->
- chunk = AST.Mint32 ->
- translate_arr_addressing addr args s = OK e s' i ->
- tr_instr fin rtrn st stk (RTL.Iload chunk addr args dst n)
- (create_single_cycle_load stk e dst) (state_goto st n)
+ translate_arr_access mem addr args stk s = OK c s' i ->
+ tr_instr fin rtrn st stk (RTL.Iload mem addr args dst n) (nonblock dst c) (state_goto st n)
| tr_instr_Istore :
- forall chunk addr args s s' i e src n,
+ forall mem addr args s s' i c src n,
Z.pos n <= Int.max_unsigned ->
- chunk = AST.Mint32 ->
- translate_arr_addressing addr args s = OK e s' i ->
- tr_instr fin rtrn st stk (RTL.Istore chunk addr args src n)
- (create_single_cycle_store stk e src) (state_goto st n)
+ translate_arr_access mem addr args stk s = OK c s' i ->
+ tr_instr fin rtrn st stk (RTL.Istore mem addr args src n) (Vnonblock c (Vvar src))
+ (state_goto st n)
| tr_instr_Ijumptable :
forall cexpr tbl r,
cexpr = tbl_to_case_expr st tbl ->
@@ -178,7 +175,7 @@ Inductive tr_module (f : RTL.function) : module -> Prop :=
st stk stk_len fin rtrn start rst clk scldecls arrdecls wf) ->
(forall pc i, Maps.PTree.get pc f.(RTL.fn_code) = Some i ->
tr_code f.(RTL.fn_code) pc i data control fin rtrn st stk) ->
- stk_len = Z.to_nat f.(RTL.fn_stacksize) ->
+ stk_len = Z.to_nat (f.(RTL.fn_stacksize) / 4) ->
Z.modulo (f.(RTL.fn_stacksize)) 4 = 0 ->
0 <= f.(RTL.fn_stacksize) < Integers.Ptrofs.modulus ->
st = ((RTL.max_reg_function f) + 1)%positive ->
@@ -343,15 +340,6 @@ Proof.
Qed.
Hint Resolve translate_eff_addressing_freshreg_trans : htlspec.
-Lemma translate_arr_addressing_freshreg_trans :
- forall op args s r s' i,
- translate_arr_addressing op args s = OK r s' i ->
- s.(st_freshreg) = s'.(st_freshreg).
-Proof.
- destruct op; intros; simpl in *; repeat (unfold_match H); inv H; auto.
-Qed.
-Hint Resolve translate_eff_addressing_freshreg_trans : htlspec.
-
Lemma translate_comparison_freshreg_trans :
forall op args s r s' i,
translate_comparison op args s = OK r s' i ->
@@ -407,6 +395,15 @@ Proof.
Qed.
Hint Resolve translate_instr_freshreg_trans : htlspec.
+Lemma translate_arr_access_freshreg_trans :
+ forall mem addr args st s r s' i,
+ translate_arr_access mem addr args st s = OK r s' i ->
+ s.(st_freshreg) = s'.(st_freshreg).
+Proof.
+ intros. unfold translate_arr_access in H. repeat (unfold_match H); inv H; eauto with htlspec.
+Qed.
+Hint Resolve translate_arr_access_freshreg_trans : htlspec.
+
Lemma add_instr_freshreg_trans :
forall n n' st s r s' i,
add_instr n n' st s = OK r s' i ->
@@ -444,15 +441,10 @@ Proof.
destruct i0; try (monadInv H); try (unfold_match H); eauto with htlspec.
- monadInv H. apply add_instr_freshreg_trans in EQ2. apply translate_instr_freshreg_trans in EQ.
apply declare_reg_freshreg_trans in EQ1. congruence.
- - destruct (Z.pos n0 <=? Int.max_unsigned); try discriminate.
- monadInv H. apply add_instr_freshreg_trans in EQ2.
- apply translate_arr_addressing_freshreg_trans in EQ.
+ - monadInv H. apply add_instr_freshreg_trans in EQ2. apply translate_arr_access_freshreg_trans in EQ.
apply declare_reg_freshreg_trans in EQ1. congruence.
- - destruct (Z.pos n0 <=? Int.max_unsigned); try discriminate.
- monadInv H. apply add_instr_freshreg_trans in EQ0.
- apply translate_arr_addressing_freshreg_trans in EQ. congruence.
- - monadInv H. apply translate_condition_freshreg_trans in EQ.
- apply add_branch_instr_freshreg_trans in EQ0.
+ - monadInv H. apply add_instr_freshreg_trans in EQ0. apply translate_arr_access_freshreg_trans in EQ. congruence.
+ - monadInv H. apply translate_condition_freshreg_trans in EQ. apply add_branch_instr_freshreg_trans in EQ0.
congruence.
- inv EQ. apply add_node_skip_freshreg_trans in EQ0. congruence.
Qed.
@@ -522,8 +514,7 @@ Proof.
destruct (peq pc pc1).
- subst.
destruct instr1 eqn:?; try discriminate;
- try destruct_optional; try (destruct m; try discriminate);
- inv_add_instr; econstructor; try assumption.
+ try destruct_optional; inv_add_instr; econstructor; try assumption.
+ destruct o with pc1; destruct H11; simpl in *; rewrite AssocMap.gss in H9; eauto; congruence.
+ destruct o0 with pc1; destruct H11; simpl in *; rewrite AssocMap.gss in H9; eauto; congruence.
+ inversion H2. inversion H9. rewrite H. apply tr_instr_Inop.
@@ -540,7 +531,6 @@ Proof.
+ destruct o0 with pc1; destruct H16; simpl in *; rewrite AssocMap.gss in H14; eauto; congruence.
+ inversion H2. inversion H14. rewrite <- e2. replace (st_st s2) with (st_st s0) by congruence.
econstructor. apply Z.leb_le; assumption.
- reflexivity.
apply EQ1. eapply in_map with (f := fst) in H14. contradiction.
+ destruct o with pc1; destruct H11; simpl in *; rewrite AssocMap.gss in H9; eauto; congruence.
@@ -549,7 +539,7 @@ Proof.
* inversion H2.
replace (st_st s2) with (st_st s0) by congruence.
econstructor. apply Z.leb_le; assumption.
- eauto with htlspec. eassumption.
+ eauto with htlspec.
* apply in_map with (f := fst) in H2. contradiction.
+ destruct o with pc1; destruct H11; simpl in *; rewrite AssocMap.gss in H9; eauto; congruence.
diff --git a/src/translation/Veriloggen.v b/src/translation/Veriloggen.v
index f5d5fa7..a0be0fa 100644
--- a/src/translation/Veriloggen.v
+++ b/src/translation/Veriloggen.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
From compcert Require Import Maps.
From compcert Require Errors.
From compcert Require Import AST.
-From coqup Require Import Verilog HTL Coquplib AssocMap ValueInt.
+From vericert Require Import Verilog HTL Vericertlib AssocMap ValueInt.
Definition transl_list_fun (a : node * Verilog.stmnt) :=
let (n, stmnt) := a in
diff --git a/src/translation/Veriloggenproof.v b/src/translation/Veriloggenproof.v
index 5b467a7..9abbd4b 100644
--- a/src/translation/Veriloggenproof.v
+++ b/src/translation/Veriloggenproof.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,8 @@
*)
From compcert Require Import Smallstep Linking Integers Globalenvs.
-From coqup Require HTL.
-From coqup Require Import Coquplib Veriloggen Verilog ValueInt AssocMap.
+From vericert Require HTL.
+From vericert Require Import Vericertlib Veriloggen Verilog ValueInt AssocMap.
Require Import Lia.
Local Open Scope assocmap.
diff --git a/src/verilog/Array.v b/src/verilog/Array.v
index be06541..02b6d33 100644
--- a/src/verilog/Array.v
+++ b/src/verilog/Array.v
@@ -1,7 +1,7 @@
Set Implicit Arguments.
Require Import Lia.
-Require Import Coquplib.
+Require Import Vericertlib.
From Coq Require Import Lists.List Datatypes.
Import ListNotations.
diff --git a/src/verilog/AssocMap.v b/src/verilog/AssocMap.v
index c5cfa3f..8d8788a 100644
--- a/src/verilog/AssocMap.v
+++ b/src/verilog/AssocMap.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*)
-From coqup Require Import Coquplib ValueInt.
+From vericert Require Import Vericertlib ValueInt.
From compcert Require Import Maps.
Definition reg := positive.
diff --git a/src/verilog/HTL.v b/src/verilog/HTL.v
index b3d1442..620ef14 100644
--- a/src/verilog/HTL.v
+++ b/src/verilog/HTL.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -17,8 +17,8 @@
*)
From Coq Require Import FSets.FMapPositive.
-From coqup Require Import Coquplib ValueInt AssocMap Array.
-From coqup Require Verilog.
+From vericert Require Import Vericertlib ValueInt AssocMap Array.
+From vericert Require Verilog.
From compcert Require Events Globalenvs Smallstep Integers Values.
From compcert Require Import Maps.
diff --git a/src/verilog/PrintHTL.ml b/src/verilog/PrintHTL.ml
index 36fdd3c..44f8b01 100644
--- a/src/verilog/PrintHTL.ml
+++ b/src/verilog/PrintHTL.ml
@@ -1,5 +1,5 @@
(* -*- mode: tuareg -*-
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*)
-open ValueInt
+open Value
open Datatypes
open Camlcoq
open AST
@@ -27,7 +27,7 @@ open AST
open HTL
open PrintAST
open PrintVerilog
-open CoqupClflags
+open VericertClflags
let pstr pp = fprintf pp "%s"
diff --git a/src/verilog/PrintVerilog.ml b/src/verilog/PrintVerilog.ml
index a172b3a..f348ee6 100644
--- a/src/verilog/PrintVerilog.ml
+++ b/src/verilog/PrintVerilog.ml
@@ -1,5 +1,5 @@
(* -*- mode: tuareg -*-
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
*)
open Verilog
-open ValueInt
+open Value
open Datatypes
open Camlcoq
@@ -26,7 +26,7 @@ open Clflags
open Printf
-open CoqupClflags
+open VericertClflags
let concat = String.concat ""
@@ -70,30 +70,16 @@ let unop = function
let register a = sprintf "reg_%d" (P.to_int a)
-let literal l = sprintf "32'd%d" (Z.to_int (uvalueToZ l))
+let literal l = sprintf "%d'd%d" (Nat.to_int l.vsize) (Z.to_int (uvalueToZ l))
-let literal_int i = sprintf "32'd%d" i
-
-let byte n s = sprintf "reg_%d[%d:%d]" (P.to_int s) (7 + n * 8) (n * 8)
-
-
-let rec pprint_expr =
- let array_byte r i = function
- | 0 -> concat [register r; "["; pprint_expr i; "]"]
- | n -> concat [register r; "["; pprint_expr i; " + "; literal_int n; "][7:0]"]
- in function
+let rec pprint_expr = function
| Vlit l -> literal l
| Vvar s -> register s
- | Vvarb0 s -> byte 0 s
- | Vvarb1 s -> byte 1 s
- | Vvarb2 s -> byte 2 s
- | Vvarb3 s -> byte 3 s
| Vvari (s, i) -> concat [register s; "["; pprint_expr i; "]"]
| Vinputvar s -> register s
| Vunop (u, e) -> concat ["("; unop u; pprint_expr e; ")"]
| Vbinop (op, a, b) -> concat [pprint_binop (pprint_expr a) (pprint_expr b) op]
| Vternary (c, t, f) -> concat ["("; pprint_expr c; " ? "; pprint_expr t; " : "; pprint_expr f; ")"]
- | Vload (s, i) -> concat ["{"; array_byte s i 3; ", "; array_byte s i 2; ", "; array_byte s i 1; ", "; array_byte s i 0; "}"]
let rec pprint_stmnt i =
let pprint_case (e, s) = concat [ indent (i + 1); pprint_expr e; ": begin\n"; pprint_stmnt (i + 2) s;
@@ -183,12 +169,9 @@ let testbench = "module testbench;
always #5 clk = ~clk;
- reg [31:0] count;
- initial count = 0;
always @(posedge clk) begin
- count <= count + 1;
if (finish == 1) begin
- $display(\"finished: %d cycles %d\", return_val, count);
+ $display(\"finished: %d\", return_val);
$finish;
end
end
diff --git a/src/verilog/PrintVerilog.mli b/src/verilog/PrintVerilog.mli
index 5fd8fe9..47af3ef 100644
--- a/src/verilog/PrintVerilog.mli
+++ b/src/verilog/PrintVerilog.mli
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -18,8 +18,8 @@
val pprint_stmnt : int -> Verilog.stmnt -> string
-val print_value : out_channel -> ValueInt.value -> unit
+val print_value : out_channel -> Value.value -> unit
val print_program : bool -> out_channel -> Verilog.program -> unit
-val print_result : out_channel -> (BinNums.positive * ValueInt.value) list -> unit
+val print_result : out_channel -> (BinNums.positive * Value.value) list -> unit
diff --git a/src/verilog/Value.v b/src/verilog/Value.v
index af2b822..41a41b4 100644
--- a/src/verilog/Value.v
+++ b/src/verilog/Value.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@ From bbv Require Import Word.
From bbv Require HexNotation WordScope.
From Coq Require Import ZArith.ZArith FSets.FMapPositive Lia.
From compcert Require Import lib.Integers common.Values.
-From coqup Require Import Coquplib.
+From vericert Require Import Vericertlib.
(* end hide *)
(** * Value
diff --git a/src/verilog/ValueInt.v b/src/verilog/ValueInt.v
index 151feef..c7f69a1 100644
--- a/src/verilog/ValueInt.v
+++ b/src/verilog/ValueInt.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -21,7 +21,7 @@ From bbv Require Import Word.
From bbv Require HexNotation WordScope.
From Coq Require Import ZArith.ZArith FSets.FMapPositive Lia.
From compcert Require Import lib.Integers common.Values.
-From coqup Require Import Coquplib.
+From vericert Require Import Vericertlib.
(* end hide *)
(** * Value
@@ -77,6 +77,7 @@ Definition ptrToValue (i : ptrofs) : value := Ptrofs.to_int i.
Definition valueToPtr (i : value) : Integers.ptrofs :=
Ptrofs.of_int i.
+Search Ptrofs.of_int Ptrofs.to_int.
Definition valToValue (v : Values.val) : option value :=
match v with
| Values.Vint i => Some (intToValue i)
diff --git a/src/verilog/Verilog.v b/src/verilog/Verilog.v
index 6a1bece..3b0dd0a 100644
--- a/src/verilog/Verilog.v
+++ b/src/verilog/Verilog.v
@@ -1,5 +1,5 @@
(*
- * CoqUp: Verified high-level synthesis.
+ * Vericert: Verified high-level synthesis.
* Copyright (C) 2019-2020 Yann Herklotz <yann@yannherklotz.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -29,7 +29,7 @@ Require Import Lia.
Import ListNotations.
-From coqup Require Import common.Coquplib common.Show verilog.ValueInt IntegerExtra AssocMap Array.
+From vericert Require Import common.Vericertlib common.Show verilog.ValueInt AssocMap Array.
From compcert Require Events.
From compcert Require Import Integers Errors Smallstep Globalenvs.
@@ -155,18 +155,13 @@ Inductive unop : Type :=
(** ** Expressions *)
Inductive expr : Type :=
-| Vlit : value -> expr (** literal *)
-| Vvar : reg -> expr (** reg *)
-| Vvarb0 : reg -> expr (** 1st byte projection of reg *)
-| Vvarb1 : reg -> expr
-| Vvarb2 : reg -> expr
-| Vvarb3 : reg -> expr
-| Vvari : reg -> expr -> expr (** array *)
+| Vlit : value -> expr
+| Vvar : reg -> expr
+| Vvari : reg -> expr -> expr
| Vinputvar : reg -> expr
| Vbinop : binop -> expr -> expr -> expr
| Vunop : unop -> expr -> expr
-| Vternary : expr -> expr -> expr -> expr
-| Vload : reg -> expr -> expr. (** 4-byte concatenation load *)
+| Vternary : expr -> expr -> expr -> expr.
Definition posToExpr (p : positive) : expr :=
Vlit (posToValue p).
@@ -340,57 +335,41 @@ Definition unop_run (op : unop) (v1 : value) : value :=
Inductive expr_runp : fext -> assocmap -> assocmap_arr -> expr -> value -> Prop :=
| erun_Vlit :
- forall fext asr asa v,
- expr_runp fext asr asa (Vlit v) v
+ forall fext reg stack v,
+ expr_runp fext reg stack (Vlit v) v
| erun_Vvar :
- forall fext asr asa v r,
- asr#r = v ->
- expr_runp fext asr asa (Vvar r) v
- | erun_Vvarb0 :
- forall fext asr asa v r,
- asr#r = v ->
- expr_runp fext asr asa (Vvarb0 r) (IntExtra.ibyte0 v)
- | erun_Vvarb1 :
- forall fext asr asa v r,
- asr#r = v ->
- expr_runp fext asr asa (Vvarb1 r) (IntExtra.ibyte1 v)
- | erun_Vvarb2 :
- forall fext asr asa v r,
- asr#r = v ->
- expr_runp fext asr asa (Vvarb2 r) (IntExtra.ibyte2 v)
- | erun_Vvarb3 :
- forall fext asr asa v r,
- asr#r = v ->
- expr_runp fext asr asa (Vvarb3 r) (IntExtra.ibyte3 v)
+ forall fext reg stack v r,
+ reg#r = v ->
+ expr_runp fext reg stack (Vvar r) v
| erun_Vvari :
- forall fext asr asa v iexp i r,
- expr_runp fext asr asa iexp i ->
- arr_assocmap_lookup asa r (valueToNat i) = Some v ->
- expr_runp fext asr asa (Vvari r iexp) v
+ forall fext reg stack v iexp i r,
+ expr_runp fext reg stack iexp i ->
+ arr_assocmap_lookup stack r (valueToNat i) = Some v ->
+ expr_runp fext reg stack (Vvari r iexp) v
| erun_Vbinop :
- forall fext asr asa op l r lv rv resv,
- expr_runp fext asr asa l lv ->
- expr_runp fext asr asa r rv ->
+ forall fext reg stack op l r lv rv resv,
+ expr_runp fext reg stack l lv ->
+ expr_runp fext reg stack r rv ->
Some resv = binop_run op lv rv ->
- expr_runp fext asr asa (Vbinop op l r) resv
+ expr_runp fext reg stack (Vbinop op l r) resv
| erun_Vunop :
- forall fext asr asa u vu op oper resv,
- expr_runp fext asr asa u vu ->
+ forall fext reg stack u vu op oper resv,
+ expr_runp fext reg stack u vu ->
oper = unop_run op ->
resv = oper vu ->
- expr_runp fext asr asa (Vunop op u) resv
+ expr_runp fext reg stack (Vunop op u) resv
| erun_Vternary_true :
- forall fext asr asa c ts fs vc vt,
- expr_runp fext asr asa c vc ->
- expr_runp fext asr asa ts vt ->
+ forall fext reg stack c ts fs vc vt,
+ expr_runp fext reg stack c vc ->
+ expr_runp fext reg stack ts vt ->
valueToBool vc = true ->
- expr_runp fext asr asa (Vternary c ts fs) vt
+ expr_runp fext reg stack (Vternary c ts fs) vt
| erun_Vternary_false :
- forall fext asr asa c ts fs vc vf,
- expr_runp fext asr asa c vc ->
- expr_runp fext asr asa fs vf ->
+ forall fext reg stack c ts fs vc vf,
+ expr_runp fext reg stack c vc ->
+ expr_runp fext reg stack fs vf ->
valueToBool vc = false ->
- expr_runp fext asr asa (Vternary c ts fs) vf.
+ expr_runp fext reg stack (Vternary c ts fs) vf.
Hint Constructors expr_runp : verilog.
Definition handle_opt {A : Type} (err : errmsg) (val : option A)
@@ -450,8 +429,8 @@ Inductive location : Type :=
| LocArray (_ : reg) (_ : nat).
Inductive location_is : fext -> assocmap -> assocmap_arr -> expr -> location -> Prop :=
-| Reg : forall f asr asa r, location_is f asr asa (Vvar r) (LocReg r)
-| RegIndexed : forall f asr asa r iexp iv,
+| Base : forall f asr asa r, location_is f asr asa (Vvar r) (LocReg r)
+| Indexed : forall f asr asa r iexp iv,
expr_runp f asr asa iexp iv ->
location_is f asr asa (Vvari r iexp) (LocArray r (valueToNat iv)).
@@ -795,16 +774,11 @@ Proof.
repeat (try match goal with
| [ H : expr_runp _ _ _ (Vlit _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vvar _) _ |- _ ] => invert H
- | [ H : expr_runp _ _ _ (Vvarb0 _) _ |- _ ] => invert H
- | [ H : expr_runp _ _ _ (Vvarb1 _) _ |- _ ] => invert H
- | [ H : expr_runp _ _ _ (Vvarb2 _) _ |- _ ] => invert H
- | [ H : expr_runp _ _ _ (Vvarb3 _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vvari _ _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vinputvar _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vbinop _ _ _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vunop _ _) _ |- _ ] => invert H
| [ H : expr_runp _ _ _ (Vternary _ _ _) _ |- _ ] => invert H
- | [ H : expr_runp _ _ _ (Vload _ _) _ |- _ ] => invert H
| [ H1 : forall asr asa v, expr_runp _ asr asa ?e v -> _,
H2 : expr_runp _ _ _ ?e _ |- _ ] =>
diff --git a/test/array-addr-mask.c b/test/array-addr-mask.c
deleted file mode 100644
index 5ba5601..0000000
--- a/test/array-addr-mask.c
+++ /dev/null
@@ -1,6 +0,0 @@
-int main() {
- unsigned int x[8] = {1,2,3,4,5,6,7,8};
- unsigned int index = 6;
- unsigned int addr = index & 3;
- return (x[addr]);
-}
diff --git a/test/array-indirect.c b/test/array-indirect.c
deleted file mode 100644
index 0315da1..0000000
--- a/test/array-indirect.c
+++ /dev/null
@@ -1,13 +0,0 @@
-int main() {
- int index[2] = {1, 0};
- int x[2] = {5, 10};
- int y[2] = {0, 0};
- for(int i=0; i<2;i++){
- y[i] = x[index[i]] * (i+1);
- }
-
- int sum = 0;
- for(int j=0; j <2; j++)
- sum += y[j];
- return sum;
-}
diff --git a/test/array-out-of-bounds.c b/test/array-out-of-bounds.c
deleted file mode 100644
index 1f20c0c..0000000
--- a/test/array-out-of-bounds.c
+++ /dev/null
@@ -1,9 +0,0 @@
-int main() {
- int x[2] = {1, 2};
- int y[2] = {3, 4};
- x[2] = 0;
- int sum = 0;
- for(int i=0; i<2; i++)
- sum += (x[i] * y[i]);
- return sum;
-}
diff --git a/test/array-volatile.c b/test/array-volatile.c
deleted file mode 100644
index f12b79a..0000000
--- a/test/array-volatile.c
+++ /dev/null
@@ -1,7 +0,0 @@
-int main() {
- int x[2] = {5, 10};
- volatile int sum;
- for(int j=0; j <2; j++)
- sum += x[j];
- return sum;
-}
diff --git a/test/array-write.c b/test/array-write.c
deleted file mode 100644
index 697d6ed..0000000
--- a/test/array-write.c
+++ /dev/null
@@ -1,12 +0,0 @@
-int main() {
- int x[2] = {5, 10};
- int y[2]; //= {0 , 0};
- for(int i=0; i<2;i++){
- y[i] += x[i] ;
- }
-
- int sum = 0;
- for(int j=0; j <2; j++)
- sum += y[j];
- return sum;
-}
diff --git a/test/matrix2.c b/test/matrix2.c
deleted file mode 100644
index 96571be..0000000
--- a/test/matrix2.c
+++ /dev/null
@@ -1,23 +0,0 @@
-void matrix_multiply(int first[][2], int second[][2], int multiply[][2], int m, int q, int p, int *totalSum) {
- int sum = 0;
- for (int c = 0; c < m; c++) {
- for (int d = 0; d < q; d++) {
- for (int k = 0; k < p; k++) {
- sum = sum + first[c][k]*second[k][d];
- }
- multiply[c][d] = sum;
- *totalSum += sum;
- sum = 0;
- }
- }
-}
-
-int main() {
- int f[2][2] = {{1, 2}, {3, 4}};
- int s[2][2] = {{1, 2}, {3, 4}};
- int m[2][2] = {{0, 0}, {0, 0}};
- int sum = 0;
-
- matrix_multiply(f, s, m, 2, 2, 2, &sum);
- return sum;
-}
diff --git a/test/test_all.sh b/test/test_all.sh
index 371ed0e..d43e2ac 100755
--- a/test/test_all.sh
+++ b/test/test_all.sh
@@ -30,7 +30,7 @@ for cfile in $test_dir/*.c; do
gcc -o $outbase.gcc $cfile
$outbase.gcc
expected=$?
- ./bin/coqup -drtl -o $outbase.v $cfile
+ ./bin/vericert -drtl -o $outbase.v $cfile
iverilog -o $outbase.iverilog $outbase.v
actual=$($outbase.iverilog | sed -E -e 's/[^0-9]+([0-9]+)/\1/')
if [[ $expected = $actual ]]; then