OpenCores
URL https://opencores.org/ocsvn/tv80/tv80/trunk

Subversion Repositories tv80

[/] [tv80/] [branches/] [s80_env_devel/] [tests/] [malloc.c] - Blame information for rev 84

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ghutchis
#include <malloc.h>
2
 
3
#include "tv80_env.h"
4
 
5
#define TEST_SIZE 200
6
int main ()
7
{
8
  char *foo;
9
  int i;
10
  int cksum_in, cksum_out;
11
 
12
  sim_ctl (SC_DUMPON);
13
 
14
  foo = malloc (TEST_SIZE);
15
  set_timeout (30000);
16
 
17
  print ("Memory allocated\n");
18
 
19
  cksum_in = 0;
20
  for (i=0; i<TEST_SIZE; i=i+1) {
21
    cksum_in += i;
22
    foo[i] = i;
23
  }
24
 
25
  print ("Values assigned\n");
26
 
27
  cksum_out = 0;
28
  for (i=0; i<TEST_SIZE; i++)
29
    cksum_out += foo[i];
30
 
31
  print ("Checksum computed\n");
32
 
33
  if (cksum_in == cksum_out)
34
    sim_ctl (SC_TEST_PASSED);
35
  else
36
    sim_ctl (SC_TEST_FAILED);
37
 
38
  return 0;
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.