Fix sublayer to use layer code (+ pruning support + default unroll limit of 4096)
This address issue #79 (closed), where synthesis fails in Vivado 2018.2
In addition, we now count the number of zeros in sublayer call to appropriately set the multiplier limit.
However, there's still an open issue, in that the initiation interval is now 2 instead of 1 with this code. It seems to be related to the multiplier limit code because without the limit the initiation interval goes back to 1.
Tested with the following keras-config.yml
:
KerasJson: example-keras-model-files/KERAS_3layer.json
KerasH5: example-keras-model-files/KERAS_3layer_70pruned_retrained_weights.h5
OutputDir: my-hls-test
ProjectName: myproject
XilinxPart: xcku115-flvb2104-2-i
ClockPeriod: 5
IOType: io_parallel # options: io_serial/io_parallel
ReuseFactor: 1
DefaultPrecision: ap_fixed<16,6>
and got latency of 22 clocks for the 3-layer model:
================================================================
== Performance Estimates
================================================================
+ Timing (ns):
* Summary:
+--------+-------+----------+------------+
| Clock | Target| Estimated| Uncertainty|
+--------+-------+----------+------------+
|ap_clk | 5.00| 4.366| 0.62|
+--------+-------+----------+------------+
+ Latency (clock cycles):
* Summary:
+-----+-----+-----+-----+----------+
| Latency | Interval | Pipeline |
| min | max | min | max | Type |
+-----+-----+-----+-----+----------+
| 22| 22| 2| 2| function |
+-----+-----+-----+-----+----------+
================================================================
== Utilization Estimates
================================================================
* Summary:
+---------------------+---------+-------+---------+--------+
| Name | BRAM_18K| DSP48E| FF | LUT |
+---------------------+---------+-------+---------+--------+
|DSP | -| -| -| -|
|Expression | -| -| 0| 6|
|FIFO | -| -| -| -|
|Instance | 13| 954| 23564| 42434|
|Memory | -| -| -| -|
|Multiplexer | -| -| -| 69|
|Register | -| -| 3201| -|
+---------------------+---------+-------+---------+--------+
|Total | 13| 954| 26765| 42509|
+---------------------+---------+-------+---------+--------+
|Available SLR | 2160| 2760| 663360| 331680|
+---------------------+---------+-------+---------+--------+
|Utilization SLR (%) | ~0 | 34| 4| 12|
+---------------------+---------+-------+---------+--------+
|Available | 4320| 5520| 1326720| 663360|
+---------------------+---------+-------+---------+--------+
|Utilization (%) | ~0 | 17| 2| 6|
+---------------------+---------+-------+---------+--------+