@@ -59,6 +59,7 @@ struct ShowWorker
59
59
RTLIL::Module *module ;
60
60
uint32_t currentColor;
61
61
bool genWidthLabels;
62
+ std::string wireshape;
62
63
bool genSignedLabels;
63
64
bool stretchIO;
64
65
bool enumerateIds;
@@ -428,16 +429,19 @@ struct ShowWorker
428
429
429
430
std::map<std::string, std::string> wires_on_demand;
430
431
for (auto wire : module ->selected_wires ()) {
431
- const char * shape = " diamond " ;
432
+ std::string shape = wireshape ;
432
433
if (wire->port_input || wire->port_output )
433
434
shape = " octagon" ;
435
+ const bool is_borderless = (shape == " plaintext" ) || (shape == " plain" ) || (shape == " none" );
434
436
if (wire->name .isPublic ()) {
435
437
std::string src_href;
436
438
if (href && wire->attributes .count (ID::src) > 0 )
437
439
src_href = stringf (" , href=\" %s\" " , escape (wire->attributes .at (ID::src).decode_string ()));
438
- fprintf (f, " n%d [ shape=%s, label=\" %s\" , %s%s];\n " ,
439
- id2num (wire->name ), shape, findLabel (wire->name .str ()),
440
- nextColor (RTLIL::SigSpec (wire), " color=\" black\" , fontcolor=\" black\" " ).c_str (),
440
+ fprintf (f, " n%d [ shape=%s,%s label=\" %s\" , %s%s];\n " ,
441
+ id2num (wire->name ), shape.c_str (), is_borderless? " margin=0, width=0" : " " , findLabel (wire->name .str ()),
442
+ is_borderless
443
+ ? " color=\" none\" , fontcolor=\" black\" "
444
+ : nextColor (RTLIL::SigSpec (wire), " color=\" black\" , fontcolor=\" black\" " ).c_str (),
441
445
src_href.c_str ());
442
446
if (wire->port_input )
443
447
all_sources.insert (stringf (" n%d" , id2num (wire->name )));
@@ -616,10 +620,10 @@ struct ShowWorker
616
620
}
617
621
618
622
ShowWorker (FILE *f, RTLIL::Design *design, std::vector<RTLIL::Design*> &libs, uint32_t colorSeed, bool genWidthLabels,
619
- bool genSignedLabels, bool stretchIO, bool enumerateIds, bool abbreviateIds, bool notitle, bool href,
623
+ const std::string wireshape, bool genSignedLabels, bool stretchIO, bool enumerateIds, bool abbreviateIds, bool notitle, bool href,
620
624
const std::vector<std::pair<std::string, RTLIL::Selection>> &color_selections,
621
625
const std::vector<std::pair<std::string, RTLIL::Selection>> &label_selections, RTLIL::IdString colorattr) :
622
- f (f), design(design), currentColor(colorSeed), genWidthLabels(genWidthLabels),
626
+ f (f), design(design), currentColor(colorSeed), genWidthLabels(genWidthLabels), wireshape(wireshape),
623
627
genSignedLabels (genSignedLabels), stretchIO(stretchIO), enumerateIds(enumerateIds), abbreviateIds(abbreviateIds),
624
628
notitle (notitle), href(href), color_selections(color_selections), label_selections(label_selections), colorattr(colorattr)
625
629
{
@@ -712,6 +716,9 @@ struct ShowPass : public Pass {
712
716
log (" Use the specified attribute to assign colors. A unique color is\n " );
713
717
log (" assigned to each unique value of this attribute.\n " );
714
718
log (" \n " );
719
+ log (" -wireshape <graphviz_shape>\n " );
720
+ log (" Use the specified shape for wire nodes. E.g. plaintext.\n " );
721
+ log (" \n " );
715
722
log (" -width\n " );
716
723
log (" annotate buses with a label indicating the width of the bus.\n " );
717
724
log (" \n " );
@@ -770,6 +777,7 @@ struct ShowPass : public Pass {
770
777
std::string prefix = stringf (" %s/.yosys_show" , getenv (" HOME" ) ? getenv (" HOME" ) : " ." );
771
778
#endif
772
779
std::string viewer_exe;
780
+ std::string flag_wireshape = " diamond" ;
773
781
std::vector<std::string> libfiles;
774
782
std::vector<RTLIL::Design*> libs;
775
783
uint32_t colorSeed = 0 ;
@@ -834,6 +842,10 @@ struct ShowPass : public Pass {
834
842
format = args[++argidx];
835
843
continue ;
836
844
}
845
+ if (arg == " -wireshape" && argidx+1 < args.size ()) {
846
+ flag_wireshape = args[++argidx];
847
+ continue ;
848
+ }
837
849
if (arg == " -width" ) {
838
850
flag_width= true ;
839
851
continue ;
@@ -916,7 +928,7 @@ struct ShowPass : public Pass {
916
928
delete lib;
917
929
log_cmd_error (" Can't open dot file `%s' for writing.\n " , dot_file.c_str ());
918
930
}
919
- ShowWorker worker (f, design, libs, colorSeed, flag_width, flag_signed, flag_stretch, flag_enum, flag_abbreviate, flag_notitle, flag_href, color_selections, label_selections, colorattr);
931
+ ShowWorker worker (f, design, libs, colorSeed, flag_width, flag_wireshape, flag_signed, flag_stretch, flag_enum, flag_abbreviate, flag_notitle, flag_href, color_selections, label_selections, colorattr);
920
932
fclose (f);
921
933
922
934
for (auto lib : libs)
0 commit comments