-
Notifications
You must be signed in to change notification settings - Fork 8
/
input.h
38 lines (28 loc) · 879 Bytes
/
input.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
#ifndef __INPUT_H
#define __INPUT_H
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include "node.h"
#include "bvec.h"
namespace chdl {
node Input(std::string name);
template <unsigned N> bvec<N> Input(std::string name);
void print_inputs_vl_head(std::ostream &out);
void print_inputs_vl_body(std::ostream &out);
void print_input_nodes(std::ostream &out);
// Append input node IDs to the given set.
void get_input_nodes(std::set<nodeid_t> &s);
void get_input_map(std::map<std::string, std::vector<nodeid_t> > &m);
std::vector<node> input_internal(std::string name, unsigned n);
};
template<unsigned N> chdl::bvec<N> chdl::Input(std::string name) {
using namespace chdl;
using namespace std;
vector<node> v = input_internal(name, N);
bvec<N> out;
for (unsigned i = 0; i < N; ++i) out[i] = v[i];
return out;
}
#endif