aboutsummaryrefslogtreecommitdiff
path: root/sw/test-adder/test-adder.c
diff options
context:
space:
mode:
Diffstat (limited to 'sw/test-adder/test-adder.c')
-rw-r--r--sw/test-adder/test-adder.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/sw/test-adder/test-adder.c b/sw/test-adder/test-adder.c
index 88d4353..96b81f6 100644
--- a/sw/test-adder/test-adder.c
+++ b/sw/test-adder/test-adder.c
@@ -40,6 +40,8 @@
//------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
+#include <stdint.h>
+
#include "novena-eim.h"
@@ -56,9 +58,9 @@
//------------------------------------------------------------------------------
// Prototypes
//------------------------------------------------------------------------------
-unsigned int demo_adder_test_round (unsigned int, unsigned int);
-unsigned int lfsr_next_x (unsigned int);
-unsigned int lfsr_next_y (unsigned int);
+uint32_t demo_adder_test_round (uint32_t, uint32_t);
+uint32_t lfsr_next_x (uint32_t);
+uint32_t lfsr_next_y (uint32_t);
//------------------------------------------------------------------------------
@@ -73,7 +75,7 @@ int main(void)
//------------------------------------------------------------------------------
{
int i;
- unsigned int x = 0x12341234, y = 0xABCDABCD, zyx;
+ uint32_t x = 0x12341234, y = 0xABCDABCD, zyx;
// try to setup eim (return value should be 1)
printf("Configuring EIM .. ");
@@ -88,7 +90,7 @@ int main(void)
printf("Testing started.\n");
for (i=0; i<NUM_TEST_ROUNDS; i++) {
// run another round
- unsigned int z = demo_adder_test_round(x, y);
+ uint32_t z = demo_adder_test_round(x, y);
// calculate correct answer
zyx = x + y;
@@ -118,12 +120,12 @@ int main(void)
//------------------------------------------------------------------------------
-unsigned int demo_adder_test_round(unsigned int x, unsigned int y)
+uint32_t demo_adder_test_round(uint32_t x, uint32_t y)
//------------------------------------------------------------------------------
{
- unsigned int ctl;
- unsigned int sts;
- unsigned int z;
+ uint32_t ctl;
+ uint32_t sts;
+ uint32_t z;
// write x
eim_write_32(DEMO_ADDER_REG_X, &x);
@@ -164,7 +166,7 @@ unsigned int demo_adder_test_round(unsigned int x, unsigned int y)
//------------------------------------------------------------------------------
-unsigned int lfsr_next_x(unsigned int value)
+uint32_t lfsr_next_x(uint32_t value)
//------------------------------------------------------------------------------
{
//
@@ -172,7 +174,7 @@ unsigned int lfsr_next_x(unsigned int value)
// 0 1 3 4 5 7 8 9 11 13 15 18 22 24 28 30
//
- unsigned int carry = 0;
+ uint32_t carry = 0;
carry ^= (value >> 0);
carry ^= (value >> 1);
@@ -201,7 +203,7 @@ unsigned int lfsr_next_x(unsigned int value)
//------------------------------------------------------------------------------
-unsigned int lfsr_next_y(unsigned int value)
+uint32_t lfsr_next_y(uint32_t value)
//------------------------------------------------------------------------------
{
//
@@ -209,7 +211,7 @@ unsigned int lfsr_next_y(unsigned int value)
// 0 15 16 17 18 19 20 21 22 23 24 25 26 27 28 31
//
- unsigned int carry = 0;
+ uint32_t carry = 0;
carry ^= (value >> 0);
carry ^= (value >> 15);