source: branches/reconfiguration/modules/dspin_router/caba/test/simple_recovery_routing_test/main.c @ 887

Last change on this file since 887 was 887, checked in by cfuguet, 9 years ago

reconf: add test for the recovery routing function on the dspin_router

  • The test performs a reconfiguration of a cycle-free contour around a blackhole in a 3x3 platform. The blackhole (faulty routers) is in the cluster (1,1).
  • Introduce a reconf:xicu driver in the softs directory. For now this driver contains only a getter/setter for the configuration registers in the reconf:vci_xicu.
File size: 2.6 KB
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#include "xcu.h"
8#include "soclib/dspin_router_config.h"
9#include "assert.h"
10
11void exception_handler()
12{
13    printf("exception_handler(): failure / pid %d\n", cpu_procid());
14    simh_stop_simulation();
15}
16
17void main(void)
18{
19    printf("main(): pid %d\n", cpu_procid());
20
21    /*
22     * set the watchdog timer threshold to detect an error during
23     * the reconfiguration of the NoC
24     */
25    cpu_set_wdt_max(1000);
26
27    /*
28     * configure the routers around the blackhole (1, 1) to define a cycle-free
29     * contour
30     */
31    printf("router(0, 2): configuring as NW\n");
32    assert(xcu_get_config(0, 2, 0) == BH_NONE);
33    xcu_set_config(0, 2, 0, BH_NW);    /* configure NW */
34
35    printf("router(0, 1): configuring as W\n");
36    assert(xcu_get_config(0, 1, 0) == BH_NONE);
37    xcu_set_config(0, 1, 0, BH_W);     /* configure W */
38
39    printf("router(0, 0): configuring as SW\n");
40    assert(xcu_get_config(0, 0, 0) == BH_NONE);
41    xcu_set_config(0, 0, 0, BH_SW);    /* configure SW */
42
43    printf("router(1, 2): configuring as N\n");
44    assert(xcu_get_config(1, 2, 0) == BH_NONE);
45    xcu_set_config(1, 2, 0, BH_N);     /* configure N */
46
47    printf("router(2, 2): configuring as NE\n");
48    assert(xcu_get_config(2, 2, 0) == BH_NONE);
49    xcu_set_config(2, 2, 0, BH_NE);    /* configure NE */
50
51    printf("router(2, 1): configuring as E\n");
52    assert(xcu_get_config(2, 1, 0) == BH_NONE);
53    xcu_set_config(2, 1, 0, BH_E);     /* configure E */
54
55    printf("router(2, 0): configuring as SE\n");
56    assert(xcu_get_config(2, 0, 0) == BH_NONE);
57    xcu_set_config(2, 0, 0, BH_SE);    /* configure SE */
58
59    printf("router(1, 0): configuring as S\n");
60    assert(xcu_get_config(1, 0, 0) == BH_NONE);
61    xcu_set_config(1, 0, 0, BH_S);     /* configure S */
62
63    assert(xcu_get_config(0, 2, 0) == BH_NW);
64    assert(xcu_get_config(0, 1, 0) == BH_W);
65    assert(xcu_get_config(0, 0, 0) == BH_SW);
66    assert(xcu_get_config(1, 2, 0) == BH_N);
67    assert(xcu_get_config(2, 2, 0) == BH_NE);
68    assert(xcu_get_config(2, 1, 0) == BH_E);
69    assert(xcu_get_config(2, 0, 0) == BH_SE);
70    assert(xcu_get_config(1, 0, 0) == BH_S);
71
72#if 0
73    /*
74     * this should cause a livelock (sending a packet to the blackhole once the
75     * cycle-free contour has been defined)
76     *
77     * why?: the router (0, 0) and the router (0, 1) keep sending the packet
78     * between them.
79     */
80    assert(xcu_get_config(1, 1, 0) == BH_NONE);
81#endif
82
83    printf("main(): success\n");
84
85    simh_stop_simulation();
86}
87
88/*
89 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
90 */
Note: See TracBrowser for help on using the repository browser.