Jump to content

separate out stimulus generation from monitoring and checking.


klh

Recommended Posts

You need to separate out stimulus generation from monitoring and checking.

 

#include "systemc.h"

SC_MODULE(MultTb){

  sc_in<bool>  clk;
  sc_out<int>  din1;
  sc_out<int>  din2;
  sc_in <int>  dout;

  void stim_gen();

  SC_CTOR(MultTb){
   SC_THREAD(stim_gen);
   sensitive << clk.pos();
  }

};

void MultTb::stim_gen(){
  wait();
  din1 = 10;
  din2 = 10;
  wait();
  printf("[MON]:: %0d * %0d = %0d\n", din1.read(), din2.read(), dout.read());
  din1 = -10;
  din2 = 10;
  wait();
  printf("[MON]:: %0d * %0d = %0d\n", din1.read(), din2.read(), dout.read());

  sc_stop(); 
}

Link to comment
Share on other sites

  • klh changed the title to separate out stimulus generation from monitoring and checking.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...