aboutsummaryrefslogtreecommitdiff
path: root/sw/test-sha256
diff options
context:
space:
mode:
Diffstat (limited to 'sw/test-sha256')
-rw-r--r--sw/test-sha256/test-sha256.c107
1 files changed, 97 insertions, 10 deletions
diff --git a/sw/test-sha256/test-sha256.c b/sw/test-sha256/test-sha256.c
index 25845d0..9f7b331 100644
--- a/sw/test-sha256/test-sha256.c
+++ b/sw/test-sha256/test-sha256.c
@@ -19,9 +19,13 @@
//------------------------------------------------------------------------------
// Defines
//------------------------------------------------------------------------------
-#define SHA256_PREFIX (0x14)
+#define SHA256_PREFIX (0x0000)
#define SHA_BASE (EIM_BASE_ADDR + SHA256_PREFIX)
+#define DEMO_ADDER_BASE_ADDR (EIM_BASE_ADDR + 0x0000)
+#define DEMO_ADDER_X_REG (DEMO_ADDER_BASE_ADDR + 0)
+#define DEMO_ADDER_Y_REG (DEMO_ADDER_BASE_ADDR + 4)
+
//------------------------------------------------------------------------------
// Testing Parameters
@@ -29,16 +33,104 @@
//------------------------------------------------------------------------------
-// main()
//------------------------------------------------------------------------------
-int main()
+void test_regs()
{
unsigned int read_addr;
unsigned int read_data;
+ unsigned int write_addr;
+ unsigned int write_data;
+ unsigned int i;
+
+//
+// for (i = 0 ; i < 0x40000 ; i += 4) {
+// read_addr = EIM_BASE_ADDR + i;
+// eim_read_32(read_addr, &read_data);
+// printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+// }
+
+ read_addr = DEMO_ADDER_X_REG;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+
+ read_addr = DEMO_ADDER_Y_REG;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+
+ write_addr = DEMO_ADDER_Y_REG;
+ write_data = 0xaa55aa55;
+ eim_write_32(write_addr, &write_data);
+
+ read_addr = DEMO_ADDER_Y_REG;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+}
+
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+void test_sha256()
+{
+ unsigned int write_addr;
+ unsigned int write_data;
+ unsigned int read_addr;
+ unsigned int read_data;
+ int ok;
+ unsigned int i;
+
+ // Dump register contents. See if we have the core.
+ for (i = 0 ; i < 200 ; i += 4) {
+ read_addr = SHA_BASE + i;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+ }
+
+ // Try to iniate block processing and then dump
+ write_addr = SHA_BASE + 0x20;
+ write_data = 0x00000001;
+ eim_write_32(write_addr, &write_data);
+
+ // Dump register contents. See if we have the core.
+ for (i = 0 ; i < 200 ; i += 4) {
+ read_addr = SHA_BASE + i;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+ }
+
+ // Dump register contents. See if we have the core.
+ for (i = 0 ; i < 200 ; i += 4) {
+ read_addr = SHA_BASE + i;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+ }
+
+ // Dump register contents. See if we have the core.
+ for (i = 0 ; i < 200 ; i += 4) {
+ read_addr = SHA_BASE + i;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+ }
+
+ // Dump register contents. See if we have the core.
+ for (i = 0 ; i < 200 ; i += 4) {
+ read_addr = SHA_BASE + i;
+ eim_read_32(read_addr, &read_data);
+ printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
+ }
+
+}
+
+//------------------------------------------------------------------------------
+// main()
+//------------------------------------------------------------------------------
+int main()
+{
+ int ok;
+ unsigned int i;
// try to setup eim (return value should be 1)
printf("Configuring EIM .. ");
- int ok = eim_setup();
+ ok = eim_setup();
if (ok < 1) {
printf("ERROR\n");
return EXIT_FAILURE;
@@ -47,12 +139,7 @@ int main()
printf("EIM Setup ok.\n");
}
- // Dump register contents. See if we have the core.
- for (unsigned int i = 0 ; i < 100 ; i += 3) {
- read_addr = SHA_BASE + i;
- eim_read_32(read_addr, &read_data);
- printf("address 0x%08x = 0x%08x\n", read_addr, read_data);
- }
+ test_sha256();
return 0;
}