Jump to content

SystemC 2.3 Pretty-Printer


aheimberger

Recommended Posts

Hey Guys,

I don't know if you know about GDB Pretty-Printer. GDB Pretty-Print let you print your debug output in a legible way. I tried to write the Pretty-Printers analyzing the SystemC 2.3 implementation and I was learning how the information is stored within the SystemC implementation. You will find the Pretty-Printer under following link. 

 

https://github.com/AHeimberger/SystemC-2.3-Pretty-Printer

 

On Github you will find instructions about installing the Pretty-Printer and a verification python file. Hope this Pretty-Printer helps you and does not cause to many problems. I were also able to use them within Eclipse.

Cheers Andy

post-1946-0-80460500-1417379152_thumb.png

Link to comment
Share on other sites

  • 11 months later...

Hey Guys,

I don't know if you know about GDB Pretty-Printer. GDB Pretty-Print let you print your debug output in a legible way. I tried to write the Pretty-Printers analyzing the SystemC 2.3 implementation and I was learning how the information is stored within the SystemC implementation. You will find the Pretty-Printer under following link. 

 

https://github.com/AHeimberger/SystemC-2.3-Pretty-Printer

 

On Github you will find instructions about installing the Pretty-Printer and a verification python file. Hope this Pretty-Printer helps you and does not cause to many problems. I were also able to use them within Eclipse.

Cheers Andy

 

Thank you! 

I think we need something like that to be bundled with reference SystemC implementation. 

Link to comment
Share on other sites

  • 2 years later...

Hi Andy,

Thanks for your contribution. That's very good to have!

Do you have something similar for sc_in/sc_out/sc_inout types?

E.g.,  in the following code:

SC_MODULE(dummy) {
  sc_in_clk clock;
  sc_in<bool> i;
  sc_out<sc_int<2> > o;
  SC_CTOR(dummy): clock("clk"),i("i"),o("o") { ... }
  ...
};

int sc_main (int argc, char **argv) {
  dummy d("d");
  sc_signal<bool> clk;
  sc_signal<bool> i;
  sc_signal<sc_int<2> > o;
  d.clock(clk);
  d.i(i);
  d.o(o);
  ...
  return 0;
}

If I put a breakpoint with gdb on the return statement, and try to print sc_signal/sc_in/sc_out elements, I get not pretty-printed elements.

Worse, I get the following error when printing signal "o" and output port "d.o":

Quote

Python Exception <class 'gdb.error'> There is no member or method named m_len.:

Do you know what can happen here?

Thanks,

Florian

Link to comment
Share on other sites

On 9/26/2018 at 8:22 AM, fletombe said:

Worse, I get the following error when printing signal "o" and output port "d.o":

Do you know what can happen here?

Thanks,

Florian

I'm not using this particular pretty-printer, since we have a better one internally.  But simply by looking at source code, it seems like it does not supports signals/ports: https://github.com/AHeimberger/SystemC-2.3-Pretty-Printer/blob/master/systemc23/systemc23printers.py

Link to comment
Share on other sites

On 9/27/2018 at 7:28 PM, Roman Popov said:

I'm not using this particular pretty-printer, since we have a better one internally.  But simply by looking at source code, it seems like it does not supports signals/ports: https://github.com/AHeimberger/SystemC-2.3-Pretty-Printer/blob/master/systemc23/systemc23printers.py

Thanks, I had noticed that. But then, why would I reach a pretty-printer if those types are not supported?

By curiosity, may I know how you manage signals/ports?

Thanks,

Florian

Link to comment
Share on other sites

6 hours ago, fletombe said:

Thanks, I had noticed that. But then, why would I reach a pretty-printer if those types are not supported?

Hard to say without debugging. In source code I see they are registered using "RegexpCollectionPrettyPrinter", probably sc_dt::sc_int<(.*)> matches sc_signal<sc_int<2>> ? 

By curiosity, may I know how you manage signals/ports?

Signal has m_cur_val and m_new_val fields, storing current and next signal value. So they are pretty-printed as  "m_cur_val -> m_new_val".  Ports are just decorated pointers, signal port has m_interface field holding a pointer to signal, so pretty-printer dereferences it, casts to dynamic type and prints it the same way as signal.

Actually you can do much more with GDB Python API. I have even written SystemC to Verilog converter using GDB (Generates complete netlist, but without process bodies). Commercial SystemC interactive simulators/debuggers are also based on GDB AFAIK.

Link to comment
Share on other sites

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...