Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

scsc's Achievements


Member (1/2)



  1. Thanks Eyck again for these pointers. Much clearer now on the structures.
  2. @Eyck, Looking at the GitHub you provided, what's the instructions to generate RTL and verification test cases? I am not familiar with what TGC cores are. Does the RTL and verification generation come with the libraries in these TGC core libraries? I think the Vibes are just for the interconnects like AXI, maybe for the cores.
  3. Thanks Guys for the links!
  4. Realized after digging into the old risc-cpu example coming with systemc's installation that the example wasn't complete. For example, the code seemed containing some cache coherence protocols like MESI. But there was no implementation for that except some printf() statements. Same as the branch prediction unit. So just wonder if there are more comprehensive example out there?
  5. Problem resolved. This line that caused syntax error input_mant.template set_slc(0, mant_i.template slc<Wfl - 2>(0)); should be: input_mant.set_slc(0, mant_i.template slc<Wfl - 2>(0));
  6. The error message is simply "syntax error: template in line 371" (the specific line in the post). Why is this an FPGA question? ac_math is from Mentor's HLS library. I agree this is not part of SystemC but I read someone here had posted AC HLS questions too.
  7. Someone seemed had used ac_math library. So here is my question. What's syntax error with the template keyword in the following line of rtest_ac_abs.cpp: ac_fixed<Wfl, Ifl, true> input_mant; // Set the sign bit to zero to ensure a positive value. input_mant[Wfl - 1] = 0; // Set the bit adjacent to the sign bit to 1 to ensure a normalized mantissa input_mant[Wfl - 2] = 1; // Set the remaining bits to the bit pattern stored in the last (Wfl - 2) bits in mant_i. input_mant.template set_slc(0, mant_i.template slc<Wfl - 2>(0)); //<<< this line has syntax error???
  8. Thanks. I realized my LRM is an "OSCI SystemC 2.1 LRM", which was published in 2005. The 1666-2011 one has sc_vector.
  9. The 2.3 LRM didn't even mention sc_vector. It is a hidden feature?
  10. The answer is here: https://stackoverflow.com/questions/48312460/c17-filesystem-is-not-a-namespace-name/48312534#48312534 This particular g++ version doesn't support full c++17 features.
  11. I think I had also already specified C++17 already: g++ -c -g -Wall -std=c++17 -DSC_INCLUDE_FX -DSC_INCLUDE_DYNAMIC_PROCESSES -I. -I/opt/systemc/include But still got that "inline" error. I am using g++ version g++ --version g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 looking at the g++ manual, there is no c++17 but c++1z. But even with "-std=c++1z", the errors still persist. What version of g++ are you using to support this feature?
  12. Tried to run an example using C++14/17 styles. But got these errors similar to this: error: ‘created’ declared as an ‘inline’ field inline static size_t created{ 0u }; Doesn't 14 or 17 support this "inline" feature? Both "-std=c++14" and "-std=c++17" generated the same errors.
  13. I don't have EDA Playground account. But I drop test code here: #include <systemc.h> SC_MODULE(nand2) { sc_in<bool> a; sc_in<bool> b; sc_out<bool> f; sc_out<bool> ff; sc_event e; SC_CTOR(nand2) { SC_METHOD(do_nand2); // the right way is use SC_METHOD + next_trigger. sensitive << a << b; SC_THREAD(nand2_thread); // but how to use use SC_THREAD instead? } void nand2_thread() { bool aa, bb, c; aa = a.read(); bb = b.read(); c = !(a & b); e.notify(4, SC_NS); for (;;) { wait(e); ff.write(c); } } void do_nand2() { bool aa, bb, ff; aa = a.read(); bb = b.read(); ff = !(a & b); next_trigger(4, SC_NS); // next_trigger in SC_METHOD had the expteced delay f.write(ff); } }; SC_MODULE(stim) { sc_out<bool> A, B; sc_in<bool> clk; void stimGen() { wait(); A.write(false); B.write(false); wait(); A.write(false); B.write(true); wait(); A.write(true); B.write(true); wait(); A.write(false); B.write(true); } SC_CTOR(stim) { SC_THREAD(stimGen); sensitive << clk.pos(); } }; int sc_main(int argc, char* argv[]) { sc_signal<bool> a; sc_signal<bool> b; sc_signal <bool> f, ff; sc_clock clk("clk", 100, SC_NS, 0.5); stim s("stim"); s.A(a); s.B(b); s.clk(clk); nand2 n2("n2"); n2.a(a); n2.b(b); n2.f(f); n2.ff(ff); sc_trace_file* wf = sc_create_vcd_trace_file("sim"); sc_trace(wf, s.clk, "clk"); sc_trace(wf, n2.a, "a"); sc_trace(wf, n2.b, "b"); sc_trace(wf, n2.f, "f"); sc_trace(wf, n2.ff, "ff"); sc_start(400, SC_NS); sc_close_vcd_trace_file(wf); return 0; }
  14. There are quite a few examples here and on the net that using SC_METHOD to implement delay is the right way. I just want to deepen my understanding on SC_THREAD. I look at the gas station example in SystemC from the Ground Up. The customer_thread2 actually has such delay implemented with a dynamic sensitivity setting: // header file declares SC_THREAD, no sensitivity SC_THREAD(customer2_thread); The implementation of customer2_thread is: void gas_station::customer2_thread(void) { for (;;) { // Simulate gas tank emptying time wait((m_full2+rand()%int(m_full2*0.10))*t_MIN); cout << "INFO: " << name() << " Customer2 needs gas (1) at " << hms() << endl; m_tank2 = 0; // Request fillup from attendant and then // wait for acknowledging event. do { e_request2.notify(); // I need fillup! (2) wait(e_filled); // use dynamic sensitivity <<<<<<<<< this is the delay between e_request2.notify() and e_filled event. } while (m_tank2 == 0); }//endforever }//end customer2_thread() Since e_filled in the customer2_thread comes from another method, I wonder if I can put a standalone event inside the same thread? In other words, the event just triggers the delay from the same thread? For example, a delay thread in a NAND2 function: void nand2_thread() { // nand2_thread has no sensitivity, just like customer2_thread bool aa, bb, c; aa = a.read(); bb = b.read(); c = !(a & b); e.notify(4, SC_NS); // e is an object in nand2. This event seems not notified and triggered correctly, for (;;) { wait(e); // e never comes ff.write(c); } } I think the above code didn't have the right event notified so wait(e) didn't work. What's the right way to setup this event? By the way, how to set enclosure in this forum for code? Pasting code as raw text is hard to read.
  15. Yeah, I did end up putting angles inside entry() and it worked. But I didn't know why the SC_CTOR way didn't work. Now you have pointed out the difference between the FIR example and my error. I complete got it now. Thanks for the advance on variable life times and visibility.
  • Create New...