source: branches/reconfiguration/modules/vci_mem_cache/caba/test/memcache_cc_test/top.cpp @ 872

Last change on this file since 872 was 872, checked in by cfuguet, 8 years ago

reconf: adding test platform for the vci_mem_cache test mechanisms

  • The goal is to test the recently introduced test mechanisms of the coherence network in the VciMemCache?.
File size: 3.6 KB
Line 
1#include <systemc>
2#include <vci_mem_cache.h>
3#include <dspin_memcache_cc_test.h>
4#include <int_tab.h>
5#include <mapping_table.h>
6
7/*
8 * DSPIN parameters
9 */
10#define dspin_int_cmd_width 39
11#define dspin_int_rsp_width 32
12#define dspin_ram_cmd_width 64
13#define dspin_ram_rsp_width 64
14
15/*
16 * VCI fields width
17 */
18#define vci_cell_width_int 4
19#define vci_cell_width_ext 8
20#define vci_plen_width 8
21#define vci_address_width 40
22#define vci_rerror_width 1
23#define vci_clen_width 1
24#define vci_rflag_width 1
25#define vci_srcid_width 14
26#define vci_pktid_width 4
27#define vci_trdid_width 4
28#define vci_wrplen_width 1
29
30#define X_WIDTH 4
31#define Y_WIDTH 4
32
33int sc_main(int argc, char **argv)
34{
35    using namespace soclib::caba;
36    using namespace soclib::common;
37
38    typedef VciParams<vci_cell_width_int, vci_plen_width, vci_address_width,
39            vci_rerror_width, vci_clen_width, vci_rflag_width, vci_srcid_width,
40            vci_pktid_width, vci_trdid_width, vci_wrplen_width> VciParamInt;
41
42    typedef VciParams<vci_cell_width_ext, vci_plen_width, vci_address_width,
43            vci_rerror_width, vci_clen_width, vci_rflag_width, vci_srcid_width,
44            vci_pktid_width, vci_trdid_width, vci_wrplen_width> VciParamExt;
45
46    typedef VciMemCache< VciParamInt, VciParamExt, dspin_int_rsp_width,
47            dspin_int_cmd_width> VciMemCacheT;
48
49    typedef DspinMemcacheCcTest<dspin_int_cmd_width, dspin_int_rsp_width>
50            DspinMemcacheCcTestT;
51
52    MappingTable mt_int(
53            vci_address_width,
54            IntTab(X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH),
55            IntTab(X_WIDTH + Y_WIDTH, vci_srcid_width - X_WIDTH - Y_WIDTH),
56            0xF);
57
58    mt_int.add(Segment("seg0", 0x0, 0x4000, IntTab(0, 0), false, false));
59
60    MappingTable mt_ext(
61            vci_address_width,
62            IntTab(X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH),
63            IntTab(X_WIDTH + Y_WIDTH, vci_srcid_width - X_WIDTH - Y_WIDTH),
64            0xF);
65
66    mt_ext.add(Segment("seg0", 0x0, 0x4000, IntTab(0, 0), false, false));
67
68    VciMemCacheT memc(
69            "memc", mt_int, mt_ext, IntTab(0, 0), IntTab(0, 0), 4, 4, 4, 256,
70            16, 3, 4096, 8, 8, 8, 0, false);
71
72    DspinMemcacheCcTestT memctest("memctest");
73
74    sc_clock signal_clk("clk");
75    sc_core::sc_signal<bool> signal_resetn("signal_resetn");
76    VciSignals<VciParamExt> signal_ext_vci_ini("signal_ext_vci_ini");
77    VciSignals<VciParamInt> signal_int_vci_tgt("signal_int_vci_tgt");
78    DspinSignals<dspin_int_rsp_width> signal_dspin_p2m("signal_dspin_p2m");
79    DspinSignals<dspin_int_cmd_width> signal_dspin_m2p("signal_dspin_m2p");
80    DspinSignals<dspin_int_cmd_width> signal_dspin_clack("signal_dspin_clack");
81    sc_core::sc_signal<bool> signal_irq("signal_irq");
82
83    memc.p_clk(signal_clk);
84    memc.p_resetn(signal_resetn);
85    memc.p_vci_ixr(signal_ext_vci_ini);
86    memc.p_vci_tgt(signal_int_vci_tgt);
87    memc.p_dspin_p2m(signal_dspin_p2m);
88    memc.p_dspin_m2p(signal_dspin_m2p);
89    memc.p_dspin_clack(signal_dspin_clack);
90    memc.p_irq(signal_irq);
91
92    memctest.p_clk(signal_clk);
93    memctest.p_resetn(signal_resetn);
94    memctest.p_dspin_p2m(signal_dspin_p2m);
95    memctest.p_dspin_m2p(signal_dspin_m2p);
96    memctest.p_dspin_clack(signal_dspin_clack);
97
98    sc_start(sc_core::SC_ZERO_TIME);
99    signal_resetn = 0;
100    signal_int_vci_tgt.cmdval = 0;
101    signal_int_vci_tgt.rspack = 1;
102    signal_ext_vci_ini.cmdack = 1;
103    signal_ext_vci_ini.rspval = 0;
104    signal_irq = 0;
105    sc_start(sc_core::sc_time(5, SC_NS));
106    signal_resetn = 1;
107    sc_start(sc_core::sc_time(1000, SC_NS));
108
109    std::cout << "failure" << std::endl;
110
111    return 0;
112}
113
114/*
115 * vim: ts=4 : sw=4 : sts=4 : et
116 */
Note: See TracBrowser for help on using the repository browser.