FC2カウンター FPGAの部屋 SmartHLS
fc2ブログ

FPGAやCPLDの話題やFPGA用のツールの話題などです。 マニアックです。 日記も書きます。

FPGAの部屋

FPGAの部屋の有用と思われるコンテンツのまとめサイトを作りました。Xilinx ISEの初心者の方には、FPGAリテラシーおよびチュートリアルのページをお勧めいたします。

Microchip 社の高位合成ツール SmartHLS の fpga-hls-examples をやってみる3(AXI4 Master)

Microchip 社の高位合成ツール SmartHLS の fpga-hls-examples をやってみる2(AXI4 Slave その 2)”の続き。

MicrochipTech/fpga-hls-examples の axi_initiator をやってみよう。
fpga-hls-examples/axi_initiator/axi_initiator.cpp がソースコードとテストベンチだ。

SmartHLS 2021.2 の axi_initiator プロジェクトを示す。
SmartHLS_106_211225.png

Compile Software アイコンをクリックしてソフトウェアとしてコンパイルする。
Run Software アイコンをクリックして実行した。
SmartHLS_107_211225.png

PASS! が表示された。

Compile Software to Hardware アイコンをクリックして、ソフトウェアからハードウェアへのコンパイルを行った。
SmartHLS_108_211225.png

ログを示す。

// ----------------------------------------------------------------------------
// Smart High-Level Synthesis Tool Version 2021.2
// Copyright (c) 2015-2021 Microchip Technology Inc. All Rights Reserved.
// For support, please contact: smarthls@microchip.com
// Date: Sat Dec 25 04:12:11 2021
// ----------------------------------------------------------------------------

SmartHLS Summary Report for Project: axi_initiator.

Table of Contents
  1. RTL Interface
  2. Scheduling Result
  3. Pipeline Result
  4. Memory Usage
  5. Accelerator Information
  6. Resource Binding with Adaptive Latency


====== 1. RTL Interface ======

+-------------------------------------------------------------------------------------------+
| RTL Interface Generated by SmartHLS                                                       |
+-----------+----------------+------------------------+------------------+------------------+
| C++ Name  | Interface Type | Signal Name            | Signal Bit-width | Signal Direction |
+-----------+----------------+------------------------+------------------+------------------+
|           | Control        | clk                    | 1                | input            |
|           |                | finish                 | 1                | output           |
|           |                | ready                  | 1                | output           |
|           |                | reset                  | 1                | input            |
|           |                | start                  | 1                | input            |
+-----------+----------------+------------------------+------------------+------------------+
| initiator | AXI Master     | initiator_ar_addr      | 32               | output           |
|           |                | initiator_ar_burst     | 2                | output           |
|           |                | initiator_ar_len       | 8                | output           |
|           |                | initiator_ar_ready     | 1                | input            |
|           |                | initiator_ar_size      | 3                | output           |
|           |                | initiator_ar_valid     | 1                | output           |
|           |                | initiator_aw_addr      | 32               | output           |
|           |                | initiator_aw_burst     | 2                | output           |
|           |                | initiator_aw_len       | 8                | output           |
|           |                | initiator_aw_ready     | 1                | input            |
|           |                | initiator_aw_size      | 3                | output           |
|           |                | initiator_aw_valid     | 1                | output           |
|           |                | initiator_b_resp       | 2                | input            |
|           |                | initiator_b_resp_ready | 1                | output           |
|           |                | initiator_b_resp_valid | 1                | input            |
|           |                | initiator_r_data       | 64               | input            |
|           |                | initiator_r_last       | 1                | input            |
|           |                | initiator_r_ready      | 1                | output           |
|           |                | initiator_r_resp       | 2                | input            |
|           |                | initiator_r_valid      | 1                | input            |
|           |                | initiator_w_data       | 64               | output           |
|           |                | initiator_w_last       | 1                | output           |
|           |                | initiator_w_ready      | 1                | input            |
|           |                | initiator_w_strb       | 8                | output           |
|           |                | initiator_w_valid      | 1                | output           |
+-----------+----------------+------------------------+------------------+------------------+

The Verilog top-level module ports that are not listed in the above table are unused. Please tie the unused input ports to 0.

====== 2. Scheduling Result ======

Please use SmartHLS's schedule viewer to examine the schedule.

Basic Block Latencies:

+-----------------------------------------------------+
| Function: simple_initiator (non-pipelined function) |
+---------------------------+-------------------------+
| Basic Block               | Cycle Latency           |
+---------------------------+-------------------------+
| %for.body.lr.ph           | 1                       |
| %for.body                 | 2                       |
| %for.end                  | 1                       |
+---------------------------+-------------------------+

====== 3. Pipeline Result ======

+---------------------------------+------------------+-------------+------------------------------+---------------------+-----------------+-----------------+---------+
| Label                           | Function         | Basic Block | Location in Source Code      | Initiation Interval | Pipeline Length | Iteration Count | Latency |
+---------------------------------+------------------+-------------+------------------------------+---------------------+-----------------+-----------------+---------+
| for_loop_axi_initiator_cpp_13_5 | simple_initiator | %for.body   | line 13 of axi_initiator.cpp | 1                   | 2               | 256             | 257     |
+---------------------------------+------------------+-------------+------------------------------+---------------------+-----------------+-----------------+---------+

====== 4. Memory Usage ======

+----------------+
| Local Memories |
+----------------+
| None           |
+----------------+

+-------------------------+
| Local Constant Memories |
+-------------------------+
| None                    |
+-------------------------+

+-----------------------+
| Shared Local Memories |
+-----------------------+
| None                  |
+-----------------------+

+------------------+
| Aliased Memories |
+------------------+
| None             |
+------------------+

