17 bool mEnableEventLog =
false;
56 log_info(
"event",
"created new net '{}' (id {:08x})",
net->get_name(),
net->get_id());
60 log_info(
"event",
"deleted net '{}' (id {:08x})",
net->get_name(),
net->get_id());
64 log_info(
"event",
"changed name of net with id {:08x} to '{}'",
net->get_id(),
net->get_name());
68 auto gate =
net->get_netlist()->get_gate_by_id(associated_data);
69 log_info(
"event",
"added gate '{}' (id {:08x}) as a source for net '{}' (id {:08x})", gate->get_name(), gate->get_id(),
net->get_name(),
net->get_id());
73 auto gate =
net->get_netlist()->get_gate_by_id(associated_data);
74 log_info(
"event",
"removed source gate '{}' (id {:08x}) from net '{}' (id {:08x})", gate->get_name(), gate->get_id(),
net->get_name(),
net->get_id());
78 auto gate =
net->get_netlist()->get_gate_by_id(associated_data);
79 log_info(
"event",
"added gate '{}' (id {:08x}) as a destination for net '{}' (id {:08x})", gate->get_name(), gate->get_id(),
net->get_name(),
net->get_id());
83 auto gate =
net->get_netlist()->get_gate_by_id(associated_data);
84 log_info(
"event",
"removed destination gate '{}' (id {:08x}) from net '{}' (id {:08x})", gate->get_name(), gate->get_id(),
net->get_name(),
net->get_id());
99 log_info(
"event",
"changed netlist id from {:08x} to {:08x}", associated_data,
netlist->get_id());
103 log_info(
"event",
"changed input filename of netlist with id {:08x} to '{}'",
netlist->get_id(),
netlist->get_input_filename().string());
107 log_info(
"event",
"changed design name of netlist with id {:08x} to '{}'",
netlist->get_id(),
netlist->get_design_name());
111 log_info(
"event",
"changed target device name of netlist with id {:08x} to '{}'",
netlist->get_id(),
netlist->get_device_name());
115 auto gate =
netlist->get_gate_by_id(associated_data);
116 log_info(
"event",
"marked gate '{}' (id {:08x}) as a global vcc gate in netlist with id {:08x}", gate->get_name(), gate->get_id(),
netlist->get_id());
120 auto gate =
netlist->get_gate_by_id(associated_data);
121 log_info(
"event",
"marked gate '{}' (id {:08x}) as a global gnd gate in netlist with id {:08x}", gate->get_name(), gate->get_id(),
netlist->get_id());
125 auto gate =
netlist->get_gate_by_id(associated_data);
126 log_info(
"event",
"unmarked gate '{}' (id {:08x}) as a global vcc gate in netlist with id {:08x}", gate->get_name(), gate->get_id(),
netlist->get_id());
130 auto gate =
netlist->get_gate_by_id(associated_data);
131 log_info(
"event",
"unmarked gate '{}' (id {:08x}) as a global gnd gate in netlist with id {:08x}", gate->get_name(), gate->get_id(),
netlist->get_id());
135 auto net =
netlist->get_net_by_id(associated_data);
136 log_info(
"event",
"marked net '{}' (id {:08x}) as a global input net in netlist with id {:08x}",
net->get_name(),
net->get_id(),
netlist->get_id());
140 auto net =
netlist->get_net_by_id(associated_data);
141 log_info(
"event",
"marked net '{}' (id {:08x}) as a global output net in netlist with id {:08x}",
net->get_name(),
net->get_id(),
netlist->get_id());
145 auto net =
netlist->get_net_by_id(associated_data);
146 log_info(
"event",
"unmarked net '{}' (id {:08x}) as a global input net in netlist with id {:08x}",
net->get_name(),
net->get_id(),
netlist->get_id());
150 auto net =
netlist->get_net_by_id(associated_data);
151 log_info(
"event",
"unmarked net '{}' (id {:08x}) as a global output net in netlist with id {:08x}",
net->get_name(),
net->get_id(),
netlist->get_id());
155 log_error(
"event",
"unknown netlist event");
161 if (!mEnableEventLog)
193 log_info(
"event",
"added net '{}' (id {:08x}) to grouping '{}' (id {:08x})",
net->get_name(),
net->get_id(), grp->
get_name(), grp->
get_id());
198 log_info(
"event",
"removed net '{}' (id {:08x}) from grouping '{}' (id {:08x})",
net->get_name(),
net->get_id(), grp->
get_name(), grp->
get_id());
212 log_error(
"event",
"unknown grouping event");
218 if (!mEnableEventLog)
240 "changed parent of submodule '{}' (id {:08x}) to module '{}' (id {:08x})",
249 "added submodule '{}' (id {:08x}) to module '{}' (id {:08x})",
261 u32 num_gates = associated_data;
266 u32 num_gates = associated_data;
276 u32 num_gates = associated_data;
281 u32 num_gates = associated_data;
291 u32 id = (associated_data >> 4);
297 log_error(
"event",
"unknown module event");
@ removed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
GateType * get_type() const
const std::string & get_name() const
const std::string & get_name() const
@ net_assigned
associated_data = id of inserted net
@ module_removed
associated_data = id of removed module
@ color_changed
no associated_data
@ gate_assigned
associated_data = id of inserted gate
@ module_assigned
associated_data = id of inserted module
@ gate_removed
associated_data = id of removed gate
@ removed
no associated_data
@ net_removed
associated_data = id of removed net
@ name_changed
no associated_data
@ created
no associated_data
utils::Color get_color() const
Netlist * get_netlist() const
std::string get_name() const
std::shared_ptr< spdlog::logger > add_channel(const std::string &channel_name, const std::vector< std::shared_ptr< log_sink >> &sinks, const std::string &level="info")
static std::shared_ptr< log_sink > create_gui_sink()
static std::shared_ptr< log_sink > create_file_sink(const std::filesystem::path &file_name="", const bool truncate=false)
static std::shared_ptr< log_sink > create_stdout_sink(const bool colored=true)
static LogManager * get_instance(const std::filesystem::path &file_name="")
@ gates_remove_end
associated_data = number of removed gates
@ gate_assigned
associated_data = id of inserted gate
@ gate_removed
associated_data = id of removed gate
@ pin_changed
associated_data = [4LSB: type of action] [28HSB: id of pin group or pin]
@ submodule_removed
associated_data = id of removed module
@ gates_assign_begin
associated_data = number of gates to assign
@ type_changed
no associated_data
@ gates_assign_end
associated_data = number of assigned gates
@ gates_remove_begin
associated_data = number of gates to remove
@ submodule_added
associated_data = id of added module
@ removed
no associated_data
@ parent_changed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
Module * get_parent_module() const
std::string get_name() const
Netlist * get_netlist() const
std::string get_type() const
@ src_added
associated_data = id of src gate
@ dst_removed
associated_data = id of dst gate
@ src_removed
associated_data = id of src gate
@ dst_added
associated_data = id of dst gate
@ removed
no associated_data
@ name_changed
no associated_data
@ created
no associated_data
@ marked_global_gnd
associated_data = id of gate
@ unmarked_global_output
associated_data = id of net
@ id_changed
associated_data = old id
@ device_name_changed
no associated_data
@ unmarked_global_gnd
associated_data = id of gate
@ input_filename_changed
no associated_data
@ unmarked_global_vcc
associated_data = id of gate
@ marked_global_vcc
associated_data = id of gate
@ unmarked_global_input
associated_data = id of net
@ design_name_changed
no associated_data
@ marked_global_output
associated_data = id of net
@ marked_global_input
associated_data = id of net
Gate * get_gate_by_id(const u32 gate_id) const
Module * get_module_by_id(u32 module_id) const
Net * get_net_by_id(u32 net_id) const
#define log_error(channel,...)
#define log_info(channel,...)
const Module * module(const Gate *g, const NodeBoxes &boxes)
void handle_net_event(NetEvent::event event, Net *net, u32 associated_data)
void handle_gate_event(GateEvent::event event, Gate *gate, u32 associated_data)
void handle_netlist_event(NetlistEvent::event event, Netlist *netlist, u32 associated_data)
void handle_grouping_event(GroupingEvent::event event, Grouping *grp, u32 associated_data)
void enable_event_log(bool enable)
void handle_module_event(ModuleEvent::event event, Module *module, u32 associated_data)