source: branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/main.c @ 994

Last change on this file since 994 was 947, checked in by cfuguet, 10 years ago

reconf: add new mode to the dspin_router

  • Modes are:

+ NORMAL : normal X-first routing

+ PATH_RECOVERY : create contour around the blackhole.

If the destination is the blackhole, send
packet to recovery direction, else use normal
X-first routing.

+ SEGMENT_RECOVERY: Like PATH_RECOVERY but do not create contour, only

reroute packets with the blackhole as destination.

  • Remove deprecated unitary test simple_recovery_routing_test
  • Update the simple_segment_recovery unitary test.
File size: 3.4 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    /* set the watchdog timer threshold to detect an error during the
22     * reconfiguration of the NoC */
23    cpu_set_wdt_max(5000);
24
25    /* configure the routers around the blackhole (1, 1) to define a cycle-free
26     * contour */
27    const int PATH_RECOVERY = 1;
28    uint32_t val;
29
30    printf("router(0, 2): configuring as NW\n");
31    assert(xcu_get_register(0, 2, XICU_CFG_REG, 0) == BH_NONE);
32    val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_NW;
33    xcu_set_register(0, 2, XICU_CFG_REG, 0, val);     /* configure NW */
34
35    printf("router(0, 1): configuring as W\n");
36    assert(xcu_get_register(0, 1, XICU_CFG_REG, 0) == BH_NONE);
37    val = (PATH_RECOVERY << 7) | (REQ_LOCAL << 4) | BH_W;
38    xcu_set_register(0, 1, XICU_CFG_REG, 0, val);     /* configure W */
39
40    printf("router(0, 0): configuring as SW\n");
41    assert(xcu_get_register(0, 0, XICU_CFG_REG, 0) == BH_NONE);
42    val = (PATH_RECOVERY << 7) | (REQ_NORTH << 4) | BH_SW;
43    xcu_set_register(0, 0, XICU_CFG_REG, 0, val);     /* configure SW */
44
45    printf("router(1, 2): configuring as N\n");
46    assert(xcu_get_register(1, 2, XICU_CFG_REG, 0) == BH_NONE);
47    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_N;
48    xcu_set_register(1, 2, XICU_CFG_REG, 0, val);     /* configure N */
49
50    printf("router(2, 2): configuring as NE\n");
51    assert(xcu_get_register(2, 2, XICU_CFG_REG, 0) == BH_NONE);
52    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_NE;
53    xcu_set_register(2, 2, XICU_CFG_REG, 0, val);     /* configure NE */
54
55    printf("router(2, 1): configuring as E\n");
56    assert(xcu_get_register(2, 1, XICU_CFG_REG, 0) == BH_NONE);
57    val = (PATH_RECOVERY << 7) | (REQ_SOUTH << 4) | BH_E;
58    xcu_set_register(2, 1, XICU_CFG_REG, 0, val);     /* configure E */
59
60    printf("router(2, 0): configuring as SE\n");
61    assert(xcu_get_register(2, 0, XICU_CFG_REG, 0) == BH_NONE);
62    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_SE;
63    xcu_set_register(2, 0, XICU_CFG_REG, 0, val);     /* configure SE */
64
65    printf("router(1, 0): configuring as S\n");
66    assert(xcu_get_register(1, 0, XICU_CFG_REG, 0) == BH_NONE);
67    val = (PATH_RECOVERY << 7) | (REQ_WEST << 4) | BH_S;
68    xcu_set_register(1, 0, XICU_CFG_REG, 0, val);     /* configure S */
69
70    assert((xcu_get_register(0, 2, XICU_CFG_REG, 0) & 0xF) == BH_NW);
71    assert((xcu_get_register(0, 1, XICU_CFG_REG, 0) & 0xF) == BH_W);
72    assert((xcu_get_register(0, 0, XICU_CFG_REG, 0) & 0xF) == BH_SW);
73    assert((xcu_get_register(1, 2, XICU_CFG_REG, 0) & 0xF) == BH_N);
74    assert((xcu_get_register(2, 2, XICU_CFG_REG, 0) & 0xF) == BH_NE);
75    assert((xcu_get_register(2, 1, XICU_CFG_REG, 0) & 0xF) == BH_E);
76    assert((xcu_get_register(2, 0, XICU_CFG_REG, 0) & 0xF) == BH_SE);
77    assert((xcu_get_register(1, 0, XICU_CFG_REG, 0) & 0xF) == BH_S);
78
79    /* Test the recovered segment that has been migrated to the EAST cluster */
80    ioread32(CLUSTER_BASE(1, 1) | SEG_RAM_BASE);
81
82    printf("main(): success\n");
83    simh_stop_simulation();
84}
85
86/*
87 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
88 */
Note: See TracBrowser for help on using the repository browser.