+-----------------------------------------------------------------------------------------------+
| I/O Memories                                                                                  |
+--------------------+-----------------------+---------------+-------------+------------+-------+
| Name               | Accessing Function(s) | Type          | Size [Bits] | Data Width | Depth |
+--------------------+-----------------------+---------------+-------------+------------+-------+
| initiator_ar_addr  | simple_initiator      | FIFO (LUTRAM) | 0           | 32         | 0     |
| initiator_ar_burst | simple_initiator      | FIFO (LUTRAM) | 0           | 2          | 0     |
| initiator_ar_size  | simple_initiator      | FIFO (LUTRAM) | 0           | 3          | 0     |
| initiator_ar_len   | simple_initiator      | FIFO (LUTRAM) | 0           | 8          | 0     |
| initiator_r_data   | simple_initiator      | FIFO (LUTRAM) | 0           | 64         | 0     |
| initiator_r_resp   | simple_initiator      | FIFO (LUTRAM) | 0           | 2          | 0     |
| initiator_r_last   | simple_initiator      | FIFO (LUTRAM) | 0           | 1          | 0     |
| initiator_aw_addr  | simple_initiator      | FIFO (LUTRAM) | 0           | 32         | 0     |
| initiator_aw_burst | simple_initiator      | FIFO (LUTRAM) | 0           | 2          | 0     |
| initiator_aw_size  | simple_initiator      | FIFO (LUTRAM) | 0           | 3          | 0     |
| initiator_aw_len   | simple_initiator      | FIFO (LUTRAM) | 0           | 8          | 0     |
| initiator_w_data   | simple_initiator      | FIFO (LUTRAM) | 0           | 64         | 0     |
| initiator_w_strb   | simple_initiator      | FIFO (LUTRAM) | 0           | 8          | 0     |
| initiator_w_last   | simple_initiator      | FIFO (LUTRAM) | 0           | 1          | 0     |
| initiator_b_resp   | simple_initiator      | FIFO (LUTRAM) | 0           | 2          | 0     |
+--------------------+-----------------------+---------------+-------------+------------+-------+


====== 5. Accelerator Information ======

No accelerator function is generated.

====== 6. Resource Binding with Adaptive Latency ======

Binding to resource with adaptive latency is disabled.
You can enable this feature by setting config parameter 'ADAPTIVE_LATENCY_BINDING' to 1.


SW/HW Co-Simulation icon をクリックして、SW/HW 協調シミュレーションを行った。
SmartHLS_109_211225.png

クロック・レイテンシは 261 クロックだった。

SmartHLS メニューから SW/HW Co-Simulation with Waveforms を選択した。
全体波形を示す。
SmartHLS_110_211225.png

最初の部分の拡大波形を示す。
SmartHLS_111_211225.png

気になるのは、カーソル位置で initiator_ar_valid が 1 と認識されるのだが、その前に initiator_r_valid が 1 になっていることだ。
アドレスが来る前にデータを Read できるのはおかしいんじゃないのかな?
まあ、最も、イニシエータ側でなくスレーブ側が出しているので、SmartHLS で作ったイニシエータのバグではないようだ。

Synthesize Hardware to FPGA (RTLsynthesis, place and route, for resource timing and results)(Ctrl+shift+V) アイコンをクリックする。
SmartHLS_112_211225.png

ログを示す。

==================================================================
=====  Summary Report for RTL Simulation and FPGA Synthesis  =====
==================================================================

Project name: axi_initiator
FPGA Vendor: MICROSEMI
Device Family: PolarFire
Device: MPF300TS-1FCG1152I

Table of Contents
  1. Simulation Cycle Latency
  2. Timing Result
  3. Resource Usage


====== 1. Simulation Cycle Latency ======

Number of calls:           1
Cycle latency:         261
SW/HW co-simulation: PASS

====== 2. Timing Result ======

+--------------+---------------+-------------+-------------+----------+-------------+
| Clock Domain | Target Period | Target Fmax | Worst Slack | Period   | Fmax        |
+--------------+---------------+-------------+-------------+----------+-------------+
| clk          | 10.000 ns     | 100.000 MHz | 7.647 ns    | 2.353 ns | 424.989 MHz |
+--------------+---------------+-------------+-------------+----------+-------------+

The reported Fmax is for the HLS core in isolation (from Libero's post-place-and-route timing analysis).
When the HLS core is integrated into a larger system, the system Fmax may be lower depending on the critical path of the system.

====== 3. Resource Usage ======

+--------------------------+---------------+--------+------------+
| Resource Type            | Used          | Total  | Percentage |
+--------------------------+---------------+--------+------------+
| Fabric + Interface 4LUT* | 428 + 0 = 428 | 299544 | 0.14       |
| Fabric + Interface DFF*  | 206 + 0 = 206 | 299544 | 0.07       |
| I/O Register             | 0             | 1536   | 0.00       |
| User I/O                 | 0             | 512    | 0.00       |
| uSRAM                    | 0             | 2772   | 0.00       |
| LSRAM                    | 0             | 952    | 0.00       |
| Math                     | 0             | 924    | 0.00       |
+--------------------------+---------------+--------+------------+

* Interface 4LUTs and DFFs are occupied due to the uses of LSRAM, Math, and uSRAM.
  Number of interface 4LUTs/DFFs = (36 * #.LSRAM) + (36 * #.Math) + (12 * #.uSRAM) = (36 * 0) + (36 * 0) + (12 * 0) = 0.


Fmax は 424.989 MHz だった。
  1. 2021年12月25日 04:55 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

SmartHLS の AXI4 Master インターフェース(C++ Library for Custom AXI Master Interface)

Microchip 社の高位合成ツール SmartHLS の AXI4 Master インターフェース生成方法が”Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の C++ Library for Custom AXI Master Interface”に載っている。

まずは、SmartHLS のライブラリを使用して AXI4 Master インターフェースを作成するためにヘッダファイルをインクルードするそうだ。

#include <hls/axi_interface.hpp>


その後、(”Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の C++ Library for Custom AXI Master Interface”の翻訳を引用する)

1. AxiInterface クラスのインスタンスを作成し、テンプレートパラメータを使用してアドレス幅、データ幅、およびwstrb幅を指定します。

2. トップレベル関数を参照して、作成したインスタンスを渡します。例えば、
void MyTop(AxiInterface, /* DATA: */ ap_uint<64>, /* WSTRB: */ ap_uint<8>> &master);

3. ヘッダーで定義されているユーティリティ関数(API)を使用して、AXIマスターインターフェイスを制御します。


fpga-hls-examples/axi_initiator/axi_initiator.cpp”を参照るすると、3. の API は以下に示す関数のようだ。

// Request to read data in burst.
axi_m_read_req<ap_uint<32>, ap_uint<64>, ap_uint<8>>(initiator, r_addr, AXIM_MAX_BURST_LEN);

// Request to write data in burst.
axi_m_write_req<ap_uint<32>, ap_uint<64>, ap_uint<8>>(initiator, w_addr, AXIM_MAX_BURST_LEN);

// Write back the data we read + 1.
ap_uint<64> data = axi_m_read_data<ap_uint<32>, ap_uint<64>>(initiator);
axi_m_write_data<ap_uint<32>, ap_uint<64>, ap_uint<8>>(initiator, ap_uint<64>(data + 1), ap_uint<8>(0xFF), is_last);

// After the last write, read the response code.
ap_uint<2> bresp = axi_m_write_resp(initiator);


Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の C++ Library for Custom AXI Master Interface”の翻訳の一部を引用する。

AXI4スレーブインターフェイスと同じように、このAXI4マスターインターフェイスライブラリは、バーストの追加サポートを備えたAXI4-liteプロトコルのみをサポートします。

SW / HW協調シミュレーションはAXIマスターでサポートされていますが、カーネルが呼び出される前に、ソフトウェアでAXIマスターに対するAXIスレーブの応答をモデル化する必要があります。


そうなのか。。。
  1. 2021年12月24日 04:55 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

Microchip 社の高位合成ツール SmartHLS の fpga-hls-examples をやってみる2(AXI4 Slave その 2)

Microchip 社の高位合成ツール SmartHLS の fpga-hls-examples をやってみる1(AXI4 Slave その 1)”の続き。

MicrochipTech/fpga-hls-examples の axi_target をやってみるということで、前回は、ワークスペースに MicrochipTech/fpga-hls-examples をインポートして axi_target を見た。今回は、C シミュレーション、ソフトウェアからハードウェアへのコンパイル、SW/HW 協調シミュレーション、ハードウェアから FPGA への合成を行う。

C シミュレーションからやってみよう。
Compile Software アイコンをクリックしてソフトウェアとしてコンパイルする。
Run Software アイコンをクリックして実行した。
SmartHLS_100_211222.png

ログを示す。

sum_result = 101010366
xor_result = fefefeea
or_result = ffffffff
PASS


Compile Software to Hardware アイコンをクリックして、ソフトウェアからハードウェアへのコンパイルを行った。
SmartHLS_101_211222.png

ログを示す。

// ----------------------------------------------------------------------------
// Smart High-Level Synthesis Tool Version 2021.2
// Copyright (c) 2015-2021 Microchip Technology Inc. All Rights Reserved.
// For support, please contact: smarthls@microchip.com
// Date: Wed Dec 22 20:32:01 2021
// ----------------------------------------------------------------------------

SmartHLS Summary Report for Project: axi_target.

Table of Contents
  1. RTL Interface
  2. Scheduling Result
  3. Pipeline Result
  4. Memory Usage
  5. Accelerator Information
  6. Resource Binding with Adaptive Latency


====== 1. RTL Interface ======

+-------------------------------------------------------------------------------------------+
| RTL Interface Generated by SmartHLS                                                       |
+---------------+----------------+--------------------+------------------+------------------+
| C++ Name      | Interface Type | Signal Name        | Signal Bit-width | Signal Direction |
+---------------+----------------+--------------------+------------------+------------------+
|               | Control        | clk                | 1                | input            |
|               |                | finish             | 1                | output           |
|               |                | ready              | 1                | output           |
|               |                | reset              | 1                | input            |
|               |                | start              | 1                | input            |
+---------------+----------------+--------------------+------------------+------------------+
| target_memory | AXI Slave      | axi_s_ar_addr      | 32               | input            |
|               |                | axi_s_ar_burst     | 2                | input            |
|               |                | axi_s_ar_len       | 8                | input            |
|               |                | axi_s_ar_ready     | 1                | output           |
|               |                | axi_s_ar_size      | 3                | input            |
|               |                | axi_s_ar_valid     | 1                | input            |
|               |                | axi_s_aw_addr      | 32               | input            |
|               |                | axi_s_aw_burst     | 2                | input            |
|               |                | axi_s_aw_len       | 8                | input            |
|               |                | axi_s_aw_ready     | 1                | output           |
|               |                | axi_s_aw_size      | 3                | input            |
|               |                | axi_s_aw_valid     | 1                | input            |
|               |                | axi_s_b_resp       | 2                | output           |
|               |                | axi_s_b_resp_ready | 1                | input            |
|               |                | axi_s_b_resp_valid | 1                | output           |
|               |                | axi_s_r_data       | 64               | output           |
|               |                | axi_s_r_last       | 1                | output           |
|               |                | axi_s_r_ready      | 1                | input            |
|               |                | axi_s_r_resp       | 2                | output           |
|               |                | axi_s_r_valid      | 1                | output           |
|               |                | axi_s_w_data       | 64               | input            |
|               |                | axi_s_w_last       | 1                | input            |
|               |                | axi_s_w_ready      | 1                | output           |
|               |                | axi_s_w_strb       | 8                | input            |
|               |                | axi_s_w_valid      | 1                | input            |
+---------------+----------------+--------------------+------------------+------------------+

The Verilog top-level module ports that are not listed in the above table are unused. Please tie the unused input ports to 0.

====== 2. Scheduling Result ======

Please use SmartHLS's schedule viewer to examine the schedule.

Basic Block Latencies:

+------------------------------------------------+
| Function: calc_kernel (non-pipelined function) |
+-----------------------+------------------------+
| Basic Block           | Cycle Latency          |
+-----------------------+------------------------+
| %entry                | 7                      |
+-----------------------+------------------------+

+-----------------------------------------------------+
| Function: calc_kernel_orig (non-pipelined function) |
+-------------------------+---------------------------+
| Basic Block             | Cycle Latency             |
+-------------------------+---------------------------+
| %entry                  | 5                         |
+-------------------------+---------------------------+

+----------------------------------------------------+
| Function: target_memory_write (pipelined function) |
+--------------------------+-------------------------+
| Basic Block              | Cycle Latency           |
+--------------------------+-------------------------+
| %init.check.i            | 3                       |
+--------------------------+-------------------------+

+---------------------------------------------------+
| Function: target_memory_read (pipelined function) |
+-------------------------+-------------------------+
| Basic Block             | Cycle Latency           |
+-------------------------+-------------------------+
| %init.check.i           | 5                       |
+-------------------------+-------------------------+

====== 3. Pipeline Result ======

+---------------------+---------------------+---------------+--------------------------------+---------------------+-----------------+-----------------+---------+
| Label               | Function            | Basic Block   | Location in Source Code        | Initiation Interval | Pipeline Length | Iteration Count | Latency |
+---------------------+---------------------+---------------+--------------------------------+---------------------+-----------------+-----------------+---------+
| target_memory_write | target_memory_write | %init.check.i | line 115 of axi_slave.mmap.tmp | 1                   | 3               | n/a             | n/a     |
| target_memory_read  | target_memory_read  | %init.check.i | line 119 of axi_slave.mmap.tmp | 1                   | 5               | n/a             | n/a     |
+---------------------+---------------------+---------------+--------------------------------+---------------------+-----------------+-----------------+---------+

====== 4. Memory Usage ======

+--------------------------------------------------------------------------------------------------------------------------------------------+
| Local Memories                                                                                                                             |
+---------------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| Name                                                    | Accessing Function(s) | Type                  | Size [Bits] | Data Width | Depth |
+---------------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| axi_s_read_state                                        | target_memory_read    | Register              | 1           | 1          | 1     |
| axi_s_read_word_addr                                    | target_memory_read    | Register              | 32          | 32         | 1     |
| init_flag_ZGVZ10axi_s_readIN3hls7ap_uintILj32EEENS      | target_memory_read    | Register (Write-Only) | 1           | 1          | 1     |
| init_flag_ZGVZ10axi_s_readIN3hls7ap_uintILj32EEENS_var0 | target_memory_read    | Register (Write-Only) | 1           | 1          | 1     |
| init_flag_ZGVZ11axi_s_writeIN3hls7ap_uintILj32EEEN      | target_memory_write   | Register (Write-Only) | 1           | 1          | 1     |
| init_flag_ZGVZ10axi_s_readIN3hls7ap_uintILj32EEENS_var1 | target_memory_read    | Register (Write-Only) | 1           | 1          | 1     |
| axi_s_read_burst_len_minus1                             | target_memory_read    | Register              | 8           | 8          | 1     |
| axi_s_read_count                                        | target_memory_read    | Register              | 8           | 8          | 1     |
| axi_s_write_state                                       | target_memory_write   | Register              | 1           | 1          | 1     |
| axi_s_write_word_addr                                   | target_memory_write   | Register              | 32          | 32         | 1     |
| axi_s_write_count                                       | target_memory_write   | Register              | 8           | 8          | 1     |
| init_flag_ZGVZ11axi_s_writeIN3hls7ap_uintILj32EEEN_var0 | target_memory_write   | Register (Write-Only) | 1           | 1          | 1     |
+---------------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+

+-------------------------+
| Local Constant Memories |
+-------------------------+
| None                    |
+-------------------------+

+------------------------------------------------------------------------------------------------------------------------------------+
| Shared Local Memories                                                                                                              |
+--------------------------+-----------------------------------------------------------+----------+-------------+------------+-------+
| Name                     | Accessing Function(s)                                     | Type     | Size [Bits] | Data Width | Depth |
+--------------------------+-----------------------------------------------------------+----------+-------------+------------+-------+
| target_memory_arr_a0     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a1     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a2     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a3     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a4     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a5     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a6     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_arr_a7     | calc_kernel_orig, target_memory_read, target_memory_write | Register | 8           | 8          | 1     |
| target_memory_a          | calc_kernel_orig, target_memory_read, target_memory_write | Register | 32          | 32         | 1     |
| target_memory_b          | calc_kernel_orig, target_memory_read, target_memory_write | Register | 32          | 32         | 1     |
| target_memory_sum_result | calc_kernel_orig, target_memory_read, target_memory_write | Register | 64          | 64         | 1     |
| target_memory_xor_result | calc_kernel_orig, target_memory_read, target_memory_write | Register | 32          | 32         | 1     |
| target_memory_or_result  | calc_kernel_orig, target_memory_read, target_memory_write | Register | 32          | 32         | 1     |
| target_memory_ctrl       | target_memory_read, target_memory_write                   | Register | 1           | 1          | 1     |
+--------------------------+-----------------------------------------------------------+----------+-------------+------------+-------+

+------------------+
| Aliased Memories |
+------------------+
| None             |
+------------------+

+-------------------------------------------------------------------------------------------+
| I/O Memories                                                                              |
+----------------+-----------------------+---------------+-------------+------------+-------+
| Name           | Accessing Function(s) | Type          | Size [Bits] | Data Width | Depth |
+----------------+-----------------------+---------------+-------------+------------+-------+
| axi_s_ar_addr  | target_memory_read    | FIFO (LUTRAM) | 0           | 32         | 0     |
| axi_s_ar_burst | target_memory_read    | FIFO (LUTRAM) | 0           | 2          | 0     |
| axi_s_ar_size  | target_memory_read    | FIFO (LUTRAM) | 0           | 3          | 0     |
| axi_s_ar_len   | target_memory_read    | FIFO (LUTRAM) | 0           | 8          | 0     |
| axi_s_r_data   | target_memory_read    | FIFO (LUTRAM) | 0           | 64         | 0     |
| axi_s_r_resp   | target_memory_read    | FIFO (LUTRAM) | 0           | 2          | 0     |
| axi_s_r_last   | target_memory_read    | FIFO (LUTRAM) | 0           | 1          | 0     |
| axi_s_aw_addr  | target_memory_write   | FIFO (LUTRAM) | 0           | 32         | 0     |
| axi_s_aw_burst | target_memory_write   | FIFO (LUTRAM) | 0           | 2          | 0     |
| axi_s_aw_size  | target_memory_write   | FIFO (LUTRAM) | 0           | 3          | 0     |
| axi_s_aw_len   | target_memory_write   | FIFO (LUTRAM) | 0           | 8          | 0     |
| axi_s_w_data   | target_memory_write   | FIFO (LUTRAM) | 0           | 64         | 0     |
| axi_s_w_strb   | target_memory_write   | FIFO (LUTRAM) | 0           | 8          | 0     |
| axi_s_w_last   | target_memory_write   | FIFO (LUTRAM) | 0           | 1          | 0     |
| axi_s_b_resp   | target_memory_write   | FIFO (LUTRAM) | 0           | 2          | 0     |
+----------------+-----------------------+---------------+-------------+------------+-------+


====== 5. Accelerator Information ======

No accelerator function is generated.

====== 6. Resource Binding with Adaptive Latency ======

Binding to resource with adaptive latency is disabled.
You can enable this feature by setting config parameter 'ADAPTIVE_LATENCY_BINDING' to 1.


Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の AXI4 Slave Type によると、アドレスマップ・レポートは reports/axi_slave_memory_map.hls.rpt にあるようだ。それを見てみよう。
SmartHLS_102_211222.png

slave_memory_ctrl だが、SmartHLSモジュール用の特別なステータス制御レジスタで、1 を書き込むと SmartHLS で作成されたモジュールが動作する。また、モジュール動作の終了は slave_memory_ctrl を読み込んだ時に 1 が返ってくると動作が終了している。0 が返ってくるとまだ実行中ということだ。

SW/HW Co-Simulation icon をクリックして、SW/HW 協調シミュレーションを行った。
SmartHLS_103_211222.png

Cycle latency は 17 クロックだった。

SmartHLS メニューから SW/HW Co-Simulation with Waveforms を選択した。
全体波形を示す。
SmartHLS_104_211222.png

axi_target はAXI4-Liteインターフェースではなくて、AXI4 インターフェースになっている。そうなんだ。。。
データバス幅は 64 ビット幅になっている。
最初に 4 バースト転送で C コードで設定されたレジスタの設定値を書いている。結果を表示するレジスタは 0 に設定されている。
そして、20 番地(ワード番地で 4)に 1 を書いて axi_target モジュールの実行をスタートさせる。
20 番地を読みだして axi_target モジュールの実行終了を見ている。3 回目に 1 が来て実行終了を知った。
その後 4 バースト転送で、すべてのレジスタを読んでいる。結果のレジスタには正解の値がセットされている。

Synthesize Hardware to FPGA (RTLsynthesis, place and route, for resource timing and results)(Ctrl+shift+V) アイコンをクリックする。
SmartHLS_105_211222.png

ログを示す。

==================================================================
=====  Summary Report for RTL Simulation and FPGA Synthesis  =====
==================================================================

Project name: axi_target
FPGA Vendor: MICROSEMI
Device Family: PolarFire
Device: MPF300TS-1FCG1152I

Table of Contents
  1. Simulation Cycle Latency
  2. Timing Result
  3. Resource Usage


====== 1. Simulation Cycle Latency ======

Number of calls:           1
Cycle latency:          17
SW/HW co-simulation: PASS

====== 2. Timing Result ======

+--------------+---------------+-------------+-------------+----------+-------------+
| Clock Domain | Target Period | Target Fmax | Worst Slack | Period   | Fmax        |
+--------------+---------------+-------------+-------------+----------+-------------+
| clk          | 10.000 ns     | 100.000 MHz | 7.625 ns    | 2.375 ns | 421.053 MHz |
+--------------+---------------+-------------+-------------+----------+-------------+

The reported Fmax is for the HLS core in isolation (from Libero's post-place-and-route timing analysis).
When the HLS core is integrated into a larger system, the system Fmax may be lower depending on the critical path of the system.

====== 3. Resource Usage ======

+--------------------------+-----------------+--------+------------+
| Resource Type            | Used            | Total  | Percentage |
+--------------------------+-----------------+--------+------------+
| Fabric + Interface 4LUT* | 985 + 0 = 985   | 299544 | 0.33       |
| Fabric + Interface DFF*  | 1230 + 0 = 1230 | 299544 | 0.41       |
| I/O Register             | 0               | 1536   | 0.00       |
| User I/O                 | 0               | 512    | 0.00       |
| uSRAM                    | 0               | 2772   | 0.00       |
| LSRAM                    | 0               | 952    | 0.00       |
| Math                     | 0               | 924    | 0.00       |
+--------------------------+-----------------+--------+------------+

* Interface 4LUTs and DFFs are occupied due to the uses of LSRAM, Math, and uSRAM.
  Number of interface 4LUTs/DFFs = (36 * #.LSRAM) + (36 * #.Math) + (12 * #.uSRAM) = (36 * 0) + (36 * 0) + (12 * 0) = 0.


Fmax が 421.053 MHz でとっても速い。

Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の AXI4 Slave Type の翻訳の一部を引用する。

重要:AXI4スレーブにはいくつかの制限があります。

・SmartHLSモジュールは最大で1つのAXI4スレーブインターフェイスを持つことができ、AXI4スレーブインターフェイスタイプは、構造体データタイプのグローバル変数に対してのみ指定できます。

 ・複数のデータをAXI4スレーブインターフェイスの背後に配置する必要がある場合は、すべてのデータを含む新しい構造体タイプを定義してから、構造体タイプでグローバル変数をインスタンス化し、グローバル変数に上記のプラグマを指定できます。

・AXI4スレーブインターフェイスは常に32ビットアドレスと64ビットデータ幅を使用します。

・AXI4スレーブインターフェイスは、インクリメンタルバーストの追加サポートを備えたAXI4-liteプロトコルのみをサポートします。

・AxBURSTおよびAxSIZE入力信号は、スレーブロジックによって無視されます。

 ・AxBURSTおよびAxSIZE信号の実際の入力値に関係なく、AXI4スレーブは常にインクリメンタルバーストタイプ(AxBURST == 1)を使用し、転送あたりのサイズは8バイト(AxSIZE == 3)です。

・バイトイネーブル書き込み(WSTRBポート経由)は、構造体の要素に揃える必要があります。
 ・共通の構造体要素(の異なるバイト)に対応するWSTRBビットの場合、これらのWSTRBビットはすべて1またはすべて0である必要があります。

 ・たとえば、2つの「int」型整数(それぞれ4バイト、1つの64ビットAXIワードとして一緒にパック)にマップするワードアドレスに書き込む場合、WSTRBポートの上位4ビットはすべて1または0である必要があります。 、および同じことがWSTRBポートの下位4ビットにも当てはまります。つまり、どちらの 'int'型整数の部分バイトも更新できませんが、2つの 'int'型整数のいずれかのすべてのバイトを更新することはできます。

・SW / HW協調シミュレーションは、最上位機能がパイプライン化されていない場合にのみサポートされます。

・AXI4スレーブインターフェイスを使用する場合、最上位関数はvoid戻り型を使用する必要があります。

  1. 2021年12月23日 04:17 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

Microchip 社の高位合成ツール SmartHLS の fpga-hls-examples をやってみる1(AXI4 Slave その 1)

今回から、AXI4 Slave や AXI4 Master のサンプルも入っている MicrochipTech/fpga-hls-examples を SmartHLS のワークスペースにインポートしてやってみることにしよう。とりあえずは AX4 Slave をやってみたいと思う。

参考にするのは、Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の AXI4 Slave Type だ。

SmartHLS で新しいワークスペース(hls_examples_ws)を作成した。
SmartHLS_94_211221.png

SmartHLS の File メニューから Import... を選択した。
SmartHLS_96_211221.png

Import ダイアログが表示された。
General を展開して、Existing Projects into Workspace を選択して、Next>ボタンをクリックする。
SmartHLS_96_211221.png

MicrochipTech/fpga-hls-examples をダウンロードしておいた fpga-hls-examples-main フォルダを選択する。
SmartHLS_97_211221.png

Import Project 画面にインポートされるプロジェクトが表示された。
Finish ボタンをクリックする
SmartHLS_98_211221.png

全てのプロジェクトがインポートされた。
SmartHLS_99_211221.png

プロジェクトの内の axi_target プロジェクトをやってみる。これが AXI4 Slave の実装方法になる。

Users Guide SmartHLS 2021.3 Documentation の Top-Level RTL Interface の AXI4 Slave Type によると SmartHLS の AXI4 Slave の実装方法は

#pragma HLS interface variable(target_memory) type(axi_slave) (注: concurrent_access(true|false) というオプションもあるようだ)
struct TargetLayout target_memory;

のプラグマを付けるようだ。
target_memory が AXI4 Slave のレジスタになるようだ。
axi_target.h を引用する。

#ifndef __AXI_TARGET_H__
#define __AXI_TARGET_H__

#include <cstdint>

struct TargetLayout {
    uint8_t  arr[8];
    uint32_t a;
    uint32_t b;
    uint64_t sum_result;
    uint32_t xor_result;
    uint32_t or_result;
};

#endif // __AXI_TARGET_H__


次回から SmartHLS で AXI4 Slave を実装してみよう。
  1. 2021年12月22日 05:27 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(Libero SoC でインポートする)

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)3”の続き。

Microchip 社の Libero SoC の高位合成ツール SmartHLS の sobel_tutorial をやってみようと思うということで、前回は、HLS 制約を追加して、目標とするクロック周期を 10 ns から 7 ns に変更して、ソフトウェアからハードウェアへのコンパイルとハードウェアからFPGAへの合成を行った。今回は、Libero SoC を立ち上げて、SmartHLS で作成した IP をインスタンス化してみよう。

SmartHLS プロジェクトの create_hdl_plus.tcl を使用して、Libero SoC の SmartDesign にインスタンス化する。
SmartHLS_76_211220.png

Libero SoC を起動した。
SmartHLS_77_211220.png

Project メニューから New Project を選択する。
SmartHLS_78_211220.png

New Project ダイアログが表示された。
Project details 画面で Project name に SmartHLS_test と入力した。
Project location を設定した。
Next>ボタンをクリックする。
SmartHLS_79_211220.png

Device selection 画面で、Part に M2S010-VF256 を指定した。
Next>ボタンをクリックする。
SmartHLS_80_211220.png

Design Template 画面はデフォルトのまま Next>ボタンをクリックする。
SmartHLS_81_211220.png

Add HDL source files 画面もデフォルトのまま Next>ボタンをクリックする。
SmartHLS_82_211220.png

Add constraints 画面もデフォルトのまま Finsih ボタンをクリックする。
SmartHLS_83_211220.png

SmartHLS_test プロジェクトが生成された。
SmartHLS_84_211220.png

SmartDesign を作成する。
Create SmartDesign をダブルクリックして作成する。

Create SmartDesign ダイアログが表示された。
Name に SmartHLS_test と入力して、OKボタンをクリックする。
SmartHLS_85_211220.png

SmartHLS_test が生成された。
SmartHLS_86_211220.png

sobel_part3 を SmartDesign にインスタンス化しよう。

Libero SoC の Project メニューから Excute Script... を選択する。
SmartHLS_87_211220.png

Execute Script ダイアログが表示された。
Script fie に sobel_part3 の create_hdl_plus.tcl を指定した。
Run ボタンをクリックする。
SmartHLS_88_211220.png

Script Execution Report ダイアログが表示された。
成功のようだ。
SmartHLS_89_211220.png

Design Hierarchy タブをクリックするとインポートされた sobel_filter_top が見えた。
sobel_filter_top を右クリックし、右クリックメニューから Instantiate in SmartHLS_test を選択した。
SmartHLS_90_211220.png

sobel_filter_top_0 が SmartHLS_test にインスタンス化された。
SmartHLS_91_211220.png

sobel_filter_top_0 の input_fifo_axi4stream ポートを右クリックし、右クリックメニューから Show/Hide BIF Pins を選択した。
Pin to Expose ダイアログが表示された。
全てのチェックボックスにチェックを入れて、OKボタンをクリックする。
SmartHLS_92_211220.png

チェックボックスにチェックを入れたポートが IP のインスタンス・シンボルに表示された。
SmartHLS_93_211220.png
  1. 2021年12月20日 05:17 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)3

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)2”の続き。

Microchip 社の Libero SoC の高位合成ツール SmartHLS の sobel_tutorial をやってみようと思うということで、前回は、sobel_part3 のソフトウェアからハードウェアへのコンパイル、SW/HW 協調シミュレーションと Synthesize Hardware to FPGA を行った。今回は、HLS 制約を追加して、目標とするクロック周期を 10 ns から 7 ns に変更して、ソフトウェアからハードウェアへのコンパイルとハードウェアからFPGAへの合成を行う。

SmartHLS の制約を変更する方法を学習していこう。

HLS 制約はHLS Constraints アイコンをクリックして指定する。
SmartHLS_69_211219.png

Constraint Type の種類を示す。
SmartHLS_70_211219.png

Constraint Type に Set target clock period を指定した。
Constraints Value に 7 を指定した。
Add ボタンをクリックすると、下のウインドウに登録された。
SmartHLS_71_211219.png

再度、Compile Software to Hardware アイコンをクリックして、ソフトウェアからハードウェアへのコンパイルを行った。
Pipeline Length が 12 クロックになっている。
SmartHLS_72_211219.png

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)2”の Pipeline Length は 7 クロックだった。確実にパイプラインが長くなっている。

