Definition at line 31 of file fsm_opt.cc.
Definition at line 293 of file fsm_opt.cc.
const char * c_str() const
void copy_to_cell(RTLIL::Cell *cell)
void opt_const_and_unused_inputs()
void opt_unreachable_states()
void opt_feedback_inputs()
void opt_find_dont_care()
void opt_unused_outputs()
void log(const char *format,...)
void copy_from_cell(RTLIL::Cell *cell)
void FsmOpt::opt_alias_inputs |
( |
| ) |
|
|
inline |
Definition at line 158 of file fsm_opt.cc.
162 for (
int i = 0; i < ctrl_in.
size(); i++)
163 for (
int j = i+1; j < ctrl_in.
size(); j++)
166 log(
" Optimize handling of signal %s that is connected to inputs %d and %d.\n",
log_signal(ctrl_in.
extract(i, 1)), i, j);
167 std::vector<FsmData::transition_t> new_transition_table;
182 tr.ctrl_in = tmp.as_const();
183 new_transition_table.push_back(tr);
191 new_transition_table.clear();
std::vector< transition_t > transition_table
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
void remove(const RTLIL::SigSpec &pattern)
void log(const char *format,...)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
void FsmOpt::opt_const_and_unused_inputs |
( |
| ) |
|
|
inline |
Definition at line 98 of file fsm_opt.cc.
101 std::vector<bool> ctrl_in_used(ctrl_in.
size());
103 std::vector<FsmData::transition_t> new_transition_table;
105 for (
int i = 0; i < ctrl_in.
size(); i++) {
109 goto delete_this_transition;
113 ctrl_in_used[i] =
true;
115 new_transition_table.push_back(tr);
116 delete_this_transition:;
119 for (
int i =
int(ctrl_in_used.size())-1; i >= 0; i--) {
120 if (!ctrl_in_used[i]) {
122 for (
auto &tr : new_transition_table) {
125 tr.ctrl_in = tmp.as_const();
135 new_transition_table.clear();
std::vector< transition_t > transition_table
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
void remove(const RTLIL::SigSpec &pattern)
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
bool is_fully_const() const
void log(const char *format,...)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
void FsmOpt::opt_feedback_inputs |
( |
| ) |
|
|
inline |
Definition at line 195 of file fsm_opt.cc.
200 for (
int j = 0; j < ctrl_out.
size(); j++)
201 for (
int i = 0; i < ctrl_in.
size(); i++)
204 log(
" Optimize handling of signal %s that is connected to input %d and output %d.\n",
log_signal(ctrl_in.
extract(i, 1)), i, j);
205 std::vector<FsmData::transition_t> new_transition_table;
215 tr.ctrl_in = tmp.as_const();
216 new_transition_table.push_back(tr);
224 new_transition_table.clear();
std::vector< transition_t > transition_table
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
void remove(const RTLIL::SigSpec &pattern)
void log(const char *format,...)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
std::map< RTLIL::IdString, RTLIL::SigSpec > connections_
void FsmOpt::opt_find_dont_care |
( |
| ) |
|
|
inline |
Definition at line 261 of file fsm_opt.cc.
263 typedef std::pair<std::pair<int, int>,
RTLIL::Const> group_t;
264 std::map<group_t, std::set<RTLIL::Const>> transitions_by_group;
267 group_t group(std::pair<int, int>(tr.state_in, tr.state_out), tr.ctrl_out);
268 transitions_by_group[group].insert(tr.ctrl_in);
272 for (
auto &it : transitions_by_group)
280 while (did_something) {
281 did_something =
false;
286 for (
auto &ci : it.second) {
std::vector< transition_t > transition_table
void opt_find_dont_care_worker(std::set< RTLIL::Const > &set, int bit, FsmData::transition_t &tr, bool &did_something)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool did_something
Definition at line 228 of file fsm_opt.cc.
230 std::set<RTLIL::Const> new_set;
232 for (
auto &pattern : set)
235 new_set.insert(pattern);
246 if (set.count(other_pattern) > 0) {
250 new_set.insert(other_pattern);
255 new_set.insert(pattern);
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN bool did_something
void log(const char *format,...)
std::vector< RTLIL::State > bits
void FsmOpt::opt_unreachable_states |
( |
| ) |
|
|
inline |
Definition at line 37 of file fsm_opt.cc.
41 std::set<int> unreachable_states;
42 std::vector<FsmData::transition_t> new_transition_table;
43 std::vector<RTLIL::Const> new_state_table;
44 std::map<int, int> old_to_new_state;
48 unreachable_states.insert(i);
51 unreachable_states.erase(trans.state_out);
53 if (unreachable_states.empty())
57 if (unreachable_states.count(i)) {
61 old_to_new_state[i] =
GetSize(new_state_table);
66 if (unreachable_states.count(trans.state_in))
68 trans.state_in = old_to_new_state.at(trans.state_in);
69 trans.state_out = old_to_new_state.at(trans.state_out);
70 new_transition_table.push_back(trans);
std::vector< transition_t > transition_table
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
int GetSize(RTLIL::Wire *wire)
std::vector< RTLIL::Const > state_table
void log(const char *format,...)
void FsmOpt::opt_unused_outputs |
( |
| ) |
|
|
inline |
Definition at line 138 of file fsm_opt.cc.
143 log(
" Removing unused output signal %s.\n",
log_signal(sig));
145 new_ctrl_out.
remove(i, 1);
150 tr.ctrl_out = tmp.as_const();
std::vector< transition_t > transition_table
const char * log_signal(const RTLIL::SigSpec &sig, bool autoint)
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
void remove(const RTLIL::SigSpec &pattern)
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
void log(const char *format,...)
bool signal_is_unused(RTLIL::SigSpec sig)
RTLIL::SigSpec extract(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec *other=NULL) const
Definition at line 79 of file fsm_opt.cc.
83 if (bit.
wire ==
NULL || bit.
wire->attributes.count(
"\\unused_bits") == 0)
86 char *str = strdup(bit.
wire->attributes[
"\\unused_bits"].decode_string().c_str());
87 for (
char *tok = strtok(str,
" "); tok !=
NULL; tok = strtok(
NULL,
" ")) {
88 if (tok[0] && bit.
offset == atoi(tok)) {
RTLIL::SigBit to_single_sigbit() const
The documentation for this struct was generated from the following file: