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 <SyscClk.h>
26  #include <SyscDrv.h>
27  #include <SyscFCBus.h>
28  #include <Vuut_1_top.h>
29 
30  namespace tb_1
31  {
32  using namespace std;
33  using namespace sc_core;
34  using namespace sc_dt;
35  using namespace SyscClk;
36  using namespace SyscMsg;
37  using namespace SyscDrv;
38  using namespace SyscFCBus;
39 
40  constexpr unsigned be = 0;
41 
42  class ClkDiv : public sc_module
43  {
44  public:
45  SC_HAS_PROCESS(ClkDiv);
46  ClkDiv(sc_module_name);
47  ~ClkDiv(void);
48 
49  sc_out <bool> clk_o;
50  sc_out <bool> stb_o;
51  sc_in <bool> clk_i;
52 
53  void run(void);
54  };
55 
56  class Checker : public sc_module
57  {
58  private:
59  unique_ptr<Msg> msg;
60 
61  public:
62  SC_HAS_PROCESS(Checker);
63  Checker(sc_module_name);
64  ~Checker(void);
65 
66  bool pass;
67 
68  sc_in <uint32_t> res_i;
69  sc_in <uint32_t> exp_i;
70  sc_in <uint32_t> obs_i;
71  sc_in <bool> val_i;
72  sc_in <bool> clk_i;
73 
74  void check(void);
75  };
76 
77  class tb : public sc_module
78  {
79  protected:
80  double clk_freq_hz;
81  string drv_path;
82  string drv_handler;
83  string drv_request;
84  unique_ptr<Msg> msg;
85  DrvClient * drv;
86 
87  public:
88  SC_HAS_PROCESS(tb);
89  tb(sc_module_name);
90  ~tb(void);
91 
92  Vuut_1_top * i_uut;
93  Clk<bool> * i_clk;
96  Bus_src<be> * i_bus;
97  Bus_split<be> * i_lys;
98 
99  sc_signal <bool > tb_clk;
100  sc_signal <bool > tb_rdy;
101 
102  sc_signal <bool > div_clk;
103  sc_signal <bool > div_stb;
104 
105  sc_signal <uint32_t> uut_res;
106  sc_signal <uint32_t> uut_exp;
107  sc_signal <uint32_t> uut_obs;
108  sc_signal <bool > uut_val;
109 
110  sc_signal <bool > bus_sav;
111  sc_signal <bool > bus_req;
112  sc_signal <uint32_t> bus_cnt;
113  sc_signal <Bus<be> > bus_bus;
114 
115  sc_signal <uint32_t> lys_usr;
116  sc_signal <bool > lys_err;
117  sc_signal <bool > lys_val;
118  sc_signal <bool > lys_sof;
119  sc_signal <bool > lys_eof;
120  sc_signal <Mod<be> > lys_mod;
121  sc_signal <Dat<be> > lys_dat;
122  };
123  }
124 #endif
sc_in< uint32_t > exp_i
Definition: tb.h:69
sc_signal< bool > tb_clk
Definition: tb.h:99
DrvClient * drv
Definition: tb.h:85
Definition: tb.h:56
string drv_handler
Definition: tb.h:82
sc_signal< uint32_t > uut_exp
Definition: tb.h:106
string drv_request
Definition: tb.h:83
sc_signal< bool > lys_sof
Definition: tb.h:118
sc_in< uint32_t > obs_i
Definition: tb.h:70
Definition: tb.h:42
sc_signal< bool > div_clk
Definition: tb.h:102
double clk_freq_hz
Definition: tb.h:80
unique_ptr< Msg > msg
Definition: tb.h:59
Bus_split< be > * i_lys
Definition: tb.h:97
bool pass
Definition: tb.h:66
Checker * i_chk
Definition: tb.h:95
sc_signal< uint32_t > uut_obs
Definition: tb.h:107
sc_signal< bool > bus_sav
Definition: tb.h:110
Vuut_1_top * i_uut
Definition: tb.h:92
sc_out< bool > stb_o
Definition: tb.h:50
ClkDiv * i_div
Definition: tb.h:94
Bus_src< be > * i_bus
Definition: tb.h:96
sc_signal< uint32_t > bus_cnt
Definition: tb.h:112
Definition: tb.h:77
sc_out< bool > clk_o
Definition: tb.h:49
Clk< bool > * i_clk
Definition: tb.h:93
sc_signal< bool > bus_req
Definition: tb.h:111
sc_signal< bool > uut_val
Definition: tb.h:108
sc_in< uint32_t > res_i
Definition: tb.h:68
sc_signal< Mod< be > > lys_mod
Definition: tb.h:120
sc_signal< bool > tb_rdy
Definition: tb.h:100
sc_in< bool > clk_i
Definition: tb.h:51
sc_signal< uint32_t > lys_usr
Definition: tb.h:115
sc_signal< bool > lys_eof
Definition: tb.h:119
sc_signal< bool > div_stb
Definition: tb.h:103
sc_signal< Bus< be > > bus_bus
Definition: tb.h:113
sc_in< bool > val_i
Definition: tb.h:71
unique_ptr< Msg > msg
Definition: tb.h:84
sc_in< bool > clk_i
Definition: tb.h:72
sc_signal< bool > lys_val
Definition: tb.h:117
constexpr unsigned be
Definition: tb.h:40
sc_signal< uint32_t > uut_res
Definition: tb.h:105
sc_signal< Dat< be > > lys_dat
Definition: tb.h:121
sc_signal< bool > lys_err
Definition: tb.h:116
string drv_path
Definition: tb.h:81