URL
https://opencores.org/ocsvn/mod_sim_exp/mod_sim_exp/trunk
Subversion Repositories mod_sim_exp
Compare Revisions
- This comparison shows the changes necessary to convert path
/mod_sim_exp/tags/Release_1.3/sw/ModMult
- from Rev 29 to Rev 79
- ↔ Reverse comparison
Rev 29 → Rev 79
/Release/ModMult.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Release/ModMult.exe
Property changes :
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: .project
===================================================================
--- .project (nonexistent)
+++ .project (revision 79)
@@ -0,0 +1,26 @@
+
+
+ ModMult
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
Index: src/ModMult.c
===================================================================
--- src/ModMult.c (nonexistent)
+++ src/ModMult.c (revision 79)
@@ -0,0 +1,70 @@
+/*
+ ============================================================================
+ Name : ModExp.c
+ Author :
+ Version :
+ Copyright : Your copyright notice
+ Description : Hello World in C, Ansi-style
+ ============================================================================
+ */
+
+#include
+#include
+#include
+
+int main(void) {
+ unsigned int base_width;
+ mpz_t x, m, r, R, R2;
+ gmp_randstate_t state;
+
+ gmp_randinit_mt(state);
+ mpz_init(x);
+ mpz_init(m);
+ mpz_init(r);
+ mpz_init(R);
+ mpz_init(R2);
+
+ printf("-- input generator program\n");
+ printf("-- generates test values for multiplier testbench\n");
+
+ while (1){
+
+ //read in base_width
+ scanf("%d", &base_width);
+ if (base_width == 0) break;
+
+ //generate modulus (must be uneven)
+ mpz_urandomb(m, state, base_width);
+ mpz_setbit(m, 0); //uneven
+
+ //generate x
+ mpz_urandomb(x, state, base_width);
+
+ //calculate R
+ mpz_set_ui(R, 2);
+ mpz_powm_ui(R, R, base_width, m); //R = 2^n mod m
+
+ //calculate R2
+ mpz_set_ui(R2, 2);
+ mpz_powm(R2, R, R2, m); //R2 = Rē mod m = 2^2n mod m
+
+ //calculate result
+ mpz_mul(r, x, R);
+ mpz_powm_ui(r, r, 1, m);
+
+ printf("-- x, y, m, result\n");
+ gmp_printf("%Zx\n", x);
+ gmp_printf("%Zx\n", R2);
+ gmp_printf("%Zx\n", m);
+ gmp_printf("%Zx\n", r);
+ }
+
+ mpz_clear(x);
+ mpz_clear(R2);
+ mpz_clear(m);
+ mpz_clear(r);
+ mpz_clear(R);
+ gmp_randclear(state);
+
+ return EXIT_SUCCESS;
+}
Index: .cproject
===================================================================
--- .cproject (nonexistent)
+++ .cproject (revision 79)
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: .settings/org.eclipse.cdt.managedbuilder.core.prefs
===================================================================
--- .settings/org.eclipse.cdt.managedbuilder.core.prefs (nonexistent)
+++ .settings/org.eclipse.cdt.managedbuilder.core.prefs (revision 79)
@@ -0,0 +1,21 @@
+eclipse.preferences.version=1
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/CPATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/appendContributed=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/CPATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/CPATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/C_INCLUDE_PATH/delimiter=;
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/C_INCLUDE_PATH/operation=remove
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/append=true
+environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/appendContributed=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/LIBRARY_PATH/delimiter=;
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/append=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.2041168883/appendContributed=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/LIBRARY_PATH/delimiter=;
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/LIBRARY_PATH/operation=remove
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/append=true
+environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.2071011908/appendContributed=true