Skip to content

Instantly share code, notes, and snippets.

@rahulbhadani
Last active September 2, 2022 18:46
Show Gist options
  • Save rahulbhadani/97011f51dbb2a720a4688cb0e157d19a to your computer and use it in GitHub Desktop.
Save rahulbhadani/97011f51dbb2a720a4688cb0e157d19a to your computer and use it in GitHub Desktop.
Reader Writer Simulation
#include "reader_writer.h"
int sc_main(int argc, char **argv)
{
/*Declare/define primitive channel -- sc_signal*/
sc_signal<unsigned int> SIG;
/*Declare a master -- period 10 ns, duty cycle 50%*/
sc_clock CLK("clock", 10.0, SC_NS, 0.5);
Write W("WRITER");
Read R("READER");
W.clk(CLK);
W.out(SIG);
R.clk(CLK);
R.in(SIG);
/*Run simulation for predefined time interval and stop */
sc_start(500.0, SC_NS);
sc_stop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment