diff --git a/SysCAMSGenerationCode/generated_CPP/distance_sensor.cpp b/SysCAMSGenerationCode/generated_CPP/distance_sensor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d29e192d313a6f2da3302a6f48997cda0d94d21c --- /dev/null +++ b/SysCAMSGenerationCode/generated_CPP/distance_sensor.cpp @@ -0,0 +1,28 @@ +#include <systemc-ams> +#include "analog_to_digital.h" + +// Simulation entry point. +int sc_main(int argc, char *argv[]) { + + using namespace sc_core; + using namespace sca_util; + + // Declare signal to interconnect. + + // Instantiate source and sink as well as bind their ports to the signal. + analog_to_digital analog_to_digital_1("analog_to_digital_1"); + analog_to_digital_1.sensorIn( + // Configure signal tracing. + sca_trace_file* tfp = sca_create_tabular_trace_file("distance_sensor_tb"); + + + // Start simulation. + sc_start(100.0, SC_MS); + + // Close trace file and stop simulation to enable clean-up by + // asking SystemC to execute all end_of_simulation() callbacks. + sca_close_tabular_trace_file(tfp); + sc_stop(); + return 0; +} + diff --git a/SysCAMSGenerationCode/generated_H/analog_to_digital.h b/SysCAMSGenerationCode/generated_H/analog_to_digital.h new file mode 100644 index 0000000000000000000000000000000000000000..938aefb0e3430e7f21ce5ce1d5936e13f94699da --- /dev/null +++ b/SysCAMSGenerationCode/generated_H/analog_to_digital.h @@ -0,0 +1,36 @@ +#ifndef ANALOG_TO_DIGITAL_H +#define ANALOG_TO_DIGITAL_H + +#include <cmath> +#include <iostream> +#include <systemc-ams> + +SCA_TDF_MODULE(analog_to_digital) { + + // TDF port declarations + sca_tdf::sca_in<double> sensorIn; + // Converter port declarations + sca_tdf::sca_de::sca_out<int> soclibOut; + sca_tdf::sca_de::sca_in<int> soclibIn; + + // Constructor + SCA_CTOR(analog_to_digital) + : sensorIn("sensorIn") + , soclibOut("soclibOut") + , soclibIn("soclibIn") + {} + + void set_attributes() { + sensorIn.set_rate(1); + sensorIn.set_delay(0); + soclibOut.set_rate(1); + soclibOut.set_delay(0); + soclibIn.set_rate(1); + soclibIn.set_delay(0); + } + + void processing() { } + +}; + +#endif // ANALOG_TO_DIGITAL_H \ No newline at end of file