ログを貼っておく。

// ----------------------------------------------------------------------------
// Smart High-Level Synthesis Tool Version 2021.2
// Copyright (c) 2015-2021 Microchip Technology Inc. All Rights Reserved.
// For support, please contact: smarthls@microchip.com
// Date: Sun Dec 19 04:04:22 2021
// ----------------------------------------------------------------------------

SmartHLS Summary Report for Project: sobel_part3.

Table of Contents
  1. RTL Interface
  2. Scheduling Result
  3. Pipeline Result
  4. Memory Usage
  5. Accelerator Information
  6. Resource Binding with Adaptive Latency


====== 1. RTL Interface ======

+-------------------------------------------------------------------------------------------+
| RTL Interface Generated by SmartHLS                                                       |
+-------------+-------------------+-------------------+------------------+------------------+
| C++ Name    | Interface Type    | Signal Name       | Signal Bit-width | Signal Direction |
+-------------+-------------------+-------------------+------------------+------------------+
|             | Control           | clk               | 1                | input            |
|             |                   | finish            | 1                | output           |
|             |                   | ready             | 1                | output           |
|             |                   | reset             | 1                | input            |
|             |                   | start             | 1                | input            |
+-------------+-------------------+-------------------+------------------+------------------+
| input_fifo  | Input AXI Stream  | input_fifo_ready  | 1                | output           |
|             |                   | input_fifo_valid  | 1                | input            |
|             |                   | input_fifo        | 8                | input            |
+-------------+-------------------+-------------------+------------------+------------------+
| output_fifo | Output AXI Stream | output_fifo_ready | 1                | input            |
|             |                   | output_fifo_valid | 1                | output           |
|             |                   | output_fifo       | 8                | output           |
+-------------+-------------------+-------------------+------------------+------------------+

