Jump to content


  • Posts

  • Joined

  • Last visited

ZhangRan's Achievements


Member (1/2)



  1. Thank you so much, I will working hard on your example.
  2. Can someone give me some idea of CPU TLM modeling. Thank you very much.
  3. Hi, I am a noob of systemC and tlm modeling. I just go through same example of systemC TLM modeling, such as “”simple_bus“”. I am trying develop a TLM processor model. This processor is high performance out of oroder processor(more than 10 stages). At first, i am focusing on the performance affected by branch prediction. Is there any examples related to TLM processor modelling? Thank you very much.
  4. many thanks, i have a better understand of block and non-block now.
  5. Thanks, it works well now. In addition, I insert :"input.num_available()" before input.read(). I am curious that the "input.num_available()" is 0 ,but it still can output data. Ran
  6. #include "systemc.h" SC_MODULE(DF_Adder){ sc_fifo_in<int> input1, input2; sc_fifo_out<int> output; void process(){ while (1) { output.write(input1.read() + input2.read()); } } SC_CTOR(DF_Adder) {SC_THREAD(process);} }; SC_MODULE(DF_Const){ sc_fifo_out<int> output; void process() { while (1) { output.write(constant_); } } SC_HAS_PROCESS(DF_Const); DF_Const(sc_module_name N, int C): sc_module(N), constant_(C) { SC_THREAD(process); } int constant_; }; SC_MODULE(DF_Fork){ sc_fifo_in<int> input; sc_fifo_out<int> output1,output2; void process(){ while(1){ int value = input.read(); output1.write(value); output1.write(value); } } SC_CTOR(DF_Fork) {SC_THREAD(process);} }; SC_MODULE(DF_Printer){ sc_fifo_in<int> input; SC_HAS_PROCESS(DF_Printer); DF_Printer(sc_module_name N, unsigned N_ITER): sc_module(N), n_iterations_(N_ITER), done_(false) { SC_THREAD(process); } void process(){ cout << n_iterations_<< endl; for (unsigned i=0; i<n_iterations_; i++) { int value; value = input.read(); cout<< name() << "read data is(in print) " << value << endl ; } done_ = true; return; } ~DF_Printer() { if (!done_) cout << name() << "not done yet" << endl; } unsigned n_iterations_; bool done_; int value; }; #include "systemc.h" #include "adder.h" int sc_main(int, char**){ //instance DF_Const constant("constant", 1); DF_Adder adder("adder"); DF_Fork fork("fork"); DF_Printer printer("printer",10); //fifo sc_fifo<int> const_out("const_out", 5); sc_fifo<int> adder_out("adder_put", 1); sc_fifo<int> feedback("feedback", 1); sc_fifo<int> to_printer("to_printer", 1); //initial //connection constant.output(const_out); adder.input1(feedback); adder.input2(const_out); adder.output(adder_out); fork.input(adder_out); fork.output1(feedback); fork.output2(to_printer); printer.input(to_printer); //start sc_start(5,SC_NS); feedback.write(42); sc_start(); return 0; } Hi, I am a noob of sysC, and trying some basic case. This case is a simple add 1 counter, and using the DF_Printer to print the result. However, the printed value never comes up. It seems like that "value = input.read()" can break the for loop. can anyone give me some idea of this question? Thank you very much. Ran
  • Create New...