45 #ifndef LANGUAGE_WRITER_HPP 46 #define LANGUAGE_WRITER_HPP 49 #include "config_HAVE_FROM_C_BUILT.hpp" 75 #define BITSIZE_PREFIX "BITSIZE_" 76 #define PORTSIZE_PREFIX "PORTSIZE_" 77 #define NUM_ELEM_PREFIX "NUM_ELEM_" 91 inline std::string
encode_one_hot(
unsigned int n_states,
unsigned int val)
const 94 for(
unsigned int i = 0; i < n_states; ++i)
96 res = (val == i ?
"1" :
"0") + res;
139 virtual std::string get_name()
const = 0;
144 virtual std::string get_extension()
const = 0;
150 virtual void write(
const std::string& rawString);
155 virtual void write_header();
161 virtual void write_comment(
const std::string& comment_string) = 0;
194 virtual void write_port_declaration(
const structural_objectRef& cir,
bool first_port_analyzed) = 0;
216 virtual void write_module_instance_begin(
const structural_objectRef& cir,
const std::string& module_name,
217 bool write_parametrization) = 0;
229 bool first_port_analyzed) = 0;
231 virtual void write_vector_port_binding(
const structural_objectRef& port,
bool first_port_analyzed) = 0;
264 virtual void write_state_declaration(
const structural_objectRef& cir,
const std::list<std::string>& list_of_states,
265 const std::string& reset_port,
const std::string& reset_state,
274 virtual void write_present_state_update(
const structural_objectRef cir,
const std::string& reset_state,
275 const std::string& reset_port,
const std::string& clock_port,
276 const std::string& reset_type,
bool connect_present_next_state_signals) = 0;
286 virtual void write_transition_output_functions(
287 bool single_proc,
unsigned int output_index,
const structural_objectRef& cir,
const std::string& reset_state,
288 const std::string& reset_port,
const std::string& start_port,
const std::string& clock_port,
289 std::vector<std::string>::const_iterator& first, std::vector<std::string>::const_iterator& end,
bool is_yosys,
290 const std::map<
unsigned int,
std::map<std::string, std::set<unsigned int>>>& bypass_signals) = 0;
301 virtual void write_port_decl_header() = 0;
306 virtual void write_port_decl_tail() = 0;
313 virtual void write_assign(
const std::string& op0,
const std::string& op1) = 0;
315 virtual bool has_output_prefix()
const = 0;
321 static unsigned int bitnumber(
unsigned long long n);
323 virtual bool check_keyword(
const std::string&
id)
const = 0;
329 virtual void WriteBuiltin(
const structural_objectConstRef component) = 0;
334 const std::string WriteString()
const;
340 void WriteFile(
const std::string&
filename)
const;
void * top(node_stack *head)
File containing functions and utilities to support the printing of debug messagges.
Structure representing the most relevant information about the type of a structural object...
int debug_level
debugging level of the class
CONSTREF_FORWARD_DECL(Parameter)
const IndentedOutputStreamRef indented_output_stream
Represents the stream we are currently writing to.
CustomOrderedSet< std::string > list_of_customized_gates
list of customized gates
unsigned map[NUM_VERTICES]
CustomOrderedSet< std::string > list_of_lib
list of library imported (e.g., includes).
This class manages the technology library structures.
redefinition of set to manage ordered/unordered structures
REF_FORWARD_DECL(IndentedOutputStream)
Template definition of refcount.
std::string encode_one_hot(unsigned int n_states, unsigned int val) const
const ParameterConstRef parameters
the set of input parameters
HDL writer base class used to specify the interface of the different language writers.
Class to print indented code.
Base object for all the structural objects.