Change from blackbox to whitebox annotation.

Yosys's treatment of blackbox attributes's now includes stripping all contents
within the blackbox.  The whitebox attribute is what should be used to
explicitly define contents of a blackbox.

This PR also updates Yosys (as of 4 days ago at b6345b1).

Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
diff --git a/tests/clocks/input_attr_clock/input_attr_clock.sim.v b/tests/clocks/input_attr_clock/input_attr_clock.sim.v
index e189827..5b8e9cd 100644
--- a/tests/clocks/input_attr_clock/input_attr_clock.sim.v
+++ b/tests/clocks/input_attr_clock/input_attr_clock.sim.v
@@ -2,7 +2,7 @@
  * `input wire a` should be detected as a clock because of the `(* CLOCK *)`
  * attribute.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, b, o);
 	(* CLOCK *)
 	input wire a;
diff --git a/tests/clocks/input_named_clk/input_named_clk.sim.v b/tests/clocks/input_named_clk/input_named_clk.sim.v
index a3b5f4d..c9a6d1d 100644
--- a/tests/clocks/input_named_clk/input_named_clk.sim.v
+++ b/tests/clocks/input_named_clk/input_named_clk.sim.v
@@ -2,7 +2,7 @@
  * `input wire clk` should be detected as a clock despite this being a black
  * box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(clk, a, o);
 	input wire clk;
 	input wire a;
diff --git a/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v b/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v
index 3461483..28dce3f 100644
--- a/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v
+++ b/tests/clocks/input_named_rdclk/input_named_rdclk.sim.v
@@ -2,7 +2,7 @@
  * `input wire rdclk` should be detected as a clock despite this being a black
  * box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(rdclk, a, o);
 	input wire rdclk;
 	input wire a;
diff --git a/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v b/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v
index e772d44..1b89608 100644
--- a/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v
+++ b/tests/clocks/multiple_inputs_named_clk/multiple_inputs_named_clk.sim.v
@@ -2,7 +2,7 @@
  * `input wire rdclk` and `input wire wrclk` should be detected as a clock
  * despite this being a black box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, rdclk, b, wrclk, c, o);
 	input wire a;
 	input wire rdclk;
diff --git a/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v b/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v
index 6322f5e..bdab184 100644
--- a/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v
+++ b/tests/clocks/multiple_outputs_named_clk/multiple_outputs_named_clk.sim.v
@@ -2,7 +2,7 @@
  * `output wire rdclk` and `output wire wrclk` should be detected as a clock
  * despite this being a black box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, b, rdclk, o, wrclk);
 	input wire a;
 	input wire b;
diff --git a/tests/clocks/output_attr_clock/output_attr_clock.sim.v b/tests/clocks/output_attr_clock/output_attr_clock.sim.v
index d330574..ba9022a 100644
--- a/tests/clocks/output_attr_clock/output_attr_clock.sim.v
+++ b/tests/clocks/output_attr_clock/output_attr_clock.sim.v
@@ -2,7 +2,7 @@
  * `output wire o` should be detected as a clock because of the `(* CLOCK *)`
  * attribute.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, b, o);
 	input wire a;
 	input wire b;
diff --git a/tests/clocks/output_named_clk/output_named_clk.sim.v b/tests/clocks/output_named_clk/output_named_clk.sim.v
index fa3ff50..07bf2df 100644
--- a/tests/clocks/output_named_clk/output_named_clk.sim.v
+++ b/tests/clocks/output_named_clk/output_named_clk.sim.v
@@ -2,7 +2,7 @@
  * `output wire clk` should be detected as a clock despite this being a black
  * box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, b, clk);
 	input wire a;
 	input wire b;
diff --git a/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v b/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v
index d0e6102..1b95470 100644
--- a/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v
+++ b/tests/clocks/output_named_rdclk/output_named_rdclk.sim.v
@@ -2,7 +2,7 @@
  * `output wire rdclk` should be detected as a clock despite this being a black
  * box module.
  */