The Verilog top-level module ports that are not listed in the above table are unused. Please tie the unused input ports to 0.

====== 2. Scheduling Result ======

Please use SmartHLS's schedule viewer to examine the schedule.

Basic Block Latencies:

+---------------------------------------------+
| Function: sobel_filter (pipelined function) |
+---------------------+-----------------------+
| Basic Block         | Cycle Latency         |
+---------------------+-----------------------+
| %init.check         | 12                    |
+---------------------+-----------------------+

====== 3. Pipeline Result ======

+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+
| Label        | Function     | Basic Block | Location in Source Code | Initiation Interval | Pipeline Length | Iteration Count | Latency |
+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+
| sobel_filter | sobel_filter | %init.check | line 12 of sobel.cpp    | 1                   | 12              | n/a             | n/a     |
+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+

====== 4. Memory Usage ======

+---------------------------------------------------------------------------------------------------------------------------------------+
| Local Memories                                                                                                                        |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| Name                                               | Accessing Function(s) | Type                  | Size [Bits] | Data Width | Depth |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| sobel_filter_i                                     | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_j                                     | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_line_buffer_window_a0_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a0_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a1_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a1_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a2_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a2_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_prev_row_index            | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_line_buffer_prev_row_a0_a0            | sobel_filter          | RAM                   | 4096        | 8          | 512   |
| sobel_filter_line_buffer_prev_row_a1_a0            | sobel_filter          | RAM                   | 4096        | 8          | 512   |
| sobel_filter_count                                 | sobel_filter          | Register              | 32          | 32         | 1     |
| init_flag_ZGVZ12sobel_filterRN3hls4FIFOIhLb0EEES2_ | sobel_filter          | Register (Write-Only) | 1           | 1          | 1     |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+

+-------------------------+
| Local Constant Memories |
+-------------------------+
| None                    |
+-------------------------+

+-----------------------+
| Shared Local Memories |
+-----------------------+
| None                  |
+-----------------------+

+------------------+
| Aliased Memories |
+------------------+
| None             |
+------------------+

+-------------------------------------------------------------------------------------+
| I/O Memories                                                                        |
+-------------+-----------------------+------------+-------------+------------+-------+
| Name        | Accessing Function(s) | Type       | Size [Bits] | Data Width | Depth |
+-------------+-----------------------+------------+-------------+------------+-------+
| input_fifo  | sobel_filter          | FIFO (REG) | 0           | 8          | 0     |
| output_fifo | sobel_filter          | FIFO (REG) | 0           | 8          | 0     |
+-------------+-----------------------+------------+-------------+------------+-------+


====== 5. Accelerator Information ======

No accelerator function is generated.

====== 6. Resource Binding with Adaptive Latency ======

Binding to resource with adaptive latency is disabled.
You can enable this feature by setting config parameter 'ADAPTIVE_LATENCY_BINDING' to 1.


Synthesize Hardware to FPGA (RTLsynthesis, place and route, for resource timing and results)(Ctrl+shift+V) アイコンをクリックする。
SmartHLS_73_211219.png

