-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtap.h
85 lines (71 loc) · 2.58 KB
/
tap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// This interface allows values to be assigned names so that they can be watched
// during simulation.
#ifndef __TAP_H
#define __TAP_H
#include <string>
#include <sstream>
#include <iostream>
#include <set>
#include "node.h"
#include "bvec.h"
#include "bus.h"
#include "tristate.h"
#include "cdomain.h"
#include "hierarchy.h"
namespace chdl {
void tap(std::string name, tristatenode t, bool output=false);
void tap(std::string name, node node, bool output=false);
void change_tap(nodeid_t old_node, nodeid_t new_node);
void gtap(node node);
template <typename T, unsigned N>
void tap(std::string name, const vec<N, T> &vec, bool output=false);
template <unsigned N>
void tap(std::string name, const bvec<N> &vec, bool output=false);
template <unsigned N>
void tap(std::string name, const bus<N> &vec, bool output=false);
template <unsigned N> void gtap(const bvec<N> &vec);
template <unsigned N> void gtap(const bus<N> &vec);
void print_taps_vl_head(std::ostream &out);
void print_taps_vl_body(std::ostream &out, bool print_non_out=true);
void print_tap_nodes(std::ostream &out);
void print_io_tap_nodes(std::ostream &out);
void print_taps(std::ostream &out, cdomain_handle_t cd = 0);
void print_taps(
std::ostream &out, cdomain_handle_t cd, std::vector<bool> &cache,
bool first_cycle
);
void print_vcd_header(std::ostream &out);
void get_tap_map(std::map<nodeid_t, std::string> &m);
void get_tap_map(std::map<std::string, std::vector<nodeid_t> > &m,
bool output_only = false);
void get_output_map(std::map<std::string, std::vector<nodeid_t> > &m);
// Append the set of tap nodes to s. Do not clear s.
void get_tap_nodes(std::set<nodeid_t> &s);
};
template <typename T, unsigned N>
void chdl::tap(std::string prefix, const vec<N, T> &v, bool output)
{
for (unsigned i = 0; i < N; ++i) {
std::ostringstream oss; oss << i;
tap(prefix + '_' + oss.str(), v[i], output);
}
}
template <unsigned N>
void chdl::tap(std::string name, const bvec<N> &vec, bool output)
{
for (unsigned i = 0; i < N; ++i) tap(name, vec[i], output);
}
template <unsigned N>
void chdl::tap(std::string name, const bus<N> &vec, bool output)
{
for (unsigned i = 0; i < N; ++i) tap(name, vec[i], output);
}
template <unsigned N> void chdl::gtap(const chdl::bvec<N> &vec) {
for (unsigned i = 0; i < N; ++i) gtap(vec[i]);
}
template <unsigned N> void chdl::gtap(const chdl::bus<N> &vec) {
for (unsigned i = 0; i < N; ++i) gtap(chdl::node(vec[i]));
}
#define TAP(x) do { tap(#x, x); } while(0)
#define OUTPUT(x) do { tap(#x, x, true); } while(0)
#endif