-(* blackbox *)
+(* whitebox *)
 module block(a, b, rdclk);
 	input wire a;
 	input wire b;
diff --git a/tests/dsp_combinational/dsp_combinational.sim.v b/tests/dsp_combinational/dsp_combinational.sim.v
index 249f5c4..56ca49d 100644
--- a/tests/dsp_combinational/dsp_combinational.sim.v
+++ b/tests/dsp_combinational/dsp_combinational.sim.v
@@ -1,6 +1,6 @@
 `ifndef DSP_COMB
 `define DSP_COMB
-(* blackbox *)
+(* whitebox *)
 module dsp_combinational (
 	a, b, m,
 	out
diff --git a/tests/fig41-full-adder/adder.sim.v b/tests/fig41-full-adder/adder.sim.v
index feddbab..b255a67 100644
--- a/tests/fig41-full-adder/adder.sim.v
+++ b/tests/fig41-full-adder/adder.sim.v
@@ -1,4 +1,4 @@
-(* blackbox *)
+(* whitebox *)
 module adder (
 	a, b, cin,
 	sum, cout
diff --git a/tests/fig42-dff/dff.sim.v b/tests/fig42-dff/dff.sim.v
index cec81d6..6dcd5d3 100644
--- a/tests/fig42-dff/dff.sim.v
+++ b/tests/fig42-dff/dff.sim.v
@@ -1,4 +1,4 @@
-(* blackbox *)
+(* whitebox *)
 module dff (d, clk, q);
 	input wire d;
 	input wire clk;
diff --git a/vlog_to_pbtype.py b/vlog_to_pbtype.py
index 0717968..d2b8da8 100755
--- a/vlog_to_pbtype.py
+++ b/vlog_to_pbtype.py
@@ -120,10 +120,27 @@
 INVALID_INSTANCE = -1
 
 
+def is_mod_blackbox(mod):
+    """ Returns true if module is annotated with blackbox (or equivilant).
+
+    Yosys supports 3 attributes that denote blackbox behavior:
+
+    "blackbox" - Blackbox with no internal wiring
+    "whitebox" - Blackbox with internal connections and timing.
+    "lib_whitebox" - Like "whitebox" when read with "-lib", otherwise
+        attribute is removed.
+
+    """
+
+    return (mod.attr("lib_whitebox", 0) == 1) or \
+           (mod.attr("whitebox", 0) == 1) or \
+           (mod.attr("blackbox", 0) == 1)
+
+
 def mod_pb_name(mod):
     """Convert a Verilog module to a pb_type name in the format documented here:
     https://github.com/SymbiFlow/symbiflow-arch-defs/#names"""
-    is_blackbox = (mod.attr("blackbox", 0) == 1)
+
     modes = mod.attr("MODES", None)
     has_modes = modes is not None
     # Process type and class of module
@@ -136,7 +153,7 @@
         return mod.name
     elif mod_cls == "lut":
         return mod.name
-    elif is_blackbox and not has_modes:
+    elif is_mod_blackbox(mod) and not has_modes:
         return mod.name
     else:
         #TODO: other types
@@ -209,7 +226,7 @@
         d_port_xml = ET.SubElement(dir_xml, 'port', d_port)
 
     # Find out whether or not the module we are generating content for is a blackbox
-    is_blackbox = (mod.attr("blackbox", 0) == 1) or not mod.cells
+    is_blackbox = is_mod_blackbox(mod) or not mod.cells
 
     # List of entries in format ((from_cell, from_pin), (to_cell, to_pin))
     interconn = []
@@ -412,7 +429,7 @@
     pb_xml_attrs = dict()
     pb_xml_attrs["name"] = mod_pname
     # If we are a blackbox with no modes, then generate a blif_model
-    is_blackbox = mod.attr("blackbox", 0) == 1 or not mod.cells
+    is_blackbox = is_mod_blackbox(mod) or not mod.cells
     has_modes = modes is not None
 
     print("is_blackbox", is_blackbox, "has_modes?", has_modes)