Skip to content
Snippets Groups Projects
Commit 2bbfbeb4 authored by Irina LEE's avatar Irina LEE
Browse files

new files .h ans .cpp

parent 2fbad2f4
No related branches found
No related tags found
1 merge request!72Syscams
#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;
}
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment