aboutsummaryrefslogtreecommitdiff
path: root/hal.h
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-07-14 00:20:03 -0400
committerRob Austein <sra@hactrn.net>2015-07-14 00:20:03 -0400
commit0915302b7ffa0757be1859d73f14037f338c0253 (patch)
tree80f047113c5a290c13be95758ab58a0dd0f1ab1e /hal.h
parent0ababd7dc7ab6a080971e669598a862ad23d2fa1 (diff)
Changes to support Pavel's ModExpS6 core.
Diffstat (limited to 'hal.h')
-rw-r--r--hal.h56
1 files changed, 25 insertions, 31 deletions
diff --git a/hal.h b/hal.h
index 8b731d4..4a31398 100644
--- a/hal.h
+++ b/hal.h
@@ -390,39 +390,33 @@
* MATH segment.
*/
-/* Modexp core */
-#define MODEXP_ADDR_BASE (SEGMENT_OFFSET_MATH + (0x00 * CORE_SIZE))
-#define MODEXP_ADDR_NAME0 (MODEXP_ADDR_BASE + ADDR_NAME0)
-#define MODEXP_ADDR_NAME1 (MODEXP_ADDR_BASE + ADDR_NAME1)
-#define MODEXP_ADDR_VERSION (MODEXP_ADDR_BASE + ADDR_VERSION)
-#define MODEXP_ADDR_CTRL (MODEXP_ADDR_BASE + ADDR_CTRL)
-#define MODEXP_CTRL_INIT_BIT (1)
-#define MODEXP_CTRL_NEXT_BIT (2)
-#define MODEXP_ADDR_STATUS (MODEXP_ADDR_BASE + ADDR_STATUS)
+#define MATH_CORE_SIZE (0x400)
-#define MODEXP_ADDR_DELAY (MODEXP_ADDR_BASE + 0x13)
-#define MODEXP_STATUS_READY (1)
-
-#define MODEXP_MODULUS_LENGTH (MODEXP_ADDR_BASE + 0x20)
-#define MODEXP_EXPONENT_LENGTH (MODEXP_ADDR_BASE + 0x21)
-#define MODEXP_LENGTH (MODEXP_ADDR_BASE + 0x22)
-
-#define MODEXP_MODULUS_PTR_RST (MODEXP_ADDR_BASE + 0x30)
-#define MODEXP_MODULUS_DATA (MODEXP_ADDR_BASE + 0x31)
-
-#define MODEXP_EXPONENT_PTR_RST (MODEXP_ADDR_BASE + 0x40)
-#define MODEXP_EXPONENT_DATA (MODEXP_ADDR_BASE + 0x41)
-
-#define MODEXP_MESSAGE_PTR_RST (MODEXP_ADDR_BASE + 0x50)
-#define MODEXP_MESSAGE_DATA (MODEXP_ADDR_BASE + 0x51)
-
-#define MODEXP_RESULT_PTR_RST (MODEXP_ADDR_BASE + 0x60)
-#define MODEXP_RESULT_DATA (MODEXP_ADDR_BASE + 0x61)
-
-#define MODEXP_NAME0 "mode"
-#define MODEXP_NAME1 "xp "
-#define MODEXP_VERSION "0.51"
+/*
+ * ModExpS6 core. MODEXPS6_OPERAND_BITS is size in bits of largest
+ * supported modulus.
+ */
+#define MODEXPS6_ADDR_BASE (SEGMENT_OFFSET_MATH + (0x00 * MATH_CORE_SIZE))
+#define MODEXPS6_OPERAND_BITS (4096)
+#define MODEXPS6_OPERAND_WORDS (MODEXPS6_OPERAND_BITS/32)
+#define MODEXPS6_ADDR_REGISTERS (MODEXPS6_ADDR_BASE + 0*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_ADDR_OPERANDS (MODEXPS6_ADDR_BASE + 4*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_ADDR_NAME0 (MODEXPS6_ADDR_REGISTERS + ADDR_NAME0)
+#define MODEXPS6_ADDR_NAME1 (MODEXPS6_ADDR_REGISTERS + ADDR_NAME1)
+#define MODEXPS6_ADDR_VERSION (MODEXPS6_ADDR_REGISTERS + ADDR_VERSION)
+#define MODEXPS6_ADDR_CTRL (MODEXPS6_ADDR_REGISTERS + ADDR_CTRL)
+#define MODEXPS6_ADDR_STATUS (MODEXPS6_ADDR_REGISTERS + ADDR_STATUS)
+#define MODEXPS6_ADDR_MODE (MODEXPS6_ADDR_REGISTERS + 0x10)
+#define MODEXPS6_ADDR_MODULUS_WIDTH (MODEXPS6_ADDR_REGISTERS + 0x11)
+#define MODEXPS6_ADDR_EXPONENT_WIDTH (MODEXPS6_ADDR_REGISTERS + 0x12)
+#define MODEXPS6_ADDR_MODULUS (MODEXPS6_ADDR_OPERANDS + 0*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_ADDR_MESSAGE (MODEXPS6_ADDR_OPERANDS + 1*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_ADDR_EXPONENT (MODEXPS6_ADDR_OPERANDS + 2*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_ADDR_RESULT (MODEXPS6_ADDR_OPERANDS + 3*MODEXPS6_OPERAND_WORDS)
+#define MODEXPS6_NAME0 "mode"
+#define MODEXPS6_NAME1 "xps6"
+#define MODEXPS6_VERSION "0.10"
/*
* C API error codes. Defined in this form so we can keep the tokens