Fmax は 213.995 MHz だった。
Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)2”では、Fmax は 203.087 MHz だった。パイプラインは 7 クロックから 12 クロックになっても、10 MHz 程度しか改善されていないので、限界なのかもしれないのかな?

限界を探ってみるために、クロック周期を 4 ns つまり 250 MHz にしてみた。
Compile Software to Hardware アイコンをクリックして、ソフトウェアからハードウェアへのコンパイルを行った。
SmartHLS_74_211219.png

Pipeline Length は 12 クロックのままだった。

Synthesize Hardware to FPGA (RTLsynthesis, place and route, for resource timing and results)(Ctrl+shift+V) アイコンをクリックする。
SmartHLS_75_211219.png

Fmax は 231.000 MHz に向上していた。パイプライン段数が変化しなくても動作周波数が向上する余地があるんだね。。。
  1. 2021年12月19日 05:12 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)2

Microchip 社の高位合成ツール SmartHLS の sobel_tutorial をやってみよう(part 3)1”の続き。

Microchip 社の Libero SoC の高位合成ツール SmartHLS の sobel_tutorial をやってみようと思うということで、前回は、sobel_part3 をやってみようということでコードの解説と C シミュレーションを行った。今回は、ソフトウェアからハードウェアへのコンパイル、SW/HW 協調シミュレーションと Synthesize Hardware to FPGA を行った。

Compile Software to Hardware アイコンをクリックして、ソフトウェアからハードウェアへのコンパイルを行った。
SmartHLS_65_211218.png

ログを貼っておく。

// ----------------------------------------------------------------------------
// Smart High-Level Synthesis Tool Version 2021.2
// Copyright (c) 2015-2021 Microchip Technology Inc. All Rights Reserved.
// For support, please contact: smarthls@microchip.com
// Date: Sat Dec 18 03:58:32 2021
// ----------------------------------------------------------------------------

SmartHLS Summary Report for Project: sobel_part3.

Table of Contents
  1. RTL Interface
  2. Scheduling Result
  3. Pipeline Result
  4. Memory Usage
  5. Accelerator Information
  6. Resource Binding with Adaptive Latency


====== 1. RTL Interface ======

+-------------------------------------------------------------------------------------------+
| RTL Interface Generated by SmartHLS                                                       |
+-------------+-------------------+-------------------+------------------+------------------+
| C++ Name    | Interface Type    | Signal Name       | Signal Bit-width | Signal Direction |
+-------------+-------------------+-------------------+------------------+------------------+
|             | Control           | clk               | 1                | input            |
|             |                   | finish            | 1                | output           |
|             |                   | ready             | 1                | output           |
|             |                   | reset             | 1                | input            |
|             |                   | start             | 1                | input            |
+-------------+-------------------+-------------------+------------------+------------------+
| input_fifo  | Input AXI Stream  | input_fifo_ready  | 1                | output           |
|             |                   | input_fifo_valid  | 1                | input            |
|             |                   | input_fifo        | 8                | input            |
+-------------+-------------------+-------------------+------------------+------------------+
| output_fifo | Output AXI Stream | output_fifo_ready | 1                | input            |
|             |                   | output_fifo_valid | 1                | output           |
|             |                   | output_fifo       | 8                | output           |
+-------------+-------------------+-------------------+------------------+------------------+

The Verilog top-level module ports that are not listed in the above table are unused. Please tie the unused input ports to 0.

====== 2. Scheduling Result ======

Please use SmartHLS's schedule viewer to examine the schedule.

Basic Block Latencies:

+---------------------------------------------+
| Function: sobel_filter (pipelined function) |
+---------------------+-----------------------+
| Basic Block         | Cycle Latency         |
+---------------------+-----------------------+
| %init.check         | 7                     |
+---------------------+-----------------------+

====== 3. Pipeline Result ======

+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+
| Label        | Function     | Basic Block | Location in Source Code | Initiation Interval | Pipeline Length | Iteration Count | Latency |
+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+
| sobel_filter | sobel_filter | %init.check | line 12 of sobel.cpp    | 1                   | 7               | n/a             | n/a     |
+--------------+--------------+-------------+-------------------------+---------------------+-----------------+-----------------+---------+

====== 4. Memory Usage ======

+---------------------------------------------------------------------------------------------------------------------------------------+
| Local Memories                                                                                                                        |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| Name                                               | Accessing Function(s) | Type                  | Size [Bits] | Data Width | Depth |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+
| sobel_filter_i                                     | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_j                                     | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_line_buffer_window_a0_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a0_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a1_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a1_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a2_a1              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_window_a2_a2              | sobel_filter          | Register              | 8           | 8          | 1     |
| sobel_filter_line_buffer_prev_row_index            | sobel_filter          | Register              | 32          | 32         | 1     |
| sobel_filter_line_buffer_prev_row_a0_a0            | sobel_filter          | RAM                   | 4096        | 8          | 512   |
| sobel_filter_line_buffer_prev_row_a1_a0            | sobel_filter          | RAM                   | 4096        | 8          | 512   |
| sobel_filter_count                                 | sobel_filter          | Register              | 32          | 32         | 1     |
| init_flag_ZGVZ12sobel_filterRN3hls4FIFOIhLb0EEES2_ | sobel_filter          | Register (Write-Only) | 1           | 1          | 1     |
+----------------------------------------------------+-----------------------+-----------------------+-------------+------------+-------+

+-------------------------+
| Local Constant Memories |
+-------------------------+
| None                    |
+-------------------------+

+-----------------------+
| Shared Local Memories |
+-----------------------+
| None                  |
+-----------------------+

+------------------+
| Aliased Memories |
+------------------+
| None             |
+------------------+

+-------------------------------------------------------------------------------------+
| I/O Memories                                                                        |
+-------------+-----------------------+------------+-------------+------------+-------+
| Name        | Accessing Function(s) | Type       | Size [Bits] | Data Width | Depth |
+-------------+-----------------------+------------+-------------+------------+-------+
| input_fifo  | sobel_filter          | FIFO (REG) | 0           | 8          | 0     |
| output_fifo | sobel_filter          | FIFO (REG) | 0           | 8          | 0     |
+-------------+-----------------------+------------+-------------+------------+-------+


====== 5. Accelerator Information ======

No accelerator function is generated.

====== 6. Resource Binding with Adaptive Latency ======

Binding to resource with adaptive latency is disabled.
You can enable this feature by setting config parameter 'ADAPTIVE_LATENCY_BINDING' to 1.


パイプラインの Initiation Interval は 1 クロックになっている。レイテンシは 1 クロックだ。
4. Memory Usage の sobel_filter_line_buffer_prev_row_a0_a0 と sobel_filter_line_buffer_prev_row_a1_a0 はコードの line_buffer でウインドウサイズが 3 なので、自動的に 2 個のラインバッファを生成してくれるようだ。 512 x 8 バイトのラインバッファが 2 個ある。

SW/HW Co-Simulation icon をクリックして、SW/HW 協調シミュレーションを行った。
SmartHLS_66_211218.png

Cycle latency は 262,667 クロックだった。512 x 512 ピクセルの総ピクセル数は 262,144 ピクセルなので、262667 / 262144 ≒ 1.00 クロック / ピクセルとなった。ほぼ 1 クロック / ピクセルとなった。

SmartHLS メニューから SW/HW Co-Simulation with Waveforms を選択した。
拡大した波形を示す。
SmartHLS_67_211218.png

ずーと、1 クロックに 1 ピクセルずつ処理できている。

Synthesize Hardware to FPGA (RTLsynthesis, place and route, for resource timing and results)(Ctrl+shift+V) アイコンをクリックする。
SmartHLS_68_211218.png

ログを貼っておく。

==================================================================
=====  Summary Report for RTL Simulation and FPGA Synthesis  =====
==================================================================

Project name: sobel_part3
FPGA Vendor: MICROSEMI
Device Family: SmartFusion2
Device: M2S010-VF256

Table of Contents
  1. Simulation Cycle Latency
  2. Timing Result
  3. Resource Usage


====== 1. Simulation Cycle Latency ======

Number of calls:      262,658
Cycle latency:      262,667
SW/HW co-simulation: PASS

====== 2. Timing Result ======

+--------------+---------------+-------------+-------------+----------+-------------+
| Clock Domain | Target Period | Target Fmax | Worst Slack | Period   | Fmax        |
+--------------+---------------+-------------+-------------+----------+-------------+
| clk          | 10.000 ns     | 100.000 MHz | 5.076 ns    | 4.924 ns | 203.087 MHz |
+--------------+---------------+-------------+-------------+----------+-------------+

The reported Fmax is for the HLS core in isolation (from Libero's post-place-and-route timing analysis).
When the HLS core is integrated into a larger system, the system Fmax may be lower depending on the critical path of the system.

====== 3. Resource Usage ======

+--------------------------+-----------------+-------+------------+
| Resource Type            | Used            | Total | Percentage |
+--------------------------+-----------------+-------+------------+
| Fabric + Interface 4LUT* | 453 + 288 = 741 | 12084 | 6.13       |
| Fabric + Interface DFF*  | 378 + 288 = 666 | 12084 | 5.51       |
| I/O Register             | 0               | 414   | 0.00       |
| User I/O                 | 0               | 138   | 0.00       |
| RAM64x18                 | 8               | 22    | 36.36      |
| RAM1K18                  | 0               | 21    | 0.00       |
| MACC                     | 0               | 22    | 0.00       |
+--------------------------+-----------------+-------+------------+

* Interface 4LUTs and DFFs are occupied due to the uses of MACC, RAM1K18, and RAM64x18.
  Number of interface 4LUTs/DFFs = (36 * #.MACC) + (36 * #.RAM1K18) + (36 * #.RAM64x18) = (36 * 0) + (36 * 0) + (36 * 8) = 288.



Fmax は 203.087 MHz となった。今まで一番、動作周波数が低いが 1 クロックで 1 ピクセル、ソーベル・フィルタ処理することができる。
  1. 2021年12月18日 04:43 |
  2. SmartHLS
  3. | トラックバック:0
  4. | コメント:0
»