I’m new to systemC programming i’m writing a D flip-flop but i couldn’t find a way to write the main program and to enter signals (din , clock and dout in my case) :
this is my code :
#include "systemc.h"
SC_MODULE(d_ff) { // on déclare le module à l'aide de la macro SC_MODULE.
sc_in<bool> din; // signal d'entrée
sc_in<bool> clock;// définition de l'horlogue
sc_out<bool> dout;// signal de sortie
void doit() { // La fonction qui assure le traitement de la bascule D
dout = din; // Affectation de la valeur du port d'entrée dans le port de sortie
cout << dout;
};
SC_CTOR(d_ff) { //le constructeur du module d_ff
SC_METHOD(doit); //On enregistre la fonction doit comme un processus
sensitive_pos << clock; }
int sc_main (int argc , char *argv[]) {
d_ff obj();
din<=true;
clock<=false;
obj.doit();
return 0;
}};
You have to install VCD Viewers to see simulation results in the form of waveforms.
I suppose that’s what you want
I use this one http://www.iss-us.com/wavevcd/index.htm, but there are others.
Next you have to make some changes in you code. The changes will produce the vcd files:
I made this one:
I hope it will help