source: branches/reconfiguration/modules/vci_cc_vcache_wrapper/caba/test/simple_wdt_test/main.c @ 853

Last change on this file since 853 was 852, checked in by cfuguet, 10 years ago

reconf: including test recipe in unit tests makefiles

  • The execution and result verification are performed by using the 'make test' command
  • Property svn:executable set to *
File size: 861 bytes
Line 
1#include "stdio.h"
2#include "cpu.h"
3#include "hard_config.h"
4#include "io.h"
5#include "simhelper.h"
6#include "cpu_registers.h"
7
8void exception_handler()
9{
10    printf("exception_handler(): pid %d\n", cpu_procid());
11
12    int error = 0;
13    if (cpu_get_cr_exccode() != CR_DBE) {
14        printf("error: exccode should be DBE");
15        error = 1;
16    }
17    if (cpu_get_mmu_detr() != MMU_READ_DATA_TIMEOUT) {
18        printf("error: mmu data exception type should be WDT timeout");
19        error = 1;
20    }
21    if (error == 0) {
22        printf("success");
23    }
24    simh_stop_simulation();
25}
26
27void main(void)
28{
29    cpu_set_wdt_max(100);
30
31    /*
32     * Cause a WDT timeout exception
33     * Trying to read a memory location of another (non-existent) cluster
34     */
35    ioread32(0xFF00000000ULL);
36}
37
38/*
39 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
40 */
Note: See TracBrowser for help on using the repository browser.