32    cci::cci_param<std::string> p_read_file;
 
   33    cci::cci_param<std::string> p_write_file;
 
   34    cci::cci_param<unsigned int> p_baudrate;
 
   44    sc_core::sc_event update_event;
 
   47#pragma message("char_backend_file not yet implemented for WIN32") 
   55        : sc_core::sc_module(name)
 
   56        , p_read_file(
"read_file", 
"", 
"read file path")
 
   57        , p_write_file(
"write_file", 
"", 
"write file path")
 
   58        , p_baudrate(
"baudrate", 0, 
"number of bytes per second")
 
   59        , socket(
"biflow_socket")
 
   68    void start_of_simulation()
 
   70        if (!p_read_file.get_value().empty()) {
 
   71            r_file = 
fopen(p_read_file.get_value().c_str(), 
"r");
 
   73            if (r_file == 
NULL) 
SCP_ERR(()) << 
"Error opening the file.\n";
 
   74            update_event.notify(sc_core::SC_ZERO_TIME);
 
   76            SCP_ERR(()) << 
"Error reading the path of p_read_file.\n";
 
   79        if (!p_write_file.get_value().empty()) {
 
   80            w_file = 
fopen(p_write_file.get_value().c_str(), 
"w");
 
   82            if (w_file == 
NULL) 
SCP_ERR(()) << 
"Error opening the file.\n";
 
   86            SCP_ERR(()) << 
"Error reading the path of p_write_file.\n";
 
   89    void end_of_elaboration() {}
 
   93        if (p_baudrate.get_value() == 0)
 
   96            delay = (1.0 / p_baudrate.get_value());
 
   98        while (
fread(&
c, 
sizeof(
char), 1, r_file) == 1) {
 
  100            sc_core::wait(delay, sc_core::SC_SEC);
 
  106    void writefn(tlm::tlm_generic_payload& 
txn, sc_core::sc_time& 
t)
 
  109        for (
int i = 0; 
i < 
txn.get_streaming_width(); 
i++) {
 
  112                SCP_ERR(()) << 
"Error writing to the file.\n";
 
 
void register_b_transport(MODULE *mod, void(MODULE::*cb)(tlm::tlm_generic_payload &, sc_core::sc_time &))
Register b_transport to be called whenever data is received from the socket.
Definition biflow-socket.h:227