fcs
 All Classes Namespaces Files Functions Variables
tb.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-2021 Robert Newgard
3  *
4  * This file is part of fcs.
5  *
6  * fcs is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * fcs is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with fcs. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _TB_H_
21  #define _TB_H_
22 
23  #include <systemc>
24  #include <SyscMsg.h>
25  #include <SyscDrv.h>
26  #include <SyscClk.h>
27  #include <SyscFCBus.h>
28  #include <Vuut_512_top.h>
29 
30  namespace tb_512
31  {
32  using namespace std;
33  using namespace sc_core;
34  using namespace sc_dt;
35  using namespace SyscMsg;
36  using namespace SyscDrv;
37  using namespace SyscClk;
38  using namespace SyscFCBus;
39 
40  constexpr unsigned be = 6;
41 
42  class Checker : public sc_module
43  {
44  private:
45  unique_ptr<Msg> msg;
46  uint32_t max_size;
47  bool done;
48 
49  public:
50  SC_HAS_PROCESS(Checker);
51  Checker(sc_module_name);
52  ~Checker(void);
53 
54  bool pass;
55 
56  sc_in <uint32_t> res_i;
57  sc_in <uint32_t> exp_i;
58  sc_in <uint32_t> obs_i;
59  sc_in <uint32_t> len_i;
60  sc_in <bool> val_i;
61  sc_in <bool> clk_i;
62 
63  void check(void);
64  void set_max_size(uint32_t);
65  bool is_done(void);
66  };
67 
68  class tb : public sc_module
69  {
70  protected:
71  double clk_freq_hz;
72  string drv_path;
73  string drv_handler;
74  string drv_request;
75  unique_ptr<Msg> msg;
76  DrvClient * drv;
77 
78  public:
79  SC_HAS_PROCESS(tb);
80  tb(sc_module_name);
81  ~tb(void);
82 
83  Vuut_512_top * i_uut;
84  Clk<bool> * i_clk;
85  Bus_src<be> * i_bus;
87  Bus_split<be> * i_lys;
88 
89  sc_signal <bool > tb_clk;
90  sc_signal <bool > tb_rdy;
91 
92  sc_signal <bool > chk_end;
93 
94  sc_signal <uint32_t> uut_res;
95  sc_signal <uint32_t> uut_exp;
96  sc_signal <uint32_t> uut_obs;
97  sc_signal <uint32_t> uut_len;
98  sc_signal <bool > uut_val;
99 
100  sc_signal <bool > bus_sav;
101  sc_signal <bool > bus_req;
102  sc_signal <uint32_t> bus_cnt;
103  sc_signal <Bus<be>> bus_bus;
104 
105  sc_signal <uint32_t> lys_usr;
106  sc_signal <bool> lys_err;
107  sc_signal <bool> lys_val;
108  sc_signal <bool> lys_sof;
109  sc_signal <bool> lys_eof;
110  sc_signal <Mod<be>> lys_mod;
111  sc_signal <Dat<be>> lys_dat;
112  };
113  }
114 #endif
unique_ptr< Msg > msg
Definition: tb.h:45
sc_signal< bool > tb_clk
Definition: tb.h:89
sc_signal< uint32_t > uut_res
Definition: tb.h:94
Definition: tb.h:42
sc_signal< bool > bus_req
Definition: tb.h:101
sc_in< uint32_t > res_i
Definition: tb.h:56
sc_signal< bool > tb_rdy
Definition: tb.h:90
sc_signal< uint32_t > lys_usr
Definition: tb.h:105
sc_signal< Mod< be > > lys_mod
Definition: tb.h:110
sc_signal< uint32_t > uut_obs
Definition: tb.h:96
sc_signal< bool > lys_err
Definition: tb.h:106
double clk_freq_hz
Definition: tb.h:71
sc_signal< bool > bus_sav
Definition: tb.h:100
sc_signal< bool > lys_eof
Definition: tb.h:109
string drv_path
Definition: tb.h:72
sc_signal< bool > uut_val
Definition: tb.h:98
unique_ptr< Msg > msg
Definition: tb.h:75
sc_signal< Dat< be > > lys_dat
Definition: tb.h:111
sc_in< uint32_t > obs_i
Definition: tb.h:58
sc_in< bool > clk_i
Definition: tb.h:61
sc_signal< Bus< be > > bus_bus
Definition: tb.h:103
bool done
Definition: tb.h:47
sc_signal< uint32_t > uut_exp
Definition: tb.h:95
string drv_request
Definition: tb.h:74
bool pass
Definition: tb.h:54
sc_in< uint32_t > exp_i
Definition: tb.h:57
sc_in< bool > val_i
Definition: tb.h:60
sc_signal< bool > lys_sof
Definition: tb.h:108
Bus_src< be > * i_bus
Definition: tb.h:85
uint32_t max_size
Definition: tb.h:46
Bus_split< be > * i_lys
Definition: tb.h:87
sc_signal< uint32_t > bus_cnt
Definition: tb.h:102
sc_signal< uint32_t > uut_len
Definition: tb.h:97
sc_signal< bool > lys_val
Definition: tb.h:107
constexpr unsigned be
Definition: tb.h:40
sc_signal< bool > chk_end
Definition: tb.h:92
Clk< bool > * i_clk
Definition: tb.h:84
sc_in< uint32_t > len_i
Definition: tb.h:59
Checker * i_chk
Definition: tb.h:86
Vuut_512_top * i_uut
Definition: tb.h:83
DrvClient * drv
Definition: tb.h:76
Definition: tb.h:68
string drv_handler
Definition: tb.h:73