FC2カウンター FPGAの部屋 2021年03月
fc2ブログ

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

FPGAの部屋

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

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する4

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する3”の続き。

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/ の畳み込みニューラルネットワーク(CNN)を NNgen でハードウェア化してみることにしたということで、前回は、「ゼロから作るDeep Learning」のCNN の重みとバイアスを与えて、 NNgenデータフローをソフトウェアとして実行して、DNNモデルの動作を確認したが、データがおかしいということになった。今回は、オライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/ の畳み込みニューラルネットワーク(CNN)に NNgen での整数(と同等)の重みとバイアスにして推論してみよう。

まずは、現状の重みとバイアスのビット長と演算長を規制した状態で推論してみよう。
x_test の最初から 5 個を推論した。
t_test が正解の数字だ。推論の値の最大値を見ていくと正解の数字+1 番目となっているのが分かる。これは 0 からカウントしているからだ。
NNgen2_51_210331.png

print(t_test[0:5])
print(network.predict_int(x_test[0:5]))


次に、NNgen の時と同様に重みは 127.9 倍、バイアスは 16383.9 倍した。
NNgen2_52_210331.png

network.params['W1'] = network.params['W1'] * 127.9
network.params['b1'] = network.params['b1'] * 16383.9
network.params['W2'] = network.params['W2'] * 127.9
network.params['b2'] = network.params['b2'] * 16383.9
network.params['W3'] = network.params['W3'] * 127.9
network.params['b3'] = network.params['b3'] * 16383.9


新しい値の重みとバイアスの最大値、最小値を見ると、それらしき値になっている。
NNgen2_53_210331.png

print(np.max(network.params['W1']))
print(np.min(network.params['W1']))
print(np.max(network.params['b1']))
print(np.min(network.params['b1']))
print(np.max(network.params['W2']))
print(np.min(network.params['W2']))
print(np.max(network.params['b2']))
print(np.min(network.params['b2']))
print(np.max(network.params['W3']))
print(np.min(network.params['W3']))
print(np.max(network.params['b3']))
print(np.min(network.params['b3']))


入力値を 127.9 倍して推論を行って、結果を 1/512 倍して表示したところ、以前の重みとバイアスのビット長と演算長を規制した状態で推論した結果と一致した。
NNgen2_54_210331.png

print(t_test[0:5])
x_test_rshft7 = x_test * 127.9
predict_result = network.predict(x_test_rshft7[0:5])/512
predict_result = np.int32(predict_result)
print(predict_result)


やり方としては問題ないようなのだが。。。
  1. 2021年03月31日 05:17 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する3

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する2”の続き。

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/ の畳み込みニューラルネットワーク(CNN)を NNgen でハードウェア化してみることにしたということで、前回は、NNgen のデータフローを使用した CNN として書き直した MNIST CNN を示した。しかし、これを NNgenデータフローをソフトウェアとして実行して、DNNモデルの動作を確認すると出力データが同じになってしまった。よって今回はそれを書き換えた。そして、「ゼロから作るDeep Learning」のCNN の重みとバイアスを与えて、 NNgenデータフローをソフトウェアとして実行して、DNNモデルの動作を確認したが、データがおかしい。

まずは、NNgenのオペレータを使用したMNIST CNNの実装を示す。

from __future__ import absolute_import
from __future__ import print_function

import sys
import os

import nngen as ng


# data types
act_dtype = ng.int32
weight_dtype = ng.int8
bias_dtype = ng.int8
scale_dtype = ng.int8
batchsize = 1

# input
input_layer = ng.placeholder(dtype=ng.int8,
                             shape=(batchsize, 28, 28, 1),  # N, H, W, C
                             name='input_layer')

# layer 0: conv2d (with bias and scale (= batchnorm)), relu, max_pool
wn0 = ng.variable(dtype=weight_dtype,
                 shape=(10, 5, 5, 1),  # Och, Ky, Kx, Ich
                 name='wn0')
bn0 = ng.variable(dtype=bias_dtype,
                 shape=(wn0.shape[0],), name='bn0')
sn0 = ng.variable(dtype=scale_dtype,
                 shape=(wn0.shape[0],), name='sn0')

a0 = ng.conv2d(input_layer, wn0,
               strides=(1, 1, 1, 1),
               bias=bn0,
               scale=sn0,
               padding='VALID',
               act_func=ng.relu,
               dtype=act_dtype,
               sum_dtype=ng.int32)

a0p = ng.max_pool_serial(a0,
                         ksize=(1, 2, 2, 1),
                         strides=(1, 2, 2, 1))

a0r = ng.reshape(a0p, [batchsize, -1])

# layer 1: full-connection, relu
wn1 = ng.variable(weight_dtype,
                 shape=(100, a0r.shape[-1]),
                 name='wn1')
bn1 = ng.variable(bias_dtype,
                 shape=(wn1.shape[0],),
                 name='bn1')
sn1 = ng.variable(scale_dtype,
                 shape=(wn1.shape[0],),
                 name='sn1')

a1 = ng.matmul(a0r, wn1,
               bias=bn1,
               scale=sn1,
               transposed_b=True,
               act_func=ng.relu,
               dtype=act_dtype,
               sum_dtype=ng.int32)

# layer 2: full-connection, relu
wn2 = ng.variable(weight_dtype,
                 shape=(10, a1.shape[-1]),
                 name='wn2')
bn2 = ng.variable(bias_dtype,
                 shape=(wn2.shape[0],),
                 name='bn2')
sn2 = ng.variable(scale_dtype,
                 shape=(wn2.shape[0],),
                 name='sn2')

# output
output_layer = ng.matmul(a1, wn2,
                         bias=bn2,
                         scale=sn2,
                         transposed_b=True,
                         name='output_layer',
                         dtype=act_dtype,
                         sum_dtype=ng.int32)


NNgenのMIST CNNの重みやバイアスに「ゼロから作るDeep Learning」のMNIST CNNの重みやバイアスの値を代入する
Aout = ((Ain * W + bias) * scale) >> rshift_out だそうなので、scaleは要素がすべて1の配列とする

wn0_value = W1n2.astype(np.int8)
wn0.set_value(wn0_value)
bn0_value = B1n2.astype(np.int8)
bn0.set_value(bn0_value)
sn0_value = np.ones(sn0.shape, dtype=np.int8)
sn0.set_value(sn0_value)
print(sn0_value[0])

wn1_value = W2n2.astype(np.int8)
wn1.set_value(wn1_value)
bn1_value = B2n2.astype(np.int8)
bn1.set_value(bn1_value)
sn1_value = np.ones(sn1.shape, dtype=np.int8)
sn1.set_value(sn1_value)

wn2_value = W3n2.astype(np.int8)
wn2.set_value(wn2_value)
bn2_value = B3n2.astype(np.int8)
bn2.set_value(bn2_value)
sn2_value = np.ones(sn2.shape, dtype=np.int8)
sn2.set_value(sn2_value)


ハードウェア属性の割当

# conv2d, matmul
# par_ich: parallelism in input-channel
# par_och: parallelism in output-channel
# par_col: parallelism in pixel column
# par_row: parallelism in pixel row
# cshamt_out: right shift amount after applying bias/scale

par_ich = 2
par_och = 2
cshamt_out = weight_dtype.width - 1

a0.attribute(par_ich=par_ich, par_och=par_och,
             cshamt_out=0)
a1.attribute(par_ich=par_ich, par_och=par_och,
             cshamt_out=0)
output_layer.attribute(par_ich=par_ich, par_och=par_och,
                       cshamt_out=weight_dtype.width +7)

# max_pool
# par: parallelism in in/out channel

par = par_och

a0p.attribute(par=par)


NNgenデータフローをソフトウェアとして実行して、DNNモデルの動作を確認

input_layer_value = x_test[0].reshape(input_layer.shape)
input_layer_value = input_layer_value * 127.9
input_layer_value = input_layer_value.astype(np.int8)
eval_outs = ng.eval([output_layer], input_layer=input_layer_value)
output_layer_value = eval_outs[0]

print(output_layer_value)


NNgen2_50_210330.png

7 の出力が最大にならない。
  1. 2021年03月30日 04:36 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する2

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する1”の続き。

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/ の畳み込みニューラルネットワーク(CNN)を NNgen でハードウェア化してみることにしたということで、前回は、”「ゼロから作るDeep Learning」の畳み込みニューラルネットワークのハードウェア化1”の量子化ビット数を変更して MNIST CNN を学習した。今回は、NNgen の hello_nngen.py の CNN を参考に、前回学習した MNIST CNN を NNgen のデータフローを使用した CNN として書き直した。そして、「ゼロから作るDeep Learning」のMNIST CNNの重みやバイアスの配列の形状を見て、reshapeでNNgenに合わせた。

前回学習した MNIST CNN を NNgen のデータフローを使用した CNN として書き直すにあって問題となるのは、hello_nngen.py の CNN の conv2d はパッディングがされているのだが、MNIST CNN はパッディングなしということだった。
そこで、ツィッターで NNgen の作者にお聞きしたところ、

padding='VALID'を指定するか、padding=0とすれば良いはずです

ということだったので、conv2d に”padding='VALID'”を追加した。
NNgen のデータフローを使用した CNN として書き直した MNIST CNN を示す。
NNgen2_46_210329.png
NNgen2_47_210329.png

from __future__ import absolute_import
from __future__ import print_function

import sys
import os

import nngen as ng


# data types
act_dtype = ng.int8
weight_dtype = ng.int8
bias_dtype = ng.int8
scale_dtype = ng.int8
batchsize = 1

# input
input_layer = ng.placeholder(dtype=act_dtype,
                             shape=(batchsize, 28, 28, 1),  # N, H, W, C
                             name='input_layer')

# layer 0: conv2d (with bias and scale (= batchnorm)), relu, max_pool
wn0 = ng.variable(dtype=weight_dtype,
                 shape=(10, 5, 5, 1),  # Och, Ky, Kx, Ich
                 name='wn0')
bn0 = ng.variable(dtype=bias_dtype,
                 shape=(wn0.shape[0],), name='bn0')
sn0 = ng.variable(dtype=scale_dtype,
                 shape=(wn0.shape[0],), name='sn0')

a0 = ng.conv2d(input_layer, wn0,
               strides=(1, 1, 1, 1),
               bias=bn0,
               scale=sn0,
               padding='VALID',
               act_func=ng.relu,
               dtype=act_dtype,
               sum_dtype=ng.int16)

a0p = ng.max_pool_serial(a0,
                         ksize=(1, 2, 2, 1),
                         strides=(1, 2, 2, 1))

a0r = ng.reshape(a0p, [batchsize, -1])

# layer 1: full-connection, relu
wn1 = ng.variable(weight_dtype,
                 shape=(100, a0r.shape[-1]),
                 name='wn1')
bn1 = ng.variable(bias_dtype,
                 shape=(wn1.shape[0],),
                 name='bn1')
sn1 = ng.variable(scale_dtype,
                 shape=(wn1.shape[0],),
                 name='sn1')

a1 = ng.matmul(a0r, wn1,
               bias=bn1,
               scale=sn1,
               transposed_b=True,
               act_func=ng.relu,
               dtype=act_dtype,
               sum_dtype=ng.int16)

# layer 2: full-connection, relu
wn2 = ng.variable(weight_dtype,
                 shape=(10, a1.shape[-1]),
                 name='wn2')
bn2 = ng.variable(bias_dtype,
                 shape=(wn2.shape[0],),
                 name='bn2')
sn2 = ng.variable(scale_dtype,
                 shape=(wn2.shape[0],),
                 name='sn2')

# output
output_layer = ng.matmul(a1, wn2,
                         bias=bn2,
                         scale=sn2,
                         transposed_b=True,
                         name='output_layer',
                         dtype=act_dtype,
                         sum_dtype=ng.int16)


NNgenのMIST CNNの重みやバイアスの配列の形状を確認する
NNgen2_48_210329.png

print(wn0.shape)
print(bn0.shape)
print(wn1.shape)
print(bn1.shape)
print(wn2.shape)
print(bn2.shape)
print(a0.shape)
print(a0p.shape)
print(a0r.shape)


「ゼロから作るDeep Learning」のMNIST CNNの重みやバイアスの配列の形状を見て、reshape transpose でNNgenに合わせる (2021/04/01 :修正)
NNgen2_49_210329.png

print(network.params['W1'].shape)
print(network.params['b1'].shape)
print(network.params['W2'].shape)
print(network.params['b2'].shape)
print(network.params['W3'].shape)
print(network.params['b3'].shape)

W1n = network.params['W1'].transpose(0,2,3,1)
print(W1n.shape)
print(np.max(W1n))
print(np.min(W1n))
B1n = network.params['b1']
print(np.max(B1n))
print(np.min(B1n))
W2n=network.params['W2'].transpose(1,0)
print(W2n.shape)
print(np.max(W2n))
print(np.min(W2n))
B2n = network.params['b2']
print(np.max(B2n))
print(np.min(B2n))
W3n=network.params['W3'].transpose(1,0)
print(W3n.shape)
print(np.max(W3n))
print(np.min(W3n))
B3n = network.params['b3']
print(np.max(B3n))
print(np.min(B3n))

  1. 2021年03月29日 04:43 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

「ゼロから作るDeep Learning」のCNNをNNgenでハードウェア化する1

前回の”「ゼロから作るDeep Learning」の2層ニューラルネットワークをNNgenでハードウェア化する2”の全結合層 2 層のニューラルネットワークの NNgen での書き方がよく分からないので、今回は CNN でやってみることにした。

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/ の畳み込みニューラルネットワーク(CNN)を NNgen でハードウェア化してみることにした。
その CNN を FPGAの部屋に書いた時の記事は”「ゼロから作るDeep Learning」の畳み込みニューラルネットワークのハードウェア化1”だった。今回は、int8, int16 に寄せるということで、量子化ビット数を変更した。

AF_OUT_MAG = 2 ** 5 # 出力の小数部
AF_OUT_INT = 2 ** 11 # 出力の整数部(+符号1ビットされている)
AF_WB_MAG = 2 ** 7 # 重みとバイアスの小数部
AF_WB_INT = 2 ** 1 # 重みとバイアスの整数部(+符号1ビットされている)

COV_OUT_MAG = 2 ** 7 # 出力の小数部
COV_OUT_INT = 2 ** 9 # 出力の整数部(+符号1ビットされている)
COV_WB_MAG = 2 ** 7 # 重みとバイアスの小数部
COV_WB_INT = 2 ** 1 # 重みとバイアスの整数部(+符号1ビットされている)


オライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/から一部変更した layers_int.py を引用する。
NNgen2_42_210327.png

ネットワークの構成を示す。
畳み込みーReluーマックス・プーリングー全結合層ーReluー全結合層だ。
オライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/から一部変更した simple_convnet_int.py を引用する。
NNgen2_43_210327.png

Jupyter Notebook で学習を行った。
このコードもオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch07/から一部変更した。
NNgen2_44_210328.png
NNgen2_45_210328.png

精度は 0.9877 だった。
  1. 2021年03月28日 06:56 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

「ゼロから作るDeep Learning」の2層ニューラルネットワークをNNgenでハードウェア化する2

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch05/ を使用した MNIST の 全結合層2層のニューラルネットワークをやってみたことがある。(”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”参照) 今回、それを NNgen でハードウェア化してみたいということで、前回は、以前の”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”の 2 層全結合ニューラルネットワークを再びやってみた。今回は、”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”の 2 層全結合ニューラルネットワークをNNgenのオペレータを使ってMNISTの2層全結合ニューラルネットワークの実装を行った。まだ進捗が少ないが書いておく。

前回の”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”の 2 層全結合ニューラルネットワークは Ubuntu 18.04 を再起動してしまったので再学習した。結果を示す。

0.16073333333333334 0.1679
0.90385 0.908
0.9256 0.9275
0.9395666666666667 0.9399
0.9454666666666667 0.9456
0.9488333333333333 0.9487
0.9575166666666667 0.955
0.9614833333333334 0.9589
0.9640333333333333 0.9614
0.9659833333333333 0.9606
0.9692 0.9624
0.9713333333333334 0.965
0.97315 0.9664
0.9748 0.9688
0.9768333333333333 0.9693
0.9778833333333333 0.969
0.9779666666666667 0.9704

(60000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.3671875
np.min(self.W) = -0.5625
(50,)
np.max(self.b) = 0.296875
np.min(self.b) = -0.171875
(60000, 50)
np.max(out) = 12.23468143302307
np.min(out) = -13.189215710841381
np.max(out2) = 12.234375
np.min(out2) = -13.1796875
(60000, 50)
np.max(x) = 12.234375
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.9921875
np.min(self.W) = -1.0
(10,)
np.max(self.b) = 0.453125
np.min(self.b) = -0.3203125
(60000, 10)
np.max(out) = 29.58172607421875
np.min(out) = -25.99884033203125
np.max(out2) = 29.578125
np.min(out2) = -25.9921875
(10000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.3671875
np.min(self.W) = -0.5546875
(50,)
np.max(self.b) = 0.296875
np.min(self.b) = -0.1640625
(10000, 50)
np.max(out) = 12.447242664638907
np.min(out) = -10.870925284420082
np.max(out2) = 12.4453125
np.min(out2) = -10.859375
(10000, 50)
np.max(x) = 12.4453125
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.9921875
np.min(self.W) = -0.9921875
(10,)
np.max(self.b) = 0.453125
np.min(self.b) = -0.3125
(10000, 10)
np.max(out) = 30.97119140625
np.min(out) = -24.920166015625
np.max(out2) = 30.96875
np.min(out2) = -24.9140625
0.9736166666666667 0.9559


今回の精度は 0.9559 で少し精度が上がった。

2 層全結合ニューラルネットワークをNNgenのオペレータを使ってMNISTの2層全結合ニューラルネットワークの実装を行った。そのソースコードを示す。
なお、このコードは、hello_nngen.py のコードを変更して作成した。

from __future__ import absolute_import
from __future__ import print_function

import sys
import os

import nngen as ng


# data types
act_dtype = ng.int8
weight_dtype = ng.int8
bias_dtype = ng.int8
scale_dtype = ng.int16

# input
input_layer = ng.placeholder(dtype=act_dtype,
                             shape=(1, 28, 28, 1),  # N, H, W, C
                             name='input_layer')

# layer 1: full-connection, relu
w_ng1 = ng.variable(weight_dtype,
                 shape=(784, input_layer.shape[-1]),
                 name='w_ng1')
b_ng1 = ng.variable(bias_dtype,
                 shape=(w_ng1.shape[0],),
                 name='b_ng1')
s_ng1 = ng.variable(scale_dtype,
                 shape=(w_ng1.shape[0],),
                 name='s_ng1')

a1 = ng.matmul(input_layer, w_ng1,
               bias=b_ng1,
               scale=s_ng1,
               transposed_b=True,
               act_func=ng.relu,
               sum_dtype=ng.int16)

# layer 2: full-connection, relu
w_ng2 = ng.variable(weight_dtype,
                 shape=(10, a1.shape[-1]),
                 name='w_ng2')
b_ng2 = ng.variable(bias_dtype,
                 shape=(w_ng2.shape[0],),
                 name='b_ng2')
s_ng2 = ng.variable(scale_dtype,
                 shape=(w_ng2.shape[0],),
                 name='s_ng2')

# output
output_layer = ng.matmul(a1, w_ng2,
                         bias=b_ng2,
                         scale=s_ng2,
                         transposed_b=True,
                         name='output_layer',
                         sum_dtype=ng.int16)


(2021/03/28:追記)
上の NNgen の書き方は間違っているようです。
全結合層スタートのニューラルネットワークの NNgen での書き方がよく分からないので、CNN でやってみることにしました。
  1. 2021年03月26日 05:12 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

「ゼロから作るDeep Learning」の2層ニューラルネットワークをNNgenでハードウェア化する1

2017年の 6 月にやってみたオライリー出版社の”「ゼロから作るDeep Learning」”の deep-learning-from-scratch/ch05/ を使用した MNIST の 全結合層2層のニューラルネットワークをやってみたことがある。(”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”参照) 今回、それを NNgen でハードウェア化してみたい。

まずは以前の”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”を再現するために ch05, common, dataset ディレクトリを自分のアーカイブからコピーした。
NNgen2_36_210322.png

ch05の内容を示す。
NNgen2_37_210322.png

もうすでに作ってあるが、 Jupyter Notebook ファイルの nngen_example_2layers_nn.ipynb を新規作成した。

layers_int.py の固定小数点の桁数は既存の重み、バイアス 9 ビット(-1 〜 +1より最小ビット分少ないまで)、計算結果は 4 ビット分整数部を延長している(-32 〜 +32より最小ビット分少ないまで)。

MAGNIFICATION = 2 ** (9-1)
RANGE = 2 ** 4


これで”「ゼロから作るDeep Learning」の2層ニューラルネットワークのハードウェア化1”と同様に学習した。
なお、このコードは deep-learning-from-scratch/ch05/ から引用した。
NNgen2_38_210322.png
NNgen2_39_210322.png
出力結果を示す。

0.08331666666666666 0.0837
0.9026166666666666 0.9077
0.9236 0.9253
0.9373833333333333 0.9383
0.9439666666666666 0.9411
0.9521 0.9493
0.9556 0.9509
0.9596666666666667 0.9539
0.96315 0.9583
0.9671666666666666 0.9605
0.9697833333333333 0.964
0.9716 0.9654
0.9730166666666666 0.9664
0.9749666666666666 0.9681
0.9768666666666667 0.9695
0.97805 0.9701
0.9791166666666666 0.9703

(60000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.421875
np.min(self.W) = -0.48046875
(50,)
np.max(self.b) = 0.296875
np.min(self.b) = -0.27734375
(60000, 50)
np.max(out) = 12.756525762986712
np.min(out) = -13.300428943461156
np.max(out2) = 12.7578125
np.min(out2) = -13.296875
(60000, 50)
np.max(x) = 12.7578125
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.99609375
np.min(self.W) = -1.0
(10,)
np.max(self.b) = 0.34765625
np.min(self.b) = -0.375
(60000, 10)
np.max(out) = 27.193145751953125
np.min(out) = -24.312454223632812
np.max(out2) = 15.99609375
np.min(out2) = -16.0
(10000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.421875
np.min(self.W) = -0.4765625
(50,)
np.max(self.b) = 0.296875
np.min(self.b) = -0.2734375
(10000, 50)
np.max(out) = 14.379289269181754
np.min(out) = -11.566590114794963
np.max(out2) = 14.37890625
np.min(out2) = -11.5625
(10000, 50)
np.max(x) = 14.37890625
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.99609375
np.min(self.W) = -0.99609375
(10,)
np.max(self.b) = 0.34765625
np.min(self.b) = -0.37109375
(10000, 10)
np.max(out) = 28.027145385742188
np.min(out) = -23.091751098632812
np.max(out2) = 15.99609375
np.min(out2) = -16.0
0.9781333333333333 0.9668


テスト画像での精度は 0.9668 だった。

NNgen では、重みとバイアスを int8 に、計算結果を int16 にしてみたいので、layers_int.py の固定小数点の桁数を変更する。

MAGNIFICATION = 2 ** (8-1)
RANGE = 2 ** 8


に変更した。
これで学習した結果を示す。

0.11151666666666667 0.1128
0.90435 0.9083
0.9233 0.925
0.9368333333333333 0.9332
0.9448333333333333 0.9407
0.9510666666666666 0.9485
0.9551833333333334 0.9515
0.9595166666666667 0.9569
0.9619333333333333 0.9578
0.96545 0.9604
0.9688833333333333 0.9634
0.9701333333333333 0.9635
0.97145 0.9639
0.9729166666666667 0.9662
0.97475 0.9672
0.9755 0.9668
0.9781333333333333 0.9687

(60000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.5
np.min(self.W) = -0.671875
(50,)
np.max(self.b) = 0.2890625
np.min(self.b) = -0.3046875
(60000, 50)
np.max(out) = 11.473192459365237
np.min(out) = -13.295526984147727
np.max(out2) = 11.4765625
np.min(out2) = -13.2890625
(60000, 50)
np.max(x) = 11.4765625
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.9921875
np.min(self.W) = -1.0
(10,)
np.max(self.b) = 0.3828125
np.min(self.b) = -0.4296875
(60000, 10)
np.max(out) = 28.8548583984375
np.min(out) = -25.4957275390625
np.max(out2) = 28.8515625
np.min(out2) = -25.484375
(10000, 784)
np.max(x) = 1.0
np.min(x) = 0.0
(784, 50)
np.max(self.W) = 0.5
np.min(self.W) = -0.6640625
(50,)
np.max(self.b) = 0.2890625
np.min(self.b) = -0.296875
(10000, 50)
np.max(out) = 11.773253701612703
np.min(out) = -12.327052724038367
np.max(out2) = 11.7734375
np.min(out2) = -12.3203125
(10000, 50)
np.max(x) = 11.7734375
np.min(x) = 0.0
(50, 10)
np.max(self.W) = 0.9921875
np.min(self.W) = -0.9921875
(10,)
np.max(self.b) = 0.3828125
np.min(self.b) = -0.421875
(10000, 10)
np.max(out) = 30.44940185546875
np.min(out) = -26.7615966796875
np.max(out2) = 30.453125
np.min(out2) = -26.75
0.96955 0.947


テスト画像での精度は 0.947 だった。
少し、精度が落ちてしまったが、重みとバイアスのビット数が減ってしまったので仕方ないか。。。
  1. 2021年03月25日 04:46 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

PIC16F1825 の使い方4(SPI 機能)

PIC16F1825 の使い方3(I2C 機能、ポーリング編)”の続き。

PIC マイコンの PIC16F1825 を使うことになったので、使い方の覚書を書いておく。
前回は、I2C をポーリングで書き直したが、やはり数分程度で I2C Read が止まってしまった。I2C はあまり良くないかも知れないので、SPI 機能を使うことにした。
3軸加速度センサーの ADXL355 も SPI モードがあるので、 ADXL355 も SPI モードにして使用する。
ADXL355モジュール説明書 によると、 MISO、 ~CS、 SCK、 MOSI の各端子を PIC16F1825 と接続する。
PIC の SPI 接続を示す。

SPI Master : SCLK - RC0(10 pin), SDI - RC1(9 pin), SDO - RC2(8 pin), /CS(GPIO) - RA2(11 pin)

PIC の SDI は ADXL355 の MISO に接続し、 SDO は ADXL355 の MOSI に接続している。後は同じ名前のピンを接続した。なお、PIC の SPI のピン配置はデフォルトの SPI ピンを使用している。

SPI インターフェースについては、”SPIの基本を学ぶ”を参照。
ADXL355日本語説明書の図64 から図67 を引用する。
PIC_15_210324.png

そうそう、PIC の SPI 設定で勘違いしていることがあった。
SPI Read のときに SCK が出ていなかった。てっきり図64 と図66 で R/W を 1 にすれば Read データが出てくるものと思っていたのだが、出てこなかった。なぜ〜? と思ってオシロスコープ画面をよく見たのだが、出ていなかった。もしかして?と思って SSP1BUF にダミーデータとして 0 を書いた(つまり、SDO から 0 を Write した)ところ、SCK が出て SDI に ADXL355 からの Read データが出てきた。つまり、SPI Read する時は、何かダミーデータを SPI Write する必要があるようだ。そうすると SCK が出力されて、SDI に Read データが出てくる。

それを踏まえて、作ったソースコードを貼っておく。

/*
 * File:   acc3_uart.c
 * Author: ono
 *
 * Created on 2021/02/03, 11:09
 */
// USART :  RX - RC5(5 pin), TX - RC4(6 pin)(default)
// SPI Master : SCLK - RC0(10 pin), SDI - RC1(9 pin), SDO - RC2(8 pin), /CS(GPIO) - RA2(11 pin)
// acc_sensor : ADXL355

#include <xc.h>
#include <stdint.h>

#pragma config FOSC = INTOSC
//#pragma config WDTEN = OFF
#pragma config LVP = OFF
#pragma config PWRTE = ON

unsigned char chr;
unsigned int n = 0;

void Delay(unsigned int m)
{
    for(n=0;n<m;n++);       //Delay
}

void acc_sensor_write(uint8_t reg_addr, uint8_t write_data);
void acc_sensor_grecv(uint8_t dataX[3], uint8_t dataY[3], uint8_t dataZ[3]);
uint8_t acc_sensor_data_ready();
uint8_t acc_sensor_read_byte(uint8_t reg_addr);
void acc_sensor_read_3bytes(uint8_t reg_addr, uint8_t *data);

void main( void )
{
    OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
    //OSCCON = 0b01111000; // 4x PLL disable, 16MHz, FOSC
    OSCTUNE = 0x00;
    
    TRISA = 0;
    TRISC = 0x22; // SDI, UART RX is input setting.
    ANSELA = 0;
    ANSELC = 0;

    // SPI
    SSP1STAT = 0b11000000; // SMP=1, CKE=1
    SSP1CON1 = 0b00100010;  //SSP1EN=1, CKP=0, SPI Master, Clock=Fosc/64(500kHz)
    SSP1CON3 = 0b00000000;
    //SSP1IE = 1;
    //SSP1IF = 0;
    RA2 = 1; // SPI /CS = 1
    
    // UART
    BAUDCON = 0; // BRG16=0: 8bit counter mode
    SPBRGL = 3; // SYNC=0, BRGH=1, BRG16=0, 500000bps
    TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
    RCSTA = 0b10010000; // SPEN=1, CREN=1
    //INTCON = 0b11000000; // GIE=1, PEIE=1
    RCIE = 1;
    RCIF = 0;
    PEIE = 1;
    GIE = 1;

     /*while(1){
        while(TRMT == 0);
        TXREG = 0x55;
              
        Delay(50);
    } */
    
    uint8_t dataX[3], dataY[3], dataZ[3];
    uint8_t count=0, count_b;
    
    /*while(1){
        acc_sensor_write(0x2c, 0x83); // I2C speed is Hi speed, +-8g
        Delay(500);
    }*/
    
    acc_sensor_write(0x2c, 0x83); // I2C speed is Hi speed, +-8g
    
    acc_sensor_write(0x1e, 0x00); // OFFSET_X_H
    acc_sensor_write(0x1f, 0x00); // OFFSET_X_L
    acc_sensor_write(0x20, 0x00); // OFFSET_Y_H
    acc_sensor_write(0x21, 0x00); // OFFSET_Y_L
    acc_sensor_write(0x22, 0x00); // OFFSET_Z_H
    acc_sensor_write(0x23, 0x00); // OFFSET_Z_L
    
    acc_sensor_write(0x2d, 0x00); // stanby clear
    
    while(1){
        while((acc_sensor_data_ready() & 0x01) == 0);
        acc_sensor_read_3bytes(0x08, dataX);
        //acc_sensor_grecv(dataX, dataY, dataZ);
        Delay(500);
    }
    
}

void interrupt RX_int(void){
    if(RCIF == 1){
        RCIF = 0;
        chr = RCREG;
        if(RCREG != 0x55)
            return;
              
        while(TRMT == 0);
        TXREG = chr + 1;
    }
}

void acc_sensor_write(uint8_t reg_addr, uint8_t write_data){
    RA2 = 0; // SPI /CS = 0
    SSP1IF = 0;
    SSP1BUF = (reg_addr<<1);
    while(SSP1IF == 0);
    SSP1IF = 0;
    SSP1BUF = write_data;
    while(SSP1IF == 0);
    RA2 = 1; // SPI /CS = 1
}

void acc_sensor_grecv(uint8_t *dataX, uint8_t *dataY, uint8_t *dataZ){
    while((acc_sensor_data_ready() & 0x01) == 0);
    
    acc_sensor_read_3bytes(0x08, dataX);
    acc_sensor_read_3bytes(0x0b, dataY);
    acc_sensor_read_3bytes(0x0e, dataZ);
}

uint8_t acc_sensor_data_ready(){
    return(acc_sensor_read_byte(0x04));
}

uint8_t acc_sensor_read_byte(uint8_t reg_addr){
    uint8_t data;
    
    RA2 = 0; // SPI /CS = 0
    SSP1IF = 0;
    SSP1BUF = (reg_addr<<1) | 1;
    while(SSP1IF == 0);
    
    SSP1IF = 0;
    SSP1BUF = 0;
    while(SSP1IF == 0);
    data = SSP1BUF;
    RA2 = 1; // SPI /CS = 1
    return(data);
}
void acc_sensor_read_3bytes(uint8_t reg_addr, uint8_t *data){
    RA2 = 0; // SPI /CS = 0
    SSP1IF = 0;
    SSP1BUF = (reg_addr<<1) | 1;
    while(SSP1IF == 0);
    
    SSP1IF = 0;
    SSP1BUF = 0;
    while(SSP1IF == 0);
    data[0] = SSP1BUF;
    
    SSP1IF = 0;
    SSP1BUF = 0;
    while(SSP1IF == 0);
    data[1] = SSP1BUF;
    
    SSP1IF = 0;
    SSP1BUF = 0;
    while(SSP1IF == 0);
    data[2] = SSP1BUF;
    RA2 = 1; // SPI /CS = 1
}


SPI クロックは 32 MHz クロックの 1/64 倍の 500 kHz に設定してある。

これで data_ready の値を取得するために、1バイト Read してから、3 バイト Read している波形を示す。
最初に SCK と SDO の波形を示す。
PIC_9_210323.jpg
PIC_10_210323.jpg
PIC_11_210323.jpg
7 ビットの 0x04アドレスと R/W ビットを連結して ADXL355 に Write して、次に Read データを受け取っている。次に 0x08 アドレスの Read を行って、3 バイト X 軸加速度値を Read している。

次に同じアクセスの SCK と SDI の波形を示す。こちらが ADXL355 からの X 軸加速度値だ。
PIC_12_210323.jpg
PIC_13_210323.jpg
PIC_14_210323.jpg

0x04アドレスの値は 0x07 で data ready ビットは立っていたので、3 バイト X 軸加速度値を Read して、その値は、0xFF、 0xF6、 0xA0 だった。つまり、0xFFF6A が X 軸加速度値となる。
  1. 2021年03月24日 04:31 |
  2. PIC
  3. | トラックバック:0
  4. | コメント:0

NNgen を再度やってみる3(hello_nngen.pyその2)

NNgen を再度やってみる2(hello_nngen.py)”の続き。

再度 NNgen をやってみようということで、前回は、サンプルの hello_nngen.py をやってみて、IP-XACT の hello_nngen_v1_0 IP を作成した。今回は、hello_nngen_v1_0 IP を Vivado で実装してみよう。

Vivado 2020.2 を起動して、ZYBO Z7-20 の hello_nngen プロジェクトを作成した。
NNgen2_25_210322.png

hello_nngen プロジェクトのディレクトリに hello_nngn_v1_0 ディレクトリをコピーした。
NNgen2_26_210322.png

IP Catalog を起動して、 hello_nngn_v1_0 IP をリポジトリに追加した。
NNgen2_27_210322.png

hello_nngn_v1_0 IP の構造はこのようになっているそうだ。
”オープンソースコンパイラNNgenでつくるエッジ・ディープラーニングシステム”の26枚目のスライドを引用する。
NNgen2_28_210322.png

さて、 hello_nngen_bd ブロックデザインを作成して、ZYNQ7 Processing System や hello_nngn_v1_0 IP を Add IP してブロックデザインを完成させた。
NNgen2_29_210322.png

Address Editor を示す。
NNgen2_30_210322.png

hello_nngen_bd ブロックデザインに HDL Wrapper の Verilog HDL ファイルを生成した。
NNgen2_31_210322.png

論理合成、インプリメンテーション、ビットストリームの生成を行った。結果を示す。
NNgen2_32_210322.png

LUT は ZYBO Z7-20 の 32 % 使用している。

各 IP の内訳を示す。
NNgen2_33_210322.png

論理合成、インプリメンテーション、ビットストリームの生成を行った後の Vivado プロジェクトを示す。
NNgen2_34_210322.png

ハードウェアをエクスポートして XSA ファイルを作成した。
NNgen2_35_210322.png

hello_nngen_v1_0 はランダム・ウエイトということなので、これ以上はやっても仕方が無いので、ここで終了とする。
  1. 2021年03月23日 03:44 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

NNgen を再度やってみる2(hello_nngen.py)

NNgen を再度やってみる1

再度 NNgen をやってみようということで、前回は NNgen をインストールする準備を行って、NNgen をインストールした。今回はサンプルの hello_nngen.py をやってみよう。

hello_nngen は NNgen の GitHub には 2 種類あって、それは hello_nngen.py と hello_nngen.ipynb だ。 hello_nngen.ipynb は Jupyter Notebook のファイルだ。

まずは、
python3 hello_nngen.py
で hello_nngen.py を実行する。
NNgen2_19_210321.png
NNgen2_20_210321.png

verify が FAILED している。

hello_nngen.ipynb も試してみよう。
Jupyter notebook はインストール済みなので、
jupyter notebook &
で起動した。
NNgen2_21_210322.png

hello_nngen.ipynb を起動して、最後まで実行してみたが、やはり verify が FAILED してしまう。
NNgen2_22_210322.png
NNgen2_23_210322.png

どうしてだろうか?

さて、nngen ディレクトリを見ると hello_nngen_v1_0 ディレクトリが生成されている。
hello_nngen_v1_0 ディレクトリの下には、 component.xml が生成されていた。 IP-XACT の IP が生成されているようだ。
NNgen2_24_210322.png

最後に python3 hello_nngen.py のログを貼っておく。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/shtaxxx/nngen$ python3 hello_nngen.py 
[[  8 -18   3  -2   3   2  23  -8   0  -5]]
NNgen: Neural Network Accelerator Generator (version 1.3.1)
[IP-XACT]
  Output: hello_nngen
[Configuration]
(AXI Master Interface)
  Data width   : 32
  Address width: 32
(AXI Slave Interface)
  Data width   : 32
  Address width: 32
[Schedule Table]
(Stage 0)
(Stage 1)
  <conv2d None dtype:int8 shape:(1, 32, 32, 64) strides:(1, 1, 1, 1) padding:'SAME'-(1, 1, 1, 1) bias:(64,) scale:(64,) cshamt_out:17 act_func:relu sum_dtype:int32 par_ich:2 par_och:2 concur_och:16 stationary:filter keep_input default_addr:4242240 g_index:0 l_index:1 word_alignment:4 aligned_shape:(1, 32, 32, 64) scale_factor:2.625163>
  | <placeholder input_layer dtype:int8 shape:(1, 32, 32, 3) default_addr:64 g_index:2 word_alignment:4 aligned_shape:(1, 32, 32, 4) scale_factor:64.000000>
  | <variable w0 dtype:int8 shape:(64, 3, 3, 3) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(64, 3, 3, 4) scale_factor:42.333333>
  | <variable b0 dtype:int32 shape:(64,) default_addr:4160 g_index:3 word_alignment:2 aligned_shape:(64,) scale_factor:2709.333333>
  | <variable s0 dtype:int8 shape:(64,) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(64,) scale_factor:127.000000>
(Stage 2)
  <max_pool_serial None dtype:int8 shape:(1, 16, 16, 64) ksize:(1, 2, 2, 1) strides:(1, 2, 2, 1) padding:'SAME'-(0, 0, 0, 0) par:2 no_reuse default_addr:4307776 g_index:0 l_index:2 word_alignment:4 aligned_shape:(1, 16, 16, 64) scale_factor:2.625163>
  | <conv2d None dtype:int8 shape:(1, 32, 32, 64) strides:(1, 1, 1, 1) padding:'SAME'-(1, 1, 1, 1) bias:(64,) scale:(64,) cshamt_out:17 act_func:relu sum_dtype:int32 par_ich:2 par_och:2 concur_och:16 stationary:filter keep_input default_addr:4242240 g_index:0 l_index:1 word_alignment:4 aligned_shape:(1, 32, 32, 64) scale_factor:2.625163>
(Stage 3)
  <conv2d None dtype:int8 shape:(1, 16, 16, 64) strides:(1, 1, 1, 1) padding:'SAME'-(1, 1, 1, 1) bias:(64,) scale:(64,) cshamt_out:16 act_func:relu sum_dtype:int32 par_ich:2 par_och:2 concur_och:16 stationary:filter default_addr:4324160 g_index:0 l_index:3 word_alignment:4 aligned_shape:(1, 16, 16, 64) scale_factor:0.215359>
  | <max_pool_serial None dtype:int8 shape:(1, 16, 16, 64) ksize:(1, 2, 2, 1) strides:(1, 2, 2, 1) padding:'SAME'-(0, 0, 0, 0) par:2 no_reuse default_addr:4307776 g_index:0 l_index:2 word_alignment:4 aligned_shape:(1, 16, 16, 64) scale_factor:2.625163>
  | <variable w1 dtype:int8 shape:(64, 3, 3, 64) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(64, 3, 3, 64) scale_factor:42.333333>
  | <variable b1 dtype:int32 shape:(64,) default_addr:4160 g_index:3 word_alignment:2 aligned_shape:(64,) scale_factor:111.131890>
  | <variable s1 dtype:int8 shape:(64,) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(64,) scale_factor:127.000000>
(Stage 4)
  <_lazy_reshape None dtype:int8 shape:(1, 16384) alias_of:<conv2d> default_addr:4324160 g_index:0 l_index:3 word_alignment:4 aligned_shape:(1, 16384) scale_factor:0.215359>
  | <conv2d None dtype:int8 shape:(1, 16, 16, 64) strides:(1, 1, 1, 1) padding:'SAME'-(1, 1, 1, 1) bias:(64,) scale:(64,) cshamt_out:16 act_func:relu sum_dtype:int32 par_ich:2 par_och:2 concur_och:16 stationary:filter default_addr:4324160 g_index:0 l_index:3 word_alignment:4 aligned_shape:(1, 16, 16, 64) scale_factor:0.215359>
(Stage 5)
  <matmul None dtype:int8 shape:(1, 256) bias:(256,) scale:(256,) cshamt_out:19 act_func:relu sum_dtype:int32 par_left_col:2 par_out_col:2 concur_out_col:4 stationary:right keep_left default_addr:4340544 g_index:0 l_index:4 word_alignment:4 aligned_shape:(1, 256) scale_factor:0.002208>
  | <_lazy_reshape None dtype:int8 shape:(1, 16384) alias_of:<conv2d> default_addr:4324160 g_index:0 l_index:3 word_alignment:4 aligned_shape:(1, 16384) scale_factor:0.215359>
  | <variable w2 dtype:int8 shape:(256, 16384) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(256, 16384) scale_factor:42.333333>
  | <variable b2 dtype:int32 shape:(256,) default_addr:4160 g_index:3 word_alignment:2 aligned_shape:(256,) scale_factor:9.116853>
  | <variable s2 dtype:int8 shape:(256,) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(256,) scale_factor:127.000000>
(Stage 6)
  <matmul output_layer dtype:int8 shape:(1, 10) bias:(10,) scale:(10,) cshamt_out:16 sum_dtype:int32 par_left_col:2 par_out_col:2 concur_out_col:256 stationary:right keep_left keep_right default_addr:0 g_index:1 word_alignment:4 aligned_shape:(1, 12) scale_factor:0.000181>
  | <matmul None dtype:int8 shape:(1, 256) bias:(256,) scale:(256,) cshamt_out:19 act_func:relu sum_dtype:int32 par_left_col:2 par_out_col:2 concur_out_col:4 stationary:right keep_left default_addr:4340544 g_index:0 l_index:4 word_alignment:4 aligned_shape:(1, 256) scale_factor:0.002208>
  | <variable w3 dtype:int8 shape:(10, 256) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(10, 256) scale_factor:42.333333>
  | <variable b3 dtype:int32 shape:(10,) default_addr:4160 g_index:3 word_alignment:2 aligned_shape:(10,) scale_factor:0.093489>
  | <variable s3 dtype:int8 shape:(10,) default_addr:4160 g_index:3 word_alignment:4 aligned_shape:(12,) scale_factor:127.000000>
[RAM (spec: num)]
  64-bit 256-entry 2-port 1-bank RAM: 1
  16-bit 32768-entry 2-port 2-bank RAM: 2
  16-bit 8192-entry 2-port 2-bank RAM: 1
  16-bit 512-entry 2-port 2-bank RAM: 31
[Substream (spec: num)]
  ('acc_rshift_round_frac', (32, 0, True, 32, 0, True)): 2
  ('add_tree', (32, 0, True, 2)): 2
  ('add_tree', (32, 0, True, 18)): 2
  ('mul_rshift_round_clip', (32, 0, True, 8, 0, True, 40, 0, True, 8, 0, True, False)): 2
  ('mul_rshift_round_madd', (8, 0, True, 8, 0, True, 16, 0, True)): 36
  ('reduce_max', (8, 0, True)): 2
[Stream (spec: num)]
  (((<class 'nngen.operator.conv2d.conv2d'>, <dtype int8>, <dtype int8>, <dtype int32>, <dtype int8>), <dtype int8>, 1), 3, 3, False, None, <dtype int32>, 2, 2, 1, 1, 9, 36): 1
  (((<class 'nngen.operator.pool_serial.max_pool_serial'>, <dtype int8>), <dtype int8>, 2), 2, 2, True, 2): 1
  (((<class 'nngen.operator.basic._lazy_reshape'>, <dtype int8>), <dtype int8>, 1), True): 1
  (((<class 'nngen.operator.matmul.matmul'>, <dtype int8>, <dtype int8>, <dtype int32>, <dtype int8>), <dtype int8>, 1), 1, 1, False, None, <dtype int32>, 2, 2, 1, 1, 1, 4): 1
[State IDs in main_fsm]
  (3, 4, 'input_layer', 'None')
  (12, 14, None, 'control_conv2d_4')
  (18, 20, None, 'control_max_pool_serial_6')
  (28, 30, None, 'control_conv2d_4')
  (31, 32, None, 'None')
  (40, 42, None, 'control_matmul_16')
  (50, 52, 'output_layer', 'control_matmul_16')
[Control (name (# states: num))]
  main_fsm (# states: 58)
  control_conv2d_4 (# states: 56)
  control_max_pool_serial_6 (# states: 26)
  control_matmul_16 (# states: 41)
[Register Map]
    0 (R ): header0 (default: 0x00000000)
    4 (R ): header1 (default: 0x00000000)
    8 (R ): header2 (default: 0x00000000)
   12 (R ): header3 (default: 0x00000000)
   16 ( W): Start (set '1' to run)
   20 (R ): Busy (returns '1' when running)
   24 ( W): Reset (set '1' to initialize internal logic)
   28 (R ): Opcode from extern objects to SW (returns '0' when idle)
   32 ( W): Resume extern objects (set '1' to resume)
   36 (R ): Interrupt Status Register
   40 ( W): Interrupt Enable Register
   44 ( W): Interrupt Acknowledge Register
   48 (R ): State Counter
   52 ( W): Count Target
   56 ( W): Count Divider
   60 (  ): Reserved ...
  120 (  ): ... Reserved
  124 (R ): Address space amount
  128 (RW): Global address offset (default: 0)
  132 (RW): Address of temporal storages (size: 97KB)
  136 (RW): Address of output (matmul) 'output_layer' (size: 64B, dtype: int8, shape: (1, 10), alignment: 4 words (4 bytes)), aligned shape: (1, 12)
  140 (RW): Address of placeholder 'input_layer' (size: 4KB, dtype: int8, shape: (1, 32, 32, 3), alignment: 4 words (4 bytes)), aligned shape: (1, 32, 32, 4)
  144 (RW): Address of variables 'w0', 'b0', 's0', 'w1', 'b1', 's1', 'w2', 'b2', 's2', 'w3', 'b3', 's3' (size: 4139KB)
[Default Memory Map (start - end)] (entire range: [0 - 4340799], size: 4240KB)
  [      0 -      63]: output (matmul) 'output_layer' (size: 64B, dtype: int8, shape: (1, 10), alignment: 4 words (4 bytes)), aligned shape: (1, 12)
  [     64 -    4159]: placeholder 'input_layer' (size: 4KB, dtype: int8, shape: (1, 32, 32, 3), alignment: 4 words (4 bytes)), aligned shape: (1, 32, 32, 4)
  [   4160 -    6463]: variable 'w0' (size: 3KB, dtype: int8, shape: (64, 3, 3, 3), alignment: 4 words (4 bytes)), aligned shape: (64, 3, 3, 4)
  [   6464 -    6719]: variable 'b0' (size: 256B, dtype: int32, shape: (64,), alignment: 2 words (8 bytes)), aligned shape: (64,)
  [   6720 -    6783]: variable 's0' (size: 64B, dtype: int8, shape: (64,), alignment: 4 words (4 bytes)), aligned shape: (64,)
  [   6784 -   43647]: variable 'w1' (size: 36KB, dtype: int8, shape: (64, 3, 3, 64), alignment: 4 words (4 bytes)), aligned shape: (64, 3, 3, 64)
  [  43648 -   43903]: variable 'b1' (size: 256B, dtype: int32, shape: (64,), alignment: 2 words (8 bytes)), aligned shape: (64,)
  [  43904 -   43967]: variable 's1' (size: 64B, dtype: int8, shape: (64,), alignment: 4 words (4 bytes)), aligned shape: (64,)
  [  43968 - 4238271]: variable 'w2' (size: 4096KB, dtype: int8, shape: (256, 16384), alignment: 4 words (4 bytes)), aligned shape: (256, 16384)
  [4238272 - 4239295]: variable 'b2' (size: 1KB, dtype: int32, shape: (256,), alignment: 2 words (8 bytes)), aligned shape: (256,)
  [4239296 - 4239551]: variable 's2' (size: 256B, dtype: int8, shape: (256,), alignment: 4 words (4 bytes)), aligned shape: (256,)
  [4239552 - 4242111]: variable 'w3' (size: 3KB, dtype: int8, shape: (10, 256), alignment: 4 words (4 bytes)), aligned shape: (10, 256)
  [4242112 - 4242175]: variable 'b3' (size: 64B, dtype: int32, shape: (10,), alignment: 2 words (8 bytes)), aligned shape: (10,)
  [4242176 - 4242239]: variable 's3' (size: 64B, dtype: int8, shape: (10,), alignment: 4 words (4 bytes)), aligned shape: (12,)
  [4242240 - 4340799]: temporal storages (size: 97KB)
# IP-XACT was generated. Check the current directory.
ar: Vout__ALL.a を作成しています
# start
# end
# execution cycles:     2993360
NG (           0           0 ) orig:           10  check:            8
NG (           0           1 ) orig:          -19  check:          -18
OK (           0           2 ) orig:            3  check:            3
NG (           0           3 ) orig:           -1  check:           -2
NG (           0           4 ) orig:            4  check:            3
NG (           0           5 ) orig:            3  check:            2
NG (           0           6 ) orig:           24  check:           23
NG (           0           7 ) orig:           -9  check:           -8
NG (           0           8 ) orig:            1  check:            0
NG (           0           9 ) orig:           -4  check:           -5
# verify: FAILED
- hello_nngen.out/out.v:1105: Verilog $finish

  1. 2021年03月22日 04:18 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

NNgen を再度やってみる1

第3回ACRiウェビナー:Softwareエンジニアにも使って欲しいFPGAの実力”で NNgen の講演をみて再度 NNgen をやってみようということでやって見ることにした。
NNgen の講演資料は”オープンソースコンパイラNNgenでつくるエッジ・ディープラーニングシステム”だ。なお、講演の様子を動画でも見ることができる”第3回 ACRi ウェビナー(3/9)の動画”。

以前やっていた NNgen は消去して、1 から始めてみよう。
NNgen の Github を見て、環境を整えよう。

まずは、Python3 のバージョンを確かめる。
python3 --version
Python 3.6.5 :: Anaconda, Inc.
で 3.6.5 なので、 3.7 以上を満たさない。
よって、conda update で Python3 をバージョンアップしよう。
conda update anaconda
NNgen2_1_210319.png
python は 3.8.5 にアップデートされている。
NNgen2_2_210319.png
NNgen2_3_210319.png

sudo apt install iverilog
を実行したが、すでにインストールされていた。

pip3 で jinja2 pyverilog veriloggen numpy onnx をインストールする。
pip3 install jinja2 pyverilog veriloggen numpy onnx
NNgen2_4_210319.png
NNgen2_5_210319.png

pip3 で pytest pytest-pythonpath torch torchvision をインストールする。
NNgen2_6_210319.png
NNgen2_7_210319.png

エラーになってしまった。
--use-feature=2020-resolver オプションを付けろということなので、もう一度。
pip3 install pytest pytest-pythonpath torch torchvision --use-feature=2020-resolver
NNgen2_8_210319.png
NNgen2_9_210319.png
今度は成功した。

sudo apt install verilator
したらインストール済みだった。

さて、やっと、NNgen を git clone しよう。
git clone https://github.com/NNgen/nngen.git
NNgen2_10_210319.png

example をテストしてみた。
cd nngen/tests
python3 -m pytest .

onnx_matrix_conv2d/test_onnx_matrix_conv2d_sigmoid_int16_3x3_stride1.py を 1 日やっていたのだが、終了しなかったので、CTRL-C で強制終了した。
NNgen2_11_210319.png
NNgen2_12_210320.png
NNgen2_13_210320.png
failed が 13 個、passed が 291 個、warnings が 2 個だった。

ここで、インストールするのを忘れていたことに気がついたので、やってみた。
cd nngen
python3 setup.py install

NNgen2_14_210320.png
NNgen2_15_210320.png

もう一度、 Examples をテストしてみた。
cd tests
python3 -m pytest .

NNgen2_17_210320.png
NNgen2_18_210320.png
failed が 13 個、passed が 291 個だった。
  1. 2021年03月20日 13:03 |
  2. NNgen
  3. | トラックバック:0
  4. | コメント:0

PIC16F1825 の使い方3(I2C 機能、ポーリング編)

PIC16F1825 の使い方3(I2C 機能、割り込み編)”の続き。

PIC マイコンの PIC16F1825 を使うことになったので、使い方の覚書を書いておく。
前回は、I2C 機能を割り込みで使用したが、I2C Read を連続して行うと 1 分くらいで止まってしまうので、I2C をポーリングで書き直した。

ポーリングを使用した acc3_uart.c を示す。
このポーリング編のライブラリ・コードは”【PIC】I2C通信のやり方”のライブラリのレジスタを変更して引用している。

/*
 * File:   acc3_uart.c
 * Author: ono
 *
 * Created on 2021/02/03, 11:09
 */
 // "【PIC】I2C通信のやり方”のライブラリを引用している
 //  https://rikeden.net/?p=36

#include <xc.h>
#include <stdint.h>

#pragma config FOSC = INTOSC
//#pragma config WDTEN = OFF
#pragma config LVP = OFF
#pragma config PWRTE = ON

unsigned char chr;
unsigned int n = 0;

void Delay(unsigned int m)
{
    for(n=0;n<m;n++);       //Delay
}

void I2C_Master_Wait();
void I2C_Master_Start();
void I2C_Master_RepeatedStart();
void I2C_Master_Stop();
void I2C_Master_Write(uint8_t d);
uint8_t I2C_Master_Read(uint8_t a);
void acc_sensor_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t write_data);
void acc_sensor_grecv(uint8_t dataX[3], uint8_t dataY[3], uint8_t dataZ[3]);
uint8_t acc_sensor_data_ready(uint8_t dev_addr);
uint8_t acc_sensor_read_byte(uint8_t dev_addr, uint8_t reg_addr);
void acc_sensor_read_3bytes(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data);

void main( void )
{
    OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
    OSCTUNE = 0x00;
    
    TRISA = 0;
    TRISC = 0x23; // SCL, SDA, UART RX is input setting.
    ANSELA = 0;
    ANSELC = 0;

    //I2C
    SSP1ADD   = 19;     //speed 400KHz
    //SSP1ADD   = 0x4F; //speed 100KHz
    SSP1STAT = 0b10000000; // 400kHz
    SSP1CON1 = 0b00101000;  //SSP1EN=1, Master mode
    SSP1CON2 = 0b00000000;
    SSP1CON3 = 0b00000000;
    //SSP1IE = 1;
    //SSP1IF = 0;
    
    // UART
    BAUDCON = 0; // BRG16=0: 8bit counter mode
    SPBRGL = 3; // SYNC=0, BRGH=1, BRG16=0, 500000bps
    TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
    RCSTA = 0b10010000; // SPEN=1, CREN=1
    //INTCON = 0b11000000; // GIE=1, PEIE=1
    RCIE = 1;
    RCIF = 0;
    PEIE = 1;
    GIE = 1;

     /*while(1){
        while(TRMT == 0);
        TXREG = 0x55;
              
        Delay(50);
    } */
    
    uint8_t dataX[3], dataY[3], dataZ[3];
    uint8_t count=0, count_b;
    
    /*while(1){
        acc_sensor_write(0x3a, 0x2c, 0x83); // I2C speed is Hi speed, +-8g
        Delay(500);
    }*/
    
    acc_sensor_write(0x3a, 0x2c, 0x83); // I2C speed is Hi speed, +-8g
    
    acc_sensor_write(0x3a, 0x1e, 0x00); // OFFSET_X_H
    acc_sensor_write(0x3a, 0x1f, 0x00); // OFFSET_X_L
    acc_sensor_write(0x3a, 0x20, 0x00); // OFFSET_Y_H
    acc_sensor_write(0x3a, 0x21, 0x00); // OFFSET_Y_L
    acc_sensor_write(0x3a, 0x22, 0x00); // OFFSET_Z_H
    acc_sensor_write(0x3a, 0x23, 0x00); // OFFSET_Z_L
    
    acc_sensor_write(0x3a, 0x2d, 0x00); // stanby clear
    
    while(1){
        while((acc_sensor_data_ready(0x3b) & 0x01) == 0);
        //acc_sensor_read_3bytes(0x3b, 0x08, dataX);
        acc_sensor_grecv(dataX, dataY, dataZ);
        Delay(1000);
    }
    
}

void interrupt RX_int(void){
    if(RCIF == 1){
        RCIF = 0;
        chr = RCREG;
        if(RCREG != 0x55)
            return;
              
        while(TRMT == 0);
        TXREG = chr + 1;
    }
}

void acc_sensor_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t write_data){
    I2C_Master_Start();
    I2C_Master_Write(dev_addr);
    I2C_Master_Write(reg_addr);
    I2C_Master_Write(write_data);
    I2C_Master_Stop();
}

void acc_sensor_grecv(uint8_t *dataX, uint8_t *dataY, uint8_t *dataZ){
    while((acc_sensor_data_ready(0x3b) & 0x01) == 0);
    
    acc_sensor_read_3bytes(0x3b, 0x08, dataX);
    acc_sensor_read_3bytes(0x3b, 0x0b, dataY);
    acc_sensor_read_3bytes(0x3b, 0x0e, dataZ);
}

uint8_t acc_sensor_data_ready(uint8_t dev_addr){
    return(acc_sensor_read_byte(dev_addr, 0x04));
}

uint8_t acc_sensor_read_byte(uint8_t dev_addr, uint8_t reg_addr){
    uint8_t data;
    
    I2C_Master_Start();
    I2C_Master_Write(dev_addr & 0xFE);
    I2C_Master_Write(reg_addr);
    I2C_Master_RepeatedStart();
    I2C_Master_Write(dev_addr | 0x01);
    data = I2C_Master_Read(1);
    I2C_Master_Stop();
    return(data);
}
void acc_sensor_read_3bytes(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data){
    I2C_Master_Start();
    I2C_Master_Write(dev_addr & 0xFE);
    I2C_Master_Write(reg_addr);
    I2C_Master_RepeatedStart();
    I2C_Master_Write(dev_addr | 0x01);
    data[0] = I2C_Master_Read(0);
    data[1] = I2C_Master_Read(0);
    data[2] = I2C_Master_Read(1);
    I2C_Master_Stop();
}
void I2C_Master_Wait(){
  while ((SSP1STAT & 0x04) || (SSP1CON2 & 0x1F)); //Transmit is in progress
}
void I2C_Master_Start(){
  I2C_Master_Wait();    
  SSP1CON2bits.SEN = 1;           //Initiate start condition
}
void I2C_Master_RepeatedStart(){
  I2C_Master_Wait();
  SSP1CON2bits.RSEN = 1;          //Initiate repeated start condition
}
void I2C_Master_Stop(){
  I2C_Master_Wait();
  SSP1CON2bits.PEN = 1;           //Initiate stop condition
}
void I2C_Master_Write(uint8_t d){
  I2C_Master_Wait();
  SSP1BUF = d;                    //Write data to SSP1BUF
}
uint8_t I2C_Master_Read(uint8_t a){
  uint8_t temp;
  I2C_Master_Wait();
  SSP1CON2bits.RCEN = 1;
  I2C_Master_Wait();
  temp = SSP1BUF;                 //Read data from SSP1BUF
  I2C_Master_Wait();
  SSP1CON2bits.ACKDT = a;         //Acknowledge bit    1:NACK  0:ACK
  SSP1CON2bits.ACKEN = 1;         //Acknowledge sequence
  return temp;
}


acc_sensor_read_byte(dev_addr, 0x04)

の 1 バイトの Read のトランザクションを示す。
PIC_5_210317.jpg
PIC_6_210317.jpg

0x07 が Read できた。

次に、

acc_sensor_read_3bytes(0x3b, 0x08, dataX);

の 3 バイト Read トランザクションを示す。
PIC_2_210317.jpg
PIC_3_210317.jpg
PIC_4_210317.jpg

0x00, 0x1F, 0x70 が Read できた。
しかしやはり、連続 Read していると 1 分くらいで止まってしまう。。。
  1. 2021年03月19日 03:36 |
  2. PIC
  3. | トラックバック:0
  4. | コメント:0

PIC16F1825 の使い方3(I2C 機能、割り込み編)

PIC16F1825 の使い方2(USART の設定)”の続き。

PIC マイコンの PIC16F1825 を使うことになったので、使い方の覚書を書いておく。
前回は、USART を使ったが、今回は、I2C 機能を割り込みで使用したが、I2C Read を連続して行うと 1 分くらいで止まってしまう。

I2C は PIC16F1825 マスタで 3 軸加速度センサーの ADXL355 をスレーブとして接続している。
現在はブレッドボード上でジャンパー・ワイヤで接続している。
PIC_7_210317.jpg

割り込みを使用した acc3_uart.c を示す。
なおクロック周波数は最高速の 32 MHz で I2C の動作周波数は 400 kHz に設定されている。

/*
 * File:   acc3_uart.c
 * Author: ono
 *
 * Created on 2021/02/03, 11:09
 */

#include <xc.h>
#include <stdint.h>

#pragma config FOSC = INTOSC
//#pragma config WDTEN = OFF
#pragma config LVP = OFF
#pragma config PWRTE = ON

unsigned char chr;
unsigned int n = 0;
uint8_t I2C_rw = 1; // 0 - Read, 1 - Write
#define I2C_READ    0
#define I2C_WRITE   1

uint8_t I2C_Read_bytes = 3; // 3 bytes or 1 byte

uint8_t I2C_WState = 0;
uint8_t I2C_RState = 0;
#define I2CW_IDLE               0
#define I2CW_SENT_START         1
#define I2CW_SENT_DEVICE_ADDR   2
#define I2CW_SENT_REG_ADDR      3
#define I2CW_SENT_DATA          4
#define I2CW_SENT_STOP          5

#define I2CR_IDLE                   0
#define I2CR_SENT_START             1
#define I2CR_SENT_DEVICE_ADDR       2
#define I2CR_SENT_REG_ADDR          3
#define I2CR_SENT_REPEAT_START      4
#define I2CR_SENT_DEV_RADDR         5
#define I2CR_RECV_DATA0_WACK        6
#define I2CR_RECV_DATA0_WACK_DET    7
#define I2CR_RECV_DATA0_WNAK        8
#define I2CR_RECV_DATA1             9
#define I2CR_RECV_DATA1_WACK_DET    10
#define I2CR_RECV_DATA2_WNAK        11
#define I2CR_SEND_STOP              12
#define I2CR_SENT_STOP              13

uint8_t accs_dev_addr, accs_reg_addr, accs_write_data;
uint8_t accs_recv_data0, accs_recv_data1, accs_recv_data2;

void Delay(unsigned int m)
{
    for(n=0;n<m;n++);       //Delay
}

void acc_sensor_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t write_data);
void acc_sensor_recv(uint8_t dataX[3], uint8_t dataY[3], uint8_t dataZ[3]);
void acc_sensor_recv_xyz(uint8_t dev_addr, uint8_t reg_addr, uint8_t data[3]);

void main( void )
{
    OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
    OSCTUNE = 0x00;
    
    TRISA = 0;
    TRISC = 0x23; // SCL, SDA, UART RX is input setting.
    ANSELA = 0;
    ANSELC = 0;

    //I2C
    SSP1ADD   = 19;     //speed 400KHz
    //SSP1ADD   = 0x4F; //speed 100KHz
    SSP1STAT = 0b10000000; // 400kHz
    SSP1CON1 = 0b00101000;  //SSP1EN=1, Master mode
    SSP1CON2 = 0b00000000;
    SSP1CON3 = 0b00000000;
    SSP1IE = 1;
    SSP1IF = 0;
    
    // UART
    BAUDCON = 0; // BRG16=0: 8bit counter mode
    SPBRGL = 3; // SYNC=0, BRGH=1, BRG16=0, 500000bps
    TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
    RCSTA = 0b10010000; // SPEN=1, CREN=1
    //INTCON = 0b11000000; // GIE=1, PEIE=1
    RCIE = 1;
    RCIF = 0;
    PEIE = 1;
    GIE = 1;

     /*while(1){
        while(TRMT == 0);
        TXREG = 0x55;
              
        Delay(50);
    } */
    
    uint8_t dataX[3], dataY[3], dataZ[3];
    uint8_t count=0, count_b;
    
    /*while(1){
        acc_sensor_write(0x3a, 0x2c, 0x83); // I2C speed is Hi speed, +-8g
        Delay(500);
    }*/
    
    acc_sensor_write(0x3a, 0x2c, 0x83); // I2C speed is Hi speed, +-8g
    
    acc_sensor_write(0x3a, 0x1e, 0x00); // OFFSET_X_H
    acc_sensor_write(0x3a, 0x1f, 0x00); // OFFSET_X_L
    acc_sensor_write(0x3a, 0x20, 0x00); // OFFSET_Y_H
    acc_sensor_write(0x3a, 0x21, 0x00); // OFFSET_Y_L
    acc_sensor_write(0x3a, 0x22, 0x00); // OFFSET_Z_H
    acc_sensor_write(0x3a, 0x23, 0x00); // OFFSET_Z_L
    
    acc_sensor_write(0x3a, 0x2d, 0x00); // stanby clear
    
    while(1){
        acc_sensor_recv_xyz(0x3b, 0x08, dataX);
        //acc_sensor_recv(dataX, dataY, dataZ);
        Delay(100);
    }
    
}

void interrupt RX_int(void){
    if(RCIF == 1){
        RCIF = 0;
        chr = RCREG;
        if(RCREG != 0x55)
            return;
              
        while(TRMT == 0);
        TXREG = chr + 1;
    } else if(SSP1IF == 1){
        if(I2C_rw == I2C_WRITE){
            switch(I2C_WState){
                case I2CW_SENT_START:
                    SSP1IF = 0;
                    SSP1BUF = accs_dev_addr & 0xFE; // dev_addr to SSP1BUF for Write
                    I2C_WState = I2CW_SENT_DEVICE_ADDR;
                    break;
                case I2CW_SENT_DEVICE_ADDR:
                    SSP1IF = 0;
                    SSP1BUF = accs_reg_addr; // reg_addr to SSP1BUF
                    I2C_WState = I2CW_SENT_REG_ADDR;
                    break;
                case I2CW_SENT_REG_ADDR:
                    SSP1IF = 0;
                    SSP1BUF = accs_write_data; // write_data to SSP1BUF
                    I2C_WState = I2CW_SENT_DATA;
                    break;
                case I2CW_SENT_DATA:
                    SSP1IF = 0;
                    SSP1CON2bits.PEN = 1; //Initiate stop condition
                    I2C_WState = I2CW_SENT_STOP;
                    break;
                case I2CW_SENT_STOP:
                    SSP1IF = 0;
                    I2C_WState = I2CW_IDLE;
                    break;
                default:
                    break;
            }
        } else { // I2C_rw == I2C_READ;
            switch(I2C_RState){
                case I2CR_SENT_START:
                    SSP1IF = 0;
                    SSP1BUF = accs_dev_addr & 0xFE; // dev_addr to SSP1BUF for Write
                    I2C_RState = I2CR_SENT_DEVICE_ADDR;
                    break;
                case I2CR_SENT_DEVICE_ADDR:
                    SSP1IF = 0;
                    SSP1BUF = accs_reg_addr; // reg_addr to SSP1BUF
                    I2C_RState = I2CR_SENT_REG_ADDR;
                    break;
                case I2CR_SENT_REG_ADDR:
                    SSP1IF = 0;
                    SSP1CON2bits.RSEN = 1; // Repeat Star
                    I2C_RState = I2CR_SENT_REPEAT_START;
                    break;
                case I2CR_SENT_REPEAT_START:
                    SSP1IF = 0;
                    SSP1BUF = accs_dev_addr | 1; // dev_addr to SSP1BUF for Read
                    I2C_RState = I2CR_SENT_DEV_RADDR;
                    break;
                case I2CR_SENT_DEV_RADDR:
                    SSP1IF = 0;
                    SSP1CON2bits.RCEN = 1; // Recieve Enable
                    if(I2C_Read_bytes == 3)
                        I2C_RState = I2CR_RECV_DATA0_WACK;
                    else
                        I2C_RState = I2CR_RECV_DATA0_WNAK;
                    break;                    
                case I2CR_RECV_DATA0_WNAK:
                    SSP1IF = 0;
                    SSP1CON2bits.ACKDT = 1; // NACK
                    SSP1CON2bits.ACKEN = 1;
                    accs_recv_data0 = SSP1BUF; //Read data from SSP1BUF
                    I2C_RState = I2CR_SEND_STOP;
                    break;
                case I2CR_RECV_DATA0_WACK:
                    SSP1IF = 0;
                    SSP1CON2bits.ACKDT = 0; // ACK
                    SSP1CON2bits.ACKEN = 1;
                    accs_recv_data0 = SSP1BUF; //Read data from SSP1BUF
                    I2C_RState = I2CR_RECV_DATA0_WACK_DET;
                    break;
                case I2CR_RECV_DATA0_WACK_DET:
                    SSP1IF = 0;
                    SSP1CON2bits.RCEN = 1; // Recieve Enable
                    I2C_RState = I2CR_RECV_DATA1;
                    break;
                case I2CR_RECV_DATA1:
                    SSP1IF = 0;
                    SSP1CON2bits.ACKDT = 0; // ACK
                    SSP1CON2bits.ACKEN = 1;
                    accs_recv_data1 = SSP1BUF; //Read data from SSP1BUF
                    I2C_RState = I2CR_RECV_DATA1_WACK_DET;
                    break;
                case I2CR_RECV_DATA1_WACK_DET:
                    SSP1IF = 0;
                    SSP1CON2bits.RCEN = 1; // Recieve Enable
                    I2C_RState = I2CR_RECV_DATA2_WNAK;
                    break;
                case I2CR_RECV_DATA2_WNAK:
                    SSP1IF = 0;
                    SSP1CON2bits.ACKDT = 1; // NACK
                    SSP1CON2bits.ACKEN = 1;
                    accs_recv_data2 = SSP1BUF; //Read data from SSP1BUF
                    I2C_RState = I2CR_SEND_STOP;
                    break;
                case I2CR_SEND_STOP:
                    SSP1IF = 0;
                    SSP1CON2bits.PEN = 1; //Initiate stop condition
                    I2C_RState = I2CR_SENT_STOP;
                    break;
                case I2CR_SENT_STOP:
                    SSP1IF = 0;
                    I2C_RState = I2CR_IDLE;
                    break;
                default:
                    break;
            }
        }
    }
}

void acc_sensor_write(uint8_t dev_addr, uint8_t reg_addr, uint8_t write_data){
    while(I2C_WState != I2CW_IDLE);
    while(I2C_RState != I2CR_IDLE);
    
    accs_dev_addr = dev_addr;
    accs_reg_addr = reg_addr;
    accs_write_data = write_data;
    I2C_rw = I2C_WRITE;
    I2C_WState = I2CW_SENT_START;
    
    SSP1CON2bits.SEN = 1;           //Initiate start condition
    
    while(I2C_WState != I2CW_IDLE); // Wait I2C Write
    //Delay(10);
}

void acc_sensor_recv(uint8_t *dataX, uint8_t *dataY, uint8_t *dataZ){
    acc_sensor_recv_xyz(0x3b, 0x08, dataX);
    acc_sensor_recv_xyz(0x3b, 0x0b, dataY);
    acc_sensor_recv_xyz(0x3b, 0x0e, dataZ);
}

void acc_sensor_recv_xyz(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data){
    while(I2C_WState != I2CW_IDLE);
    while(I2C_RState != I2CR_IDLE);
    
    do{ // Wait data ready
        accs_dev_addr = 0x3b;
        accs_reg_addr = 0x04; // Watch data ready
        I2C_rw = I2C_READ;
        I2C_RState = I2CR_SENT_START;
        I2C_Read_bytes = 1; // 3 bytes or 1 byte
        SSP1CON2bits.SEN = 1;           //Initiate start condition
        while(I2C_RState != I2CR_IDLE); // Wait I2C Read
    }while((accs_recv_data0 & 0x01) != 0x01);

    //Delay(10);
    accs_dev_addr = dev_addr;
    accs_reg_addr = reg_addr;
    I2C_rw = I2C_READ;
    I2C_RState = I2CR_SENT_START;
    I2C_Read_bytes = 3; // 3 bytes or 1 byte
    SSP1CON2bits.SEN = 1;           //Initiate start condition
    while(I2C_RState != I2CR_IDLE); // Wait I2C Read
    
    data[0] = accs_recv_data0;
    data[1] = accs_recv_data1;
    data[2] = accs_recv_data2;
    //Delay(10);
}


この中の

acc_sensor_write(0x3a, 0x2c, 0x83); // I2C speed is Hi speed, +-8g

の波形を示す。
この波形を見る限り良さそうだ。
PIC_1_210317.jpg

I2C Write は大丈夫そうなのだが、 I2C Read を入れるとある程度動作して、止まってしまう。
I2C Read も割り込みハンドラのステート毎にちゃんと動作しているかを MPLAB X で調べてみたが、ちゃんと遷移している。

I2C の処理を割り込みハンドラで実装してダメだったので、次回はポーリングで実装してみよう。
  1. 2021年03月18日 03:38 |
  2. PIC
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる10

Xilinx Vitis HLS LLVM 2020.2 をやってみる9”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/ をやってみた。今回は、HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/ のスキームを使って、lap_filter_axis_RBG10.cpp を合成してみよう。

Xilinx Vitis HLS LLVM 2020.2 をやってみる8”で使用した lap_filter_axis_RBG10 のファイルを用意した。

lap_filter_axis_RBG10.cpp のコードを書き換えた。
PIPELINE 指示子などをコメントアウトして、Loop3 の for 文の下に

_SLXLoopInterchange();

を入力した。
Vitis_HLS_LLVM_113_210317.png

Xilinx Vitis HLS LLVM 2020.2 をやってみる9”の run_hls.tcl をコピーして、lap_filter_axis_RBG10 用に書き換えた。
Vitis_HLS_LLVM_114_210317.png

vitis_hls run_hls.tcl を実行したが、エラーが発生した。
Vitis_HLS_LLVM_115_210317.png
Vitis_HLS_LLVM_116_210317.png

slxplugin_lap_filter ディレクトリを示す。
hs_err_pid22706.log があった。
Vitis_HLS_LLVM_117_210317.png

hs_err_pid22706.log の一部を示す。
これは読めるけど、理解できない。。。
Vitis_HLS_LLVM_118_210317.png

ここで終了かな?
  1. 2021年03月17日 05:10 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる9

Xilinx Vitis HLS LLVM 2020.2 をやってみる8”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、以前実装した ””IMX219 MIPI sensor to Ultra96-V2 FPGA DisplayPort”にラプラシアン・フィルタを追加する1”の lap_filter_axis_RBG10 を使用して plugin_auto_array_partition_flow_demo のスキームでどのような結果になるか?を検証したところ、array partition 指示子を入れたのと同等の性能だった。今回は、HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/ をやってみよう。

slxplugin_loopinterchange_demo の説明を HLS/vitis_hls_examples/ ページの Google 翻訳から引用する。

コマンドラインおよび Vitis HLS IDEからSLXプラグインループ交換最適化を使用する方法。ローカルのLLVMビルドは必要ありません。



HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/ の READMI.md には SilexicaのVitis HLS用のSLXプラグインについての説明と書いてある。

さて、HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/ ディレクトリの code.cpp ファイルが合成される C++ のコードのようだ。
code.cpp を引用する。
Vitis_HLS_LLVM_96_210316.png

内側の for ループの最初jに _SLXLoopInterchange(); が記述されている。

run_hls.tcl を引用する。
Vitis_HLS_LLVM_97_210316.png

vanilla、 nointerchange、 interchange の 3 つの solution を 333MHz と 85MHz の動作周波数について実装するので、合計 6 個の solution が生成されるようだ。

vitis_hls run_hls.tcl
を実行した。
Vitis_HLS_LLVM_92_210315.png
Vitis_HLS_LLVM_93_210315.png

実行後の slxplugin_loopinterchange_demo ディレクトリの内容を示す。
Vitis_HLS_LLVM_94_210315.png

proj ディレクトリが生成されている。
Vitis_HLS_LLVM_95_210315.png

6 個の solution が生成されている。
Vitis_HLS_LLVM_95_210315.png

Vitis HLS 2020.2 を起動して、proj プロジェクトを読み込んだ。
0.vanilla 333MHz
Vitis_HLS_LLVM_98_210316.png

1.nointerchange 333MHz
Vitis_HLS_LLVM_99_210316.png

2.interchange 333MHz
Vitis_HLS_LLVM_100_210316.png

3.vanilla 85MHz
Vitis_HLS_LLVM_101_210316.png

4.nointerchange 85MHz
Vitis_HLS_LLVM_102_210316.png

5.interchange 85MHz
Vitis_HLS_LLVM_103_210316.png

0.vanilla 333MHz の Latency が 460801 クロックだったが、2.interchange 333MHz では 68864 クロックに低減している。
3.vanilla 85MHz の Latency が 67329 クロックで Slack もマイナスだったが、5.interchange 85MHz では、67072 クロックになって、Slack もプラスになったようだ。

Vitis HLS の Project メニューから Project Settings... を選択し、Synthesis を選択する。
Sythesis C/C++ Source Files に code.cpp があるが、その CFLAGS に設定されている。
Vitis_HLS_LLVM_104_210316.png

-include /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/include/slxplugin.h



最後に vitis_hls run_hls.tcl のログを示す。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo$ vitis_hls run_hls.tcl 

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
Sourcing tcl script 'scripts/vitis_hls_init.tcl'
slxplugin=/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Mon Mar 15 19:51:38 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: ::xilinx_open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj'.
INFO: [HLS 200-1510] Running: add_files code.cpp -cflags -include /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/include/slxplugin.h 
INFO: [HLS 200-10] Adding design file 'code.cpp' to the project
INFO: [HLS 200-1510] Running: add_files -tb code_test.cpp 
INFO: [HLS 200-10] Adding test bench file 'code_test.cpp' to the project
INFO: [HLS 200-1510] Running: set_top reduce_2d_to_1d 
SOLUTION 0.vanilla: no LLVM_CUSTOM_CMD, no Xilinx directives (clock: 333MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 0.vanilla 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/0.vanilla'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/0.vanilla/0.vanilla.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-10] Setting target device to 'xcvu9p-flga2104-2-i'
INFO: [HLS 200-1510] Running: create_clock -period 333MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.003ns.
INFO: [HLS 200-1510] Running: csim_design 
INFO: [SIM 211-2] *************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
   Compiling ../../../../code_test.cpp in debug mode
   Compiling ../../../../code.cpp in debug mode
   Generating csim.exe
58240
123777
189314
254851
320388
385925
451462
516999
582536
648073
713610
779147
844684
910221
975758
1.0413e+06
1.10683e+06
1.17237e+06
1.23791e+06
1.30344e+06
1.36898e+06
1.43452e+06
1.50005e+06
1.56559e+06
1.63113e+06
1.69666e+06
1.7622e+06
1.82774e+06
1.89328e+06
1.95881e+06
2.02435e+06
2.08989e+06
2.15542e+06
2.22096e+06
2.2865e+06
2.35204e+06
2.41757e+06
2.48311e+06
2.54865e+06
2.61418e+06
2.67972e+06
2.74526e+06
2.81079e+06
2.87633e+06
2.94187e+06
3.0074e+06
3.07294e+06
3.13848e+06
3.20402e+06
3.26955e+06
3.33509e+06
3.40063e+06
3.46616e+06
3.5317e+06
3.59724e+06
3.66278e+06
3.72831e+06
3.79385e+06
3.85939e+06
3.92492e+06
3.99046e+06
4.056e+06
4.12153e+06
4.18707e+06
4.25261e+06
4.31814e+06
4.38368e+06
4.44922e+06
4.51476e+06
4.58029e+06
4.64583e+06
4.71137e+06
4.7769e+06
4.84244e+06
4.90798e+06
4.97352e+06
5.03905e+06
5.10459e+06
5.17013e+06
5.23566e+06
5.3012e+06
5.36674e+06
5.43227e+06
5.49781e+06
5.56335e+06
5.62888e+06
5.69442e+06
5.75996e+06
5.8255e+06
5.89103e+06
5.95657e+06
6.02211e+06
6.08764e+06
6.15318e+06
6.21872e+06
6.28426e+06
6.34979e+06
6.41533e+06
6.48087e+06
6.5464e+06
6.61194e+06
6.67748e+06
6.74301e+06
6.80855e+06
6.87409e+06
6.93962e+06
7.00516e+06
7.0707e+06
7.13624e+06
7.20177e+06
7.26731e+06
7.33285e+06
7.39838e+06
7.46392e+06
7.52946e+06
7.595e+06
7.66053e+06
7.72607e+06
7.79161e+06
7.85714e+06
7.92268e+06
7.98822e+06
8.05375e+06
8.11929e+06
8.18483e+06
8.25036e+06
8.3159e+06
8.38144e+06
8.44698e+06
8.51251e+06
8.57805e+06
8.64359e+06
8.70912e+06
8.77466e+06
8.8402e+06
8.90574e+06
8.97127e+06
9.03681e+06
9.10235e+06
9.16788e+06
9.23342e+06
9.29896e+06
9.36449e+06
9.43003e+06
9.49557e+06
9.5611e+06
9.62664e+06
9.69218e+06
9.75772e+06
9.82325e+06
9.88879e+06
9.95433e+06
1.00199e+07
1.00854e+07
1.01509e+07
1.02165e+07
1.0282e+07
1.03475e+07
1.04131e+07
1.04786e+07
1.05442e+07
1.06097e+07
1.06752e+07
1.07408e+07
1.08063e+07
1.08718e+07
1.09374e+07
1.10029e+07
1.10685e+07
1.1134e+07
1.11995e+07
1.12651e+07
1.13306e+07
1.13961e+07
1.14617e+07
1.15272e+07
1.15928e+07
1.16583e+07
1.17238e+07
1.17894e+07
1.18549e+07
1.19204e+07
1.1986e+07
1.20515e+07
1.2117e+07
1.21826e+07
1.22481e+07
1.23137e+07
1.23792e+07
1.24447e+07
1.25103e+07
1.25758e+07
1.26413e+07
1.27069e+07
1.27724e+07
1.2838e+07
1.29035e+07
1.2969e+07
1.30346e+07
1.31001e+07
1.31656e+07
1.32312e+07
1.32967e+07
1.33623e+07
1.34278e+07
1.34933e+07
1.35589e+07
1.36244e+07
1.36899e+07
1.37555e+07
1.3821e+07
1.38865e+07
1.39521e+07
1.40176e+07
1.40832e+07
1.41487e+07
1.42142e+07
1.42798e+07
1.43453e+07
1.44108e+07
1.44764e+07
1.45419e+07
1.46075e+07
1.4673e+07
1.47385e+07
1.48041e+07
1.48696e+07
1.49351e+07
1.50007e+07
1.50662e+07
1.51318e+07
1.51973e+07
1.52628e+07
1.53284e+07
1.53939e+07
1.54594e+07
1.5525e+07
1.55905e+07
1.5656e+07
1.57216e+07
1.57871e+07
1.58527e+07
1.59182e+07
1.59837e+07
1.60493e+07
1.61148e+07
1.61803e+07
1.62459e+07
1.63114e+07
1.6377e+07
1.64425e+07
1.6508e+07
1.65736e+07
1.66391e+07
1.67046e+07
1.67702e+07
check successful
INFO: [SIM 211-1] CSim done with 0 errors.
INFO: [SIM 211-3] *************** CSIM finish ***************
INFO: [HLS 200-111] Finished Command csim_design CPU user time: 1.15 seconds. CPU system time: 0.24 seconds. Elapsed time: 0.88 seconds; current allocated memory: 163.205 MB.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 163.387 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.1 seconds. CPU system time: 0.09 seconds. Elapsed time: 0.2 seconds; current allocated memory: 164.058 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/0.vanilla/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/0.vanilla/.autopilot/db/a.g.ld.6.user.bc
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.38 seconds. CPU system time: 0.26 seconds. Elapsed time: 3.63 seconds; current allocated memory: 165.969 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 165.969 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 167.159 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 166.371 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_in' (code.cpp:15) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.05 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.05 seconds; current allocated memory: 186.787 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_out' (code.cpp:14:21) in function 'reduce_2d_to_1d' the outer loop is not a perfect loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.04 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 179.068 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_in'.
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 1) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 2) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 3) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 4) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 5) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 6) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 7, Depth = 12, loop 'loop_in'
WARNING: [HLS 200-871] Estimated clock period (3.81ns) exceeds the target (target clock period: 3.003ns, clock uncertainty: 0.81081ns, effective delay budget: 2.19219ns).
Resolution: For help on HLS 200-871 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-871.html
WARNING: [HLS 200-1016] The critical path in module 'reduce_2d_to_1d' consists of the following:    'dadd' operation ('add', code.cpp:17) [40]  (1.91 ns)
    'phi' operation ('empty_6', code.cpp:17) with incoming values : ('bitcast_ln17', code.cpp:17) ('add', code.cpp:17) [26]  (0 ns)
    'dadd' operation ('add', code.cpp:17) [40]  (1.91 ns)

Resolution: For help on HLS 200-1016 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1016.html
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 179.400 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.09 seconds. CPU system time: 0 seconds. Elapsed time: 0.08 seconds; current allocated memory: 179.676 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_8_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 180.199 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.83 seconds. CPU system time: 0.04 seconds. Elapsed time: 1 seconds; current allocated memory: 187.869 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were NOT satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 262.47 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.68 seconds. CPU system time: 0.41 seconds. Elapsed time: 5.22 seconds; current allocated memory: 187.984 MB.
SOLUTION 1.nointerchange: LLVM_CUSTOM_CMD -slx-prepare-interchange, no Xilinx directives (clock: 333MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 1.nointerchange 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/1.nointerchange'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/1.nointerchange/1.nointerchange.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-1510] Running: create_clock -period 333MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.003ns.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0.01 seconds. Elapsed time: 0 seconds; current allocated memory: 175.511 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.11 seconds. CPU system time: 0.08 seconds. Elapsed time: 0.19 seconds; current allocated memory: 175.519 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-prepare-for-interchange -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/1.nointerchange/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/1.nointerchange/.autopilot/db/a.g.ld.6.user.bc
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.37 seconds. CPU system time: 0.3 seconds. Elapsed time: 3.75 seconds; current allocated memory: 175.627 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 175.628 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 176.578 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 175.775 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_in' (code.cpp:15) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 196.111 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_out' (code.cpp:14:21) in function 'reduce_2d_to_1d' either the parent loop or sub loop is do-while loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 188.303 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_in'.
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 1) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 2) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 3) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 4) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 5) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
WARNING: [HLS 200-881] Unable to enforce a carried constraint (II = 6) between 'dadd' operation ('add', code.cpp:17) and 'dadd' operation ('add', code.cpp:17).
Resolution: For help on HLS 200-881 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-881.html
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 7, Depth = 11, loop 'loop_in'
WARNING: [HLS 200-871] Estimated clock period (3.81ns) exceeds the target (target clock period: 3.003ns, clock uncertainty: 0.81081ns, effective delay budget: 2.19219ns).
Resolution: For help on HLS 200-871 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-871.html
WARNING: [HLS 200-1016] The critical path in module 'reduce_2d_to_1d' consists of the following:    'dadd' operation ('add', code.cpp:17) [30]  (1.91 ns)
    'phi' operation ('empty_6', code.cpp:17) with incoming values : ('bitcast_ln17', code.cpp:17) ('add', code.cpp:17) [21]  (0 ns)
    'dadd' operation ('add', code.cpp:17) [30]  (1.91 ns)

Resolution: For help on HLS 200-1016 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1016.html
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.05 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.07 seconds; current allocated memory: 188.445 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.07 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 188.624 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_8_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 188.997 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.7 seconds. CPU system time: 0.04 seconds. Elapsed time: 0.74 seconds; current allocated memory: 190.005 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were NOT satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 262.47 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.54 seconds. CPU system time: 0.44 seconds. Elapsed time: 5.04 seconds; current allocated memory: 190.131 MB.
SOLUTION 2.interchange: LLVM_CUSTOM_CMD -slx-prepare-interchange -slx-loop-interchange, no Xilinx directives (clock: 333MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 2.interchange 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/2.interchange'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/2.interchange/2.interchange.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-1510] Running: create_clock -period 333MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.003ns.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 177.487 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.12 seconds. CPU system time: 0.08 seconds. Elapsed time: 0.2 seconds; current allocated memory: 177.531 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-prepare-for-interchange -slx-loop-interchange -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/2.interchange/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/2.interchange/.autopilot/db/a.g.ld.6.user.bc
SLX-INFO: code.cpp:15:13: _SLXLoopInterchange applied successfully
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.36 seconds. CPU system time: 0.3 seconds. Elapsed time: 3.67 seconds; current allocated memory: 177.608 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 177.609 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 178.530 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 177.750 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_out' (code.cpp:14) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 198.051 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_in' (code.cpp:15:13) in function 'reduce_2d_to_1d' either the parent loop or sub loop is do-while loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 190.239 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_out'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 12, loop 'loop_out'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 190.374 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.08 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.08 seconds; current allocated memory: 190.552 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_8_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 190.907 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.77 seconds. CPU system time: 0.02 seconds. Elapsed time: 0.8 seconds; current allocated memory: 191.825 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 524.93 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.63 seconds. CPU system time: 0.41 seconds. Elapsed time: 5.05 seconds; current allocated memory: 191.955 MB.
SOLUTION 3.vanilla: no LLVM_CUSTOM_CMD, no Xilinx directives (clock: 85MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 3.vanilla 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/3.vanilla'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/3.vanilla/3.vanilla.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-1510] Running: create_clock -period 85MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 11.765ns.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 179.284 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.11 seconds. CPU system time: 0.1 seconds. Elapsed time: 0.2 seconds; current allocated memory: 179.320 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/3.vanilla/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/3.vanilla/.autopilot/db/a.g.ld.6.user.bc
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.35 seconds. CPU system time: 0.25 seconds. Elapsed time: 3.63 seconds; current allocated memory: 179.425 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 179.426 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 180.382 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.02 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 179.567 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_in' (code.cpp:15) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 199.898 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_out' (code.cpp:14:21) in function 'reduce_2d_to_1d' the outer loop is not a perfect loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 192.143 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_in'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'loop_in'
WARNING: [HLS 200-871] Estimated clock period (17.012ns) exceeds the target (target clock period: 11.765ns, clock uncertainty: 3.17655ns, effective delay budget: 8.58845ns).
Resolution: For help on HLS 200-871 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-871.html
WARNING: [HLS 200-1016] The critical path in module 'reduce_2d_to_1d' consists of the following:    'dadd' operation ('add', code.cpp:17) [40]  (8.51 ns)
    'phi' operation ('empty_6', code.cpp:17) with incoming values : ('bitcast_ln17', code.cpp:17) ('add', code.cpp:17) [26]  (0 ns)
    'dadd' operation ('add', code.cpp:17) [40]  (8.51 ns)

Resolution: For help on HLS 200-1016 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1016.html
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 192.299 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.05 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.06 seconds; current allocated memory: 192.480 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_2_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 192.813 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.75 seconds. CPU system time: 0.03 seconds. Elapsed time: 0.79 seconds; current allocated memory: 193.821 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 58.78 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.53 seconds. CPU system time: 0.39 seconds. Elapsed time: 4.95 seconds; current allocated memory: 193.947 MB.
SOLUTION 4.nointerchange: LLVM_CUSTOM_CMD -slx-prepare-interchange, no Xilinx directives (clock: 85MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 4.nointerchange 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/4.nointerchange'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/4.nointerchange/4.nointerchange.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-1510] Running: create_clock -period 85MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 11.765ns.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0.01 seconds. Elapsed time: 0 seconds; current allocated memory: 181.182 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.11 seconds. CPU system time: 0.09 seconds. Elapsed time: 0.2 seconds; current allocated memory: 181.220 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-prepare-for-interchange -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/4.nointerchange/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/4.nointerchange/.autopilot/db/a.g.ld.6.user.bc
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.38 seconds. CPU system time: 0.22 seconds. Elapsed time: 3.6 seconds; current allocated memory: 181.295 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 181.295 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 182.255 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 181.438 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_in' (code.cpp:15) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.05 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.05 seconds; current allocated memory: 201.744 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_out' (code.cpp:14:21) in function 'reduce_2d_to_1d' either the parent loop or sub loop is do-while loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 193.936 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_in'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 4, loop 'loop_in'
WARNING: [HLS 200-871] Estimated clock period (17.012ns) exceeds the target (target clock period: 11.765ns, clock uncertainty: 3.17655ns, effective delay budget: 8.58845ns).
Resolution: For help on HLS 200-871 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-871.html
WARNING: [HLS 200-1016] The critical path in module 'reduce_2d_to_1d' consists of the following:    'dadd' operation ('add', code.cpp:17) [30]  (8.51 ns)
    'phi' operation ('empty_6', code.cpp:17) with incoming values : ('bitcast_ln17', code.cpp:17) ('add', code.cpp:17) [21]  (0 ns)
    'dadd' operation ('add', code.cpp:17) [30]  (8.51 ns)

Resolution: For help on HLS 200-1016 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1016.html
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.04 seconds; current allocated memory: 194.055 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 194.211 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_2_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.04 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 194.491 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.77 seconds. CPU system time: 0.02 seconds. Elapsed time: 0.8 seconds; current allocated memory: 195.452 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 58.78 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.56 seconds. CPU system time: 0.36 seconds. Elapsed time: 4.91 seconds; current allocated memory: 195.548 MB.
SOLUTION 5.interchange: LLVM_CUSTOM_CMD -slx-prepare-interchange -slx-loop-interchange, no Xilinx directives (clock: 85MHz)
INFO: [HLS 200-1510] Running: open_solution -reset 5.interchange 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/5.interchange'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/5.interchange/5.interchange.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xcvu9p-flga2104-2-i 
INFO: [HLS 200-1510] Running: create_clock -period 85MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 11.765ns.
INFO: [HLS 200-1510] Running: ::xilinx_csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 182.924 MB.
INFO: [HLS 200-10] Analyzing design file 'code.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 0.1 seconds. CPU system time: 0.08 seconds. Elapsed time: 0.21 seconds; current allocated memory: 182.933 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/slxplugin/lib/slxplugin.so -slx-prepare-for-interchange -slx-loop-interchange -slx-remove-directives $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/5.interchange/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/slxplugin_loopinterchange_demo/proj/5.interchange/.autopilot/db/a.g.ld.6.user.bc
SLX-INFO: code.cpp:15:13: _SLXLoopInterchange applied successfully
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.41 seconds. CPU system time: 0.24 seconds. Elapsed time: 3.66 seconds; current allocated memory: 183.038 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 183.039 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 183.960 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 183.192 MB.
INFO: [XFORM 203-510] Pipelining loop 'loop_out' (code.cpp:14) in function 'reduce_2d_to_1d' automatically.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 203.493 MB.
WARNING: [HLS 200-960] Cannot flatten loop 'loop_in' (code.cpp:15:13) in function 'reduce_2d_to_1d' either the parent loop or sub loop is do-while loop.
Resolution: For help on HLS 200-960 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-960.html
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.03 seconds; current allocated memory: 195.673 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'reduce_2d_to_1d' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'loop_out'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'loop_out'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 195.790 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.05 seconds; current allocated memory: 195.950 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'reduce_2d_to_1d' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/data' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on port 'reduce_2d_to_1d/acc' to 'ap_memory'.
INFO: [RTGEN 206-500] Setting interface mode on function 'reduce_2d_to_1d' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'dadd_64ns_64ns_64_2_full_dsp_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'reduce_2d_to_1d'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.04 seconds. CPU system time: 0 seconds. Elapsed time: 0.04 seconds; current allocated memory: 196.229 MB.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 0.75 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.75 seconds; current allocated memory: 197.128 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for reduce_2d_to_1d.
INFO: [VLOG 209-307] Generating Verilog RTL for reduce_2d_to_1d.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 117.56 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 4.56 seconds. CPU system time: 0.35 seconds. Elapsed time: 4.94 seconds; current allocated memory: 197.256 MB.
INFO: [HLS 200-112] Total CPU user time: 31.55 seconds. Total CPU system time: 3.04 seconds. Total elapsed time: 34.01 seconds; peak allocated memory: 203.493 MB.
INFO: [Common 17-206] Exiting vitis_hls at Mon Mar 15 19:52:12 2021...

  1. 2021年03月16日 04:30 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる8

Xilinx Vitis HLS LLVM 2020.2 をやってみる7”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、plugin_auto_array_partition_flow_demo の結果と、通常の Vitis HLS 2020.2 の結果を比較した。そして、手動で ARRAY PARTITION 指示子を追加した結果と plugin_auto_array_partition_flow_demo の結果を比較した。今回は、以前実装した ””IMX219 MIPI sensor to Ultra96-V2 FPGA DisplayPort”にラプラシアン・フィルタを追加する1”の lap_filter_axis_RBG10 を使用して plugin_auto_array_partition_flow_demo のスキームでどのような結果になるか?を検証してみよう。

最初に lap_filter_axis_RBG10 のViiis HLS 2020.2 プロジェクトをコピーして、solution1 と Vitis HLS の関連のファイルを削除した。
plugin_auto_array_partition_flow_demo から、run_hls.tcl をコピーして、 lap_fitler_axis_RGB10_autoAP とした。
Vitis_HLS_LLVM_80_210315.png

lap_filter_axis_RBG10.cpp を編集して、 array_partition 指示子をコメントアウトした。
Vitis_HLS_LLVM_85_210315.png

run_hls.tcl を編集して、lap_filter_axis_RBG10 に合うように記述を変更した。
Vitis_HLS_LLVM_83_210315.png

vitis_hls run_hls.tcl を実行した。
Vitis_HLS_LLVM_81_210315.png
Vitis_HLS_LLVM_82_210315.png

proj と vitis_hls.log が生成された。
Vitis_HLS_LLVM_84_210315.png

proj ディレクトリは Vitis HLS 2020.2 のプロジェクトなので、Vitis HLS IDE を起動して、proj プロジェクトを読み込んだ。
Vitis_HLS_LLVM_86_210315.png

Latency は 480011 クロックで 1 ピクセル/クロックにとっても近い。(画像サイズは 800 ピクセル x 600 行)

Vitis HLS 2020.2 で lap_filter_axis_RGB10 プロジェクトを作成し、lap_filter_axis_RBG10.cpp を Source に追加して、C コードの合成の結果を示す。
Vitis_HLS_LLVM_87_210315.png

Latency は 11440012 クロックだった。

proj プロジェクトの Analysis 画面の Resource Profile を示す。
Vitis_HLS_LLVM_88_210315.png

lap_filter_axis_RGB10 プロジェクトの Analysis 画面の Resource Profile を示す。
Vitis_HLS_LLVM_89_210315.png

lap_filter_axis_RGB10 プロジェクトの lap_filter_axis_RBG10.cpp の line_buf に

%HLS ARRAY_PARTITION variable=line_buf dim=1 factor=2 block

指示子を追加した。
Vitis_HLS_LLVM_90_210315.png

これで C コードの合成を行ったところ、 proj プロジェクトと同様の結果になった。
Vitis_HLS_LLVM_91_210315.png

今回は、plugin_auto_array_partition_flow_demo を実行すると良い結果になった。

最後に vitis_hls run_hls.tcl のログを貼っておく。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP$ vitis_hls run_hls.tcl 

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Sun Mar 14 21:25:20 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP/proj'.
INFO: [HLS 200-1510] Running: add_files lap_filter_axis_RBG10.cpp 
INFO: [HLS 200-10] Adding design file 'lap_filter_axis_RBG10.cpp' to the project
INFO: [HLS 200-1510] Running: set_top lap_filter_axis 
INFO: [HLS 200-1510] Running: open_solution -reset solution1 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP/proj/solution1'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP/proj/solution1/solution1.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part xczu3eg-sbva484-1-e 
INFO: [HLS 200-10] Setting target device to 'xczu3eg-sbva484-1-e'
INFO: [HLS 200-1510] Running: create_clock -period 10 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 10ns.
INFO: [HLS 200-1510] Running: csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 162.794 MB.
INFO: [HLS 200-10] Analyzing design file 'lap_filter_axis_RBG10.cpp' ... 
WARNING: [HLS 207-5510] 'Resource pragma' is deprecated, and it will be removed in future release. It is suggested to replace it with 'bind_op/bind_storage pragma'.: lap_filter_axis_RBG10.cpp:27:9
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 3.62 seconds. CPU system time: 0.29 seconds. Elapsed time: 3.19 seconds; current allocated memory: 164.399 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -always-inline -mem2reg -gvn -reflow-simplify-type -instcombine -mem2reg -gvn -indvars  -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMMemoryPartition.so -auto-memory-partition $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/lap_filter_axis_RGB10_autoAP/proj/solution1/.autopilot/db/a.g.ld.6.user.bc
INFO: [AUTO 101] Generating 1 array partition pragma(s) automatically
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
INFO: [HLS 214-186] Unrolling loop 'Loop5' (lap_filter_axis_RBG10.cpp:46:13) in function 'lap_filter_axis' completely with a factor of 2 (lap_filter_axis_RBG10.cpp:46:13)
INFO: [HLS 214-178] Inlining function 'conv_rbg2y10(int)' into 'lap_filter_axis(hls::stream<hls::axis<ap_int<32>, 1ul, 1ul, 1ul>, 0>&, hls::stream<hls::axis<ap_int<32>, 1ul, 1ul, 1ul>, 0>&, int)' (lap_filter_axis_RBG10.cpp:16:0)
INFO: [HLS 214-178] Inlining function 'laplacian_fil(int, int, int, int, int, int, int, int, int)' into 'lap_filter_axis(hls::stream<hls::axis<ap_int<32>, 1ul, 1ul, 1ul>, 0>&, hls::stream<hls::axis<ap_int<32>, 1ul, 1ul, 1ul>, 0>&, int)' (lap_filter_axis_RBG10.cpp:16:0)
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.85 seconds. CPU system time: 0.23 seconds. Elapsed time: 4.18 seconds; current allocated memory: 166.336 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 166.339 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.07 seconds. CPU system time: 0 seconds. Elapsed time: 0.11 seconds; current allocated memory: 173.464 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.11 seconds. CPU system time: 0 seconds. Elapsed time: 0.1 seconds; current allocated memory: 181.785 MB.
INFO: [XFORM 203-510] Pipelining loop 'Loop1' in function 'lap_filter_axis' automatically.
INFO: [XFORM 203-502] Unrolling all sub-loops inside loop 'Loop3' (lap_filter_axis_RBG10.cpp:22) in function 'lap_filter_axis' for pipelining.
INFO: [HLS 200-489] Unrolling loop 'Loop4' (lap_filter_axis_RBG10.cpp:46) in function 'lap_filter_axis' completely with a factor of 3.
INFO: [XFORM 203-101] Partitioning array 'pix_mat' (lap_filter_axis_RBG10.cpp:29) in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'line_buf' (lap_filter_axis_RBG10.cpp:25) in dimension 1 completely.
INFO: [XFORM 203-102] Automatically partitioning small array 'pix_mat.0' (lap_filter_axis_RBG10.cpp:29) completely based on array size.
INFO: [XFORM 203-102] Automatically partitioning small array 'pix_mat.1' (lap_filter_axis_RBG10.cpp:29) completely based on array size.
INFO: [XFORM 203-102] Automatically partitioning small array 'pix_mat.2' (lap_filter_axis_RBG10.cpp:29) completely based on array size.
INFO: [XFORM 203-101] Partitioning array 'pix_mat.0' (lap_filter_axis_RBG10.cpp:29) in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'pix_mat.1' (lap_filter_axis_RBG10.cpp:29) in dimension 1 completely.
INFO: [XFORM 203-101] Partitioning array 'pix_mat.2' (lap_filter_axis_RBG10.cpp:29) in dimension 1 completely.
INFO: [XFORM 203-11] Balancing expressions in function 'lap_filter_axis' (lap_filter_axis_RBG10.cpp:16)...5 expression(s) balanced.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.28 seconds. CPU system time: 0 seconds. Elapsed time: 0.32 seconds; current allocated memory: 212.423 MB.
INFO: [XFORM 203-541] Flattening a loop nest 'Loop2' (lap_filter_axis_RBG10.cpp:40:20) in function 'lap_filter_axis'.
INFO: [HLS 200-472] Inferring partial write operation for 'line_buf[0]' (lap_filter_axis_RBG10.cpp:57:19)
INFO: [HLS 200-472] Inferring partial write operation for 'line_buf[1]' (lap_filter_axis_RBG10.cpp:58:19)
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.17 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.2 seconds; current allocated memory: 209.959 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'lap_filter_axis' ...
WARNING: [SYN 201-107] Renaming port name 'lap_filter_axis/function' to 'lap_filter_axis/function_r' to avoid the conflict with HDL keywords or other object names.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'lap_filter_axis' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [HLS 200-486] Changing DSP48 latency (root=mul_ln101) to 3 in order to utilize available DSP registers.
INFO: [HLS 200-486] Changing DSP48 latency (root=mul_ln101_2) to 3 in order to utilize available DSP registers.
INFO: [HLS 200-486] Changing DSP48 latency (root=mul_ln101_1) to 3 in order to utilize available DSP registers.
INFO: [SCHED 204-61] Pipelining loop 'Loop1'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 1, loop 'Loop1'
INFO: [SCHED 204-61] Pipelining loop 'Loop2_Loop3'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 9, loop 'Loop2_Loop3'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.1 seconds. CPU system time: 0 seconds. Elapsed time: 0.11 seconds; current allocated memory: 210.623 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
WARNING: [BIND 205-102] The specified resource core for memory 'line_buf_0' will be ignored if a simpler one can be used.
WARNING: [BIND 205-102] The specified resource core for memory 'line_buf_1' will be ignored if a simpler one can be used.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.11 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.12 seconds; current allocated memory: 211.361 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'lap_filter_axis' 
INFO: [HLS 200-10] ----------------------------------------------------------------
WARNING: [RTGEN 206-101] Design contains AXI ports. Reset is fixed to synchronous and active low.
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_data_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_keep_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_strb_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_user_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_last_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_id_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/ins_V_dest_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_data_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_keep_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_strb_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_user_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_last_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_id_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/outs_V_dest_V' to 'axis' (register, both mode).
INFO: [RTGEN 206-500] Setting interface mode on port 'lap_filter_axis/function_r' to 's_axilite & ap_none'.
INFO: [RTGEN 206-500] Setting interface mode on function 'lap_filter_axis' to 's_axilite & ap_ctrl_hs'.
INFO: [RTGEN 206-100] Bundling port 'return' and 'function_r' to AXI-Lite port control.
INFO: [RTGEN 206-100] Generating core module 'mac_muladd_10ns_6ns_18ns_18_4_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'mac_muladd_10ns_8ns_18ns_18_4_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'mul_20s_22ns_32_1_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'mul_mul_10ns_9ns_18_4_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'lap_filter_axis'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.18 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.22 seconds; current allocated memory: 212.832 MB.
INFO: [RTMG 210-282] Generating pipelined core: 'lap_filter_axis_mul_20s_22ns_32_1_1_Multiplier_0'
INFO: [RTMG 210-278] Implementing memory 'lap_filter_axis_line_buf_0_ram (RAM_2P)' using auto RAMs.
INFO: [RTMG 210-278] Implementing memory 'lap_filter_axis_line_buf_1_ram (RAM_2P)' using auto RAMs.
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 1.37 seconds. CPU system time: 0.07 seconds. Elapsed time: 1.44 seconds; current allocated memory: 222.812 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for lap_filter_axis.
INFO: [VLOG 209-307] Generating Verilog RTL for lap_filter_axis.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 143.74 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 9.97 seconds. CPU system time: 0.62 seconds. Elapsed time: 10.08 seconds; current allocated memory: 223.207 MB.
INFO: [HLS 200-112] Total CPU user time: 12 seconds. Total CPU system time: 0.99 seconds. Total elapsed time: 11.59 seconds; peak allocated memory: 222.812 MB.
INFO: [Common 17-206] Exiting vitis_hls at Sun Mar 14 21:25:31 2021...
m


  1. 2021年03月15日 04:18 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる7

Xilinx Vitis HLS LLVM 2020.2 をやってみる6”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/vitis_​​hls_examples/plugin_auto_array_partition_flow_demo/ をやってみて、自動 array_partition を体験した。今回は、 plugin_auto_array_partition_flow_demo の結果と、通常の Vitis HLS 2020.2 の結果を比較してみよう。そして、手動で ARRAY PARTITION 指示子を追加した結果と plugin_auto_array_partition_flow_demo の結果を比較してみよう。

最初に Vitis HLS 2020.2 の auto_array_partition プロジェクトを作成する。
Vitis_HLS_LLVM_69_210312.png

Clock Period は 300MHz で、 Part は同様の xc7a12ticsg325-1L とした。
Vitis_HLS_LLVM_70_210312.png

auto_array_partition プロジェクトが作成された。
source に hls_example.cpp を追加した。
Vitis_HLS_LLVM_71_210312.png

合成のトップの関数に top を指定した。
Vitis_HLS_LLVM_72_210312.png

これで合成を行った。結果を示す。
Vitis_HLS_LLVM_73_210312.png

前回の plugin_auto_array_partition_flow_demo の結果を示す。
Vitis_HLS_LLVM_68_210312.png

前回は Latency が 3216 クロックだったが、今回の Latency は、3513 クロックとなっていて遅くなっている。

Analysis 画面の Resource Profile を比較してみよう。
前回の plugin_auto_array_partition_flow_demo の結果を示す。
BRAM が 72 個使用されている。大きい。
Vitis_HLS_LLVM_74_210312.png

今回の auto_array_partition プロジェクトはどうだろうか?
Vitis_HLS_LLVM_75_210312.png

BRAM の使用数は 6 個で圧倒的に少ない。

それじゃ、今回の auto_array_partition プロジェクトの hls_example.cpp の変数の配列に array partition 指示子を追加したらどうか?やってみた。
a_buf, b_buf, c_buf それぞれに array partition 指示子をディレクティブ・ファイルに追加した。

%HLS ARRAY_PARTITION variable=a_buf cyclic factor=8 dim=1
%HLS ARRAY_PARTITION variable=b_buf cyclic factor=8 dim=1
%HLS ARRAY_PARTITION variable=c_buf cyclic factor=8 dim=1


上記の指示子を追加した。
Vitis_HLS_LLVM_76_210313.png

合成したところ、 Latency は 3215 クロックになった。
plugin_auto_array_partition_flow_demo の結果よりも 1 クロック少ないが、使用する BRAM は 24 個だった。 72 個の 1/3 程度だ。
Vitis_HLS_LLVM_77_210313.png

更に auto_array_partition プロジェクトに DATAFLOW 指示子を追加してみた。
Vitis_HLS_LLVM_78_210313.png

合成した結果を示す。
Vitis_HLS_LLVM_79_210313.png

今回の Latency は 2216 クロックに減少している。しかも Interval が 1005 クロックなので、実質的に 2216 / 2 = 1108 クロックで処理することができそうだ。

plugin_auto_array_partition_flow_demo の Auto array partition はまだまだ結果に無駄が多い気がする。やはり、人間が ARRAY PARTITION 指示子を追加したほうが今の所良さそうだ。
  1. 2021年03月14日 05:06 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる6

Xilinx Vitis HLS LLVM 2020.2 をやってみる5”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/vitis_​​hls_examples/plugin_analyze_rename_flow_demo をやってみた。今回は、HLS/vitis_​​hls_examples/plugin_auto_array_partition_flow_demo/ をやってみて、自動 array_partition を体験してみたい。

plugin_auto_array_partition_flow_demo の説明を、HLS/vitis_hls_examples/ ページの Google 翻訳から引用する。

VitisHLS内でauto_array_partitionプラグインを使用する方法。plugins / auto_array_partitionプラグインをビルドする必要があります。ローカルのLLVMビルドは必要ありません。



HLS/vitis_​​hls_examples/plugin_auto_array_partition_flow_demo/ ディレクトリに行って、中身を確認すると、今までと同様に hls_example.cpp と run_hls.tcl ファイルがあった。
Vitis_HLS_LLVM_63_210312.png

run_hls.tcl ファイルを開けて編集する。
set_part を "artix7" に変更した。
Vitis_HLS_LLVM_64_210312.png

run_hls.tcl ファイルの一部分を引用する。

if { ![info exists ::env(HLS_LLVM_PLUGIN_DIR)] } {
  # Use plugin example directory as default build directory
  set ::env(HLS_LLVM_PLUGIN_DIR) [file normalize ../../plugins/auto_array_partition]
}
if { ![file exists $::env(HLS_LLVM_PLUGIN_DIR)/LLVMMemoryPartition.so] } {
  error "Must build LLVMMemoryPartition.so before running this example"
}
### The following variable must be set before csynth_design
# Do not use global namespace (::) for variables used in LVM_CUSTOM_CMD
set ::LLVM_CUSTOM_CMD {$LLVM_CUSTOM_OPT -always-inline -mem2reg -gvn -reflow-simplify-type -instcombine -mem2reg -gvn -indvars  -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMMemoryPartition.so -auto-memory-partition $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT}


LLVMMemoryPartition.so は、”Xilinx Vitis HLS LLVM 2020.2 をやってみる2”で作製済みだ。

cd ../plugin_auto_array_partition_flow_demo/
vitis_hls run_hls.tcl

コマンドを実行した。
Vitis_HLS_LLVM_65_210312.png
Vitis_HLS_LLVM_66_210312.png

実行後は vitis_hls.log と proj ディレクトリが生成されている。
proj ディレクトリは Vitis HLS のプロジェクト・ディレクトリとなっている。
Vitis_HLS_LLVM_67_210312.png

Vitis HLS 2020.2 で proj ディレクトリのプロジェクトを開いた。
Vitis_HLS_LLVM_68_210312.png

BRAM 72 個、 FF が 8264 個、 LUT が 5382 個使用している。かなり BRAM の数を使っている。
次回は、通常の Vitis HLS 2020.2 の結果と比較してみよう。

最後に vitis_hls run_hls.tcl のログを貼っておく。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo$ vitis_hls run_hls.tcl 

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Fri Mar 12 03:53:25 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj'.
INFO: [HLS 200-1510] Running: add_files hls_example.cpp 
INFO: [HLS 200-10] Adding design file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: add_files -tb hls_example.cpp 
INFO: [HLS 200-10] Adding test bench file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: set_top example 
INFO: [HLS 200-1510] Running: open_solution -reset solution1 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/solution1.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part artix7 
INFO: [HLS 200-10] Setting target device to 'xc7a12ti-csg325-1L'
INFO: [HLS 200-1510] Running: create_clock -period 300MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.333ns.
INFO: [HLS 200-1510] Running: csim_design 
INFO: [SIM 211-2] *************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
   Compiling ../../../../hls_example.cpp in debug mode
   Generating csim.exe
Test passed.
INFO: [SIM 211-1] CSim done with 0 errors.
INFO: [SIM 211-3] *************** CSIM finish ***************
INFO: [HLS 200-111] Finished Command csim_design CPU user time: 0.84 seconds. CPU system time: 0.24 seconds. Elapsed time: 0.54 seconds; current allocated memory: 163.119 MB.
INFO: [HLS 200-1510] Running: csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 163.302 MB.
INFO: [HLS 200-10] Analyzing design file 'hls_example.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 1.52 seconds. CPU system time: 0.28 seconds. Elapsed time: 1.51 seconds; current allocated memory: 164.903 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so -mem2reg -analyzer -renamer $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.6.user.bc
Loop at depth 1 containing: %2<header><exiting>,%3,%7<latch>
    Backedge Taken Count: 50
II:1
  %4 = load i32, i32* %arrayidx, align 4, !dbg !2252
    Access Pattern: {%a,+,4}<%2>  store i32 %4, i32* %arrayidx1, align 4, !dbg !2255
    Access Pattern: {%buff,+,4}<%2>  %5 = load i32, i32* %arrayidx2, align 4, !dbg !2256
    Access Pattern: {%buff,+,4}<%2>  store i32 %add, i32* %arrayidx3, align 4, !dbg !2259
    Access Pattern: {%buff,+,4}<%2>  %6 = load i32, i32* %arrayidx4, align 4, !dbg !2260
    Access Pattern: {%buff,+,4}<%2>  store i32 %6, i32* %arrayidx5, align 4, !dbg !2262
    Access Pattern: {%b,+,4}<%2>INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
INFO: [HLS 214-115] Multiple burst reads of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'aboba' (hls_example.cpp:31:20)
INFO: [HLS 214-115] Multiple burst writes of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'bboba' (hls_example.cpp:31:20)
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.4 seconds. CPU system time: 0.29 seconds. Elapsed time: 3.73 seconds; current allocated memory: 165.954 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 165.956 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.748 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.02 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.906 MB.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 189.088 MB.
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.04 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 181.710 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'example' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'VITIS_LOOP_31_1'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'VITIS_LOOP_31_1'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 181.992 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.07 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 182.178 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
WARNING: [RTGEN 206-101] Design contains AXI ports. Reset is fixed to synchronous and active low.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/aboba' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/bboba' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on function 'example' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'add_32ns_32ns_32_2_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'add_6ns_6ns_6_1_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'example'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.04 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 183.188 MB.
INFO: [RTMG 210-283] Generating pipelined adder/subtractor : 'example_add_32ns_32ns_32_2_1_Adder_1'
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 1.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 1.05 seconds; current allocated memory: 191.482 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for example.
INFO: [VLOG 209-307] Generating Verilog RTL for example.
INFO: [HLS 200-1603] Design has MAXI bursts and missed bursts, see Vitis HLS GUI synthesis summary report for detailed information.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 411.00 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 6.31 seconds. CPU system time: 0.6 seconds. Elapsed time: 6.69 seconds; current allocated memory: 192.086 MB.
INFO: [HLS 200-1510] Running: cosim_design 
INFO: [COSIM 212-47] Using XSIM for RTL simulation.
INFO: [COSIM 212-14] Instrumenting C test bench ...
   Build using "/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/tps/lnx64/gcc-6.2.0/bin/g++"
   Compiling hls_example.cpp_pre.cpp.tb.cpp
   Compiling apatb_example.cpp
   Compiling apatb_example_ir.ll
   Generating cosim.tv.exe
INFO: [COSIM 212-302] Starting C TB testing ... 
Test passed.
INFO: [COSIM 212-333] Generating C post check test bench ...
INFO: [COSIM 212-12] Generating RTL test bench ...
INFO: [COSIM 212-1] *** C/RTL co-simulation file generation completed. ***
INFO: [COSIM 212-323] Starting verilog simulation. 
INFO: [COSIM 212-15] Starting XSIM ...
Vivado Simulator 2020.2
Copyright 1986-1999, 2001-2020 Xilinx, Inc. All Rights Reserved.
Running: /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vivado/2020.2/bin/unwrapped/lnx64.o/xelab xil_defaultlib.apatb_example_top glbl -prj example.prj -L smartconnect_v1_0 -L axi_protocol_checker_v1_1_12 -L axi_protocol_checker_v1_1_13 -L axis_protocol_checker_v1_1_11 -L axis_protocol_checker_v1_1_12 -L xil_defaultlib -L unisims_ver -L xpm -L floating_point_v7_0_18 -L floating_point_v7_1_11 --lib ieee_proposed=./ieee_proposed -s example 
Multi-threading is on. Using 2 slave threads.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    C_INCLUDE_PATH
    LIBRARY_PATH
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/glbl.v" into library work
INFO: [VRFC 10-311] analyzing module glbl
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_aboba_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_read
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_bboba.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_bboba
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_add_32ns_32ns_32_2_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1_comb_adder
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.autotb.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module apatb_example_top
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_bboba_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_read
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_aboba.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_aboba
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_add_6ns_6ns_6_1_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1_Adder_0
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/sample_manager.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/sample_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_fifo_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/dump_file_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_monitor.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_process_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/dataflow_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [nodf_module_interface.sv:4]
INFO: [VRFC 10-311] analyzing module dataflow_monitor
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/csv_file_dump.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_process_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_fifo_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling package xil_defaultlib.$unit_dataflow_monitor_sv
Compiling module xil_defaultlib.example_aboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DEPTH=5...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_write(NUM_WR...
Compiling module xil_defaultlib.example_aboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_aboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_aboba_m_axi_read(NUM_REA...
Compiling module xil_defaultlib.example_aboba_m_axi_throttle(ADD...
Compiling module xil_defaultlib.example_aboba_m_axi(NUM_READ_OUT...
Compiling module xil_defaultlib.example_bboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DEPTH=5...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_write(NUM_WR...
Compiling module xil_defaultlib.example_bboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_bboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_bboba_m_axi_read(NUM_REA...
Compiling module xil_defaultlib.example_bboba_m_axi_throttle(ADD...
Compiling module xil_defaultlib.example_bboba_m_axi(NUM_READ_OUT...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1_Adder_...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1(ID=1,N...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1(ID=...
Compiling module xil_defaultlib.example
Compiling module xil_defaultlib.AESL_axi_master_aboba
Compiling module xil_defaultlib.AESL_axi_master_bboba
Compiling module xil_defaultlib.nodf_module_intf
Compiling module xil_defaultlib.dataflow_monitor_1
Compiling module xil_defaultlib.apatb_example_top
Compiling module work.glbl
Built simulation snapshot example

****** Webtalk v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/xsim.dir/example/webtalk/xsim_webtalk.tcl -notrace
INFO: [Common 17-206] Exiting Webtalk at Fri Mar 12 03:53:47 2021...

****** xsim v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source xsim.dir/example/xsim_script.tcl
# xsim {example} -autoloadwcfg -tclbatch {example.tcl}
Vivado Simulator 2020.2
Time resolution is 1 ps
source example.tcl
## run all
////////////////////////////////////////////////////////////////////////////////////
// Inter-Transaction Progress: Completed Transaction / Total Transaction
// Intra-Transaction Progress: Measured Latency / Latency Estimation * 100%
//
// RTL Simulation : "Inter-Transaction Progress" ["Intra-Transaction Progress"] @ "Simulation Time"
////////////////////////////////////////////////////////////////////////////////////
// RTL Simulation : 0 / 1 [0.00%] @ "109000"
// RTL Simulation : 1 / 1 [100.00%] @ "362000"
////////////////////////////////////////////////////////////////////////////////////
$finish called at time : 375750 ps : File "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.autotb.v" Line 462
## quit
INFO: [Common 17-206] Exiting xsim at Fri Mar 12 03:53:57 2021...
INFO: [COSIM 212-316] Starting C post checking ...
Test passed.
INFO: [COSIM 212-1000] *** C/RTL co-simulation finished: PASS ***
INFO: [COSIM 212-211] II is measurable only when transaction number is greater than 1 in RTL simulation. Otherwise, they will be marked as all NA. If user wants to calculate them, please make sure there are at least 2 transactions in RTL simulation.
INFO: [HLS 200-111] Finished Command cosim_design CPU user time: 23.04 seconds. CPU system time: 1.37 seconds. Elapsed time: 22.85 seconds; current allocated memory: 196.223 MB.
INFO: [HLS 200-112] Total CPU user time: 32.18 seconds. Total CPU system time: 2.64 seconds. Total elapsed time: 32.14 seconds; peak allocated memory: 191.482 MB.
INFO: [Common 17-206] Exiting vitis_hls at Fri Mar 12 03:53:57 2021...
masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo$ 


LLVMMemoryPartition.so が動作しているのはこの辺りかな?

INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so -mem2reg -analyzer -renamer $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT

      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt

      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc

      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.6.user.bc

Loop at depth 1 containing: %2<header><exiting>,%3,%7<latch>

    Backedge Taken Count: 50

II:1

  %4 = load i32, i32* %arrayidx, align 4, !dbg !2252

    Access Pattern: {%a,+,4}<%2>  store i32 %4, i32* %arrayidx1, align 4, !dbg !2255

    Access Pattern: {%buff,+,4}<%2>  %5 = load i32, i32* %arrayidx2, align 4, !dbg !2256

    Access Pattern: {%buff,+,4}<%2>  store i32 %add, i32* %arrayidx3, align 4, !dbg !2259

    Access Pattern: {%buff,+,4}<%2>  %6 = load i32, i32* %arrayidx4, align 4, !dbg !2260

    Access Pattern: {%buff,+,4}<%2>  store i32 %6, i32* %arrayidx5, align 4, !dbg !2262

    Access Pattern: {%b,+,4}<%2>INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.

  1. 2021年03月13日 05:04 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる5

Xilinx Vitis HLS LLVM 2020.2 をやってみる4”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/vitis_hls_examples/override_opt_flow_demo をやってみた。今回は、HLS/vitis_​​hls_examples/ plugin_analyze_rename_flow_demo をやってみよう。

plugin_analyze_rename_flow_demo の説明を、HLS/vitis_hls_examples/ ページの Google 翻訳から引用する。

VitisHLS内でカスタムLLVMオプトパスを呼び出す方法。plugins / example_analyze_renameをビルドする必要があります。ローカルのLLVMビルドは必要ありません。



HLS/vitis_​​hls_examples/ plugin_analyze_rename_flow_demo ディレクトリに行って、中身を確認すると、今までと同様に hls_example.cpp と run_hls.tcl ファイルがあった。
Vitis_HLS_LLVM_55_210312.png

run_hls.tcl ファイルを開けて編集する。
set_part を "artix7" に変更した。
Vitis_HLS_LLVM_56_210312.png

run_hls.tcl ファイルの一部分を引用する。

if { ![info exists ::env(HLS_LLVM_PLUGIN_DIR)] } {
  # Use plugin example directory as default build directory
  set ::env(HLS_LLVM_PLUGIN_DIR) [file normalize ../../plugins/example_analyze_rename]
}
if { ![file exists $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so] } {
  error "Must build LLVMCustomPasses.so before running this example"
}
### The following variable must be set before csynth_design
# Do not use global namespace (::) for variables used in LVM_CUSTOM_CMD
set ::LLVM_CUSTOM_CMD {$LLVM_CUSTOM_OPT -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so -mem2reg -analyzer -renamer $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT}


LLVM_CUSTOM_CMD として LLVM_CUSTOM_OPT を登録して、その実態が LLVMCustomPasses.so で、オプションが -mem2reg -analyzer -renamer ということだろうか?
LLVMCustomPasses.so は、”Xilinx Vitis HLS LLVM 2020.2 をやってみる2”で作製済みだ。

cd ../plugin_analyze_rename_flow_demo/
vitis_hls run_hls.tcl

コマンドを実行した。
Vitis_HLS_LLVM_58_210312.png
Vitis_HLS_LLVM_59_210312.png

実行後は vitis_hls.log と proj ディレクトリが生成されている。
proj ディレクトリは Vitis HLS のプロジェクト・ディレクトリとなっている。
Vitis_HLS_LLVM_60_210312.png

Vitis HLS 2020.2 で proj ディレクトリのプロジェクトを開いた。
Vitis_HLS_LLVM_61_210312.png

Xilinx Vitis HLS LLVM 2020.2 をやってみる4”との違いは見受けられない?けど。。。

C/RTL 協調シミュレーションの結果を示す。
Vitis_HLS_LLVM_61_210312.png

最後に vitis_hls run_hls.tcl のログを貼っておく。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo$ vitis_hls run_hls.tcl 

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Fri Mar 12 03:53:25 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj'.
INFO: [HLS 200-1510] Running: add_files hls_example.cpp 
INFO: [HLS 200-10] Adding design file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: add_files -tb hls_example.cpp 
INFO: [HLS 200-10] Adding test bench file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: set_top example 
INFO: [HLS 200-1510] Running: open_solution -reset solution1 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/solution1.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part artix7 
INFO: [HLS 200-10] Setting target device to 'xc7a12ti-csg325-1L'
INFO: [HLS 200-1510] Running: create_clock -period 300MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.333ns.
INFO: [HLS 200-1510] Running: csim_design 
INFO: [SIM 211-2] *************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
   Compiling ../../../../hls_example.cpp in debug mode
   Generating csim.exe
Test passed.
INFO: [SIM 211-1] CSim done with 0 errors.
INFO: [SIM 211-3] *************** CSIM finish ***************
INFO: [HLS 200-111] Finished Command csim_design CPU user time: 0.84 seconds. CPU system time: 0.24 seconds. Elapsed time: 0.54 seconds; current allocated memory: 163.119 MB.
INFO: [HLS 200-1510] Running: csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 163.302 MB.
INFO: [HLS 200-10] Analyzing design file 'hls_example.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 1.52 seconds. CPU system time: 0.28 seconds. Elapsed time: 1.51 seconds; current allocated memory: 164.903 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so -mem2reg -analyzer -renamer $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.6.user.bc
Loop at depth 1 containing: %2<header><exiting>,%3,%7<latch>
 Backedge Taken Count: 50
II:1
  %4 = load i32, i32* %arrayidx, align 4, !dbg !2252
 Access Pattern: {%a,+,4}<%2>  store i32 %4, i32* %arrayidx1, align 4, !dbg !2255
 Access Pattern: {%buff,+,4}<%2>  %5 = load i32, i32* %arrayidx2, align 4, !dbg !2256
 Access Pattern: {%buff,+,4}<%2>  store i32 %add, i32* %arrayidx3, align 4, !dbg !2259
 Access Pattern: {%buff,+,4}<%2>  %6 = load i32, i32* %arrayidx4, align 4, !dbg !2260
 Access Pattern: {%buff,+,4}<%2>  store i32 %6, i32* %arrayidx5, align 4, !dbg !2262
 Access Pattern: {%b,+,4}<%2>INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
INFO: [HLS 214-115] Multiple burst reads of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'aboba' (hls_example.cpp:31:20)
INFO: [HLS 214-115] Multiple burst writes of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'bboba' (hls_example.cpp:31:20)
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.4 seconds. CPU system time: 0.29 seconds. Elapsed time: 3.73 seconds; current allocated memory: 165.954 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 165.956 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.748 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.02 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.906 MB.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 189.088 MB.
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.04 seconds. CPU system time: 0 seconds. Elapsed time: 0.03 seconds; current allocated memory: 181.710 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'example' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'VITIS_LOOP_31_1'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'VITIS_LOOP_31_1'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 181.992 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.07 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 182.178 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
WARNING: [RTGEN 206-101] Design contains AXI ports. Reset is fixed to synchronous and active low.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/aboba' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/bboba' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on function 'example' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'add_32ns_32ns_32_2_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'add_6ns_6ns_6_1_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'example'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.04 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 183.188 MB.
INFO: [RTMG 210-283] Generating pipelined adder/subtractor : 'example_add_32ns_32ns_32_2_1_Adder_1'
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 1.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 1.05 seconds; current allocated memory: 191.482 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for example.
INFO: [VLOG 209-307] Generating Verilog RTL for example.
INFO: [HLS 200-1603] Design has MAXI bursts and missed bursts, see Vitis HLS GUI synthesis summary report for detailed information.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 411.00 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 6.31 seconds. CPU system time: 0.6 seconds. Elapsed time: 6.69 seconds; current allocated memory: 192.086 MB.
INFO: [HLS 200-1510] Running: cosim_design 
INFO: [COSIM 212-47] Using XSIM for RTL simulation.
INFO: [COSIM 212-14] Instrumenting C test bench ...
   Build using "/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/tps/lnx64/gcc-6.2.0/bin/g++"
   Compiling hls_example.cpp_pre.cpp.tb.cpp
   Compiling apatb_example.cpp
   Compiling apatb_example_ir.ll
   Generating cosim.tv.exe
INFO: [COSIM 212-302] Starting C TB testing ... 
Test passed.
INFO: [COSIM 212-333] Generating C post check test bench ...
INFO: [COSIM 212-12] Generating RTL test bench ...
INFO: [COSIM 212-1] *** C/RTL co-simulation file generation completed. ***
INFO: [COSIM 212-323] Starting verilog simulation. 
INFO: [COSIM 212-15] Starting XSIM ...
Vivado Simulator 2020.2
Copyright 1986-1999, 2001-2020 Xilinx, Inc. All Rights Reserved.
Running: /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vivado/2020.2/bin/unwrapped/lnx64.o/xelab xil_defaultlib.apatb_example_top glbl -prj example.prj -L smartconnect_v1_0 -L axi_protocol_checker_v1_1_12 -L axi_protocol_checker_v1_1_13 -L axis_protocol_checker_v1_1_11 -L axis_protocol_checker_v1_1_12 -L xil_defaultlib -L unisims_ver -L xpm -L floating_point_v7_0_18 -L floating_point_v7_1_11 --lib ieee_proposed=./ieee_proposed -s example 
Multi-threading is on. Using 2 slave threads.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    C_INCLUDE_PATH
    LIBRARY_PATH
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/glbl.v" into library work
INFO: [VRFC 10-311] analyzing module glbl
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_aboba_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_read
INFO: [VRFC 10-311] analyzing module example_aboba_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_bboba.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_bboba
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_add_32ns_32ns_32_2_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1_comb_adder
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.autotb.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module apatb_example_top
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_bboba_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_read
INFO: [VRFC 10-311] analyzing module example_bboba_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_aboba.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_aboba
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example_add_6ns_6ns_6_1_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1_Adder_0
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/sample_manager.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/sample_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_fifo_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/dump_file_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_monitor.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_process_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/dataflow_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [nodf_module_interface.sv:4]
INFO: [VRFC 10-311] analyzing module dataflow_monitor
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/csv_file_dump.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_process_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/df_fifo_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling package xil_defaultlib.$unit_dataflow_monitor_sv
Compiling module xil_defaultlib.example_aboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DEPTH=5...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_aboba_m_axi_write(NUM_WR...
Compiling module xil_defaultlib.example_aboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_aboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_aboba_m_axi_read(NUM_REA...
Compiling module xil_defaultlib.example_aboba_m_axi_throttle(ADD...
Compiling module xil_defaultlib.example_aboba_m_axi(NUM_READ_OUT...
Compiling module xil_defaultlib.example_bboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DEPTH=5...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_fifo(DATA_BI...
Compiling module xil_defaultlib.example_bboba_m_axi_write(NUM_WR...
Compiling module xil_defaultlib.example_bboba_m_axi_buffer(DATA_...
Compiling module xil_defaultlib.example_bboba_m_axi_reg_slice(N=...
Compiling module xil_defaultlib.example_bboba_m_axi_read(NUM_REA...
Compiling module xil_defaultlib.example_bboba_m_axi_throttle(ADD...
Compiling module xil_defaultlib.example_bboba_m_axi(NUM_READ_OUT...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1_Adder_...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1(ID=1,N...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1(ID=...
Compiling module xil_defaultlib.example
Compiling module xil_defaultlib.AESL_axi_master_aboba
Compiling module xil_defaultlib.AESL_axi_master_bboba
Compiling module xil_defaultlib.nodf_module_intf
Compiling module xil_defaultlib.dataflow_monitor_1
Compiling module xil_defaultlib.apatb_example_top
Compiling module work.glbl
Built simulation snapshot example

****** Webtalk v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/xsim.dir/example/webtalk/xsim_webtalk.tcl -notrace
INFO: [Common 17-206] Exiting Webtalk at Fri Mar 12 03:53:47 2021...

****** xsim v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source xsim.dir/example/xsim_script.tcl
# xsim {example} -autoloadwcfg -tclbatch {example.tcl}
Vivado Simulator 2020.2
Time resolution is 1 ps
source example.tcl
## run all
////////////////////////////////////////////////////////////////////////////////////
// Inter-Transaction Progress: Completed Transaction / Total Transaction
// Intra-Transaction Progress: Measured Latency / Latency Estimation * 100%
//
// RTL Simulation : "Inter-Transaction Progress" ["Intra-Transaction Progress"] @ "Simulation Time"
////////////////////////////////////////////////////////////////////////////////////
// RTL Simulation : 0 / 1 [0.00%] @ "109000"
// RTL Simulation : 1 / 1 [100.00%] @ "362000"
////////////////////////////////////////////////////////////////////////////////////
$finish called at time : 375750 ps : File "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/sim/verilog/example.autotb.v" Line 462
## quit
INFO: [Common 17-206] Exiting xsim at Fri Mar 12 03:53:57 2021...
INFO: [COSIM 212-316] Starting C post checking ...
Test passed.
INFO: [COSIM 212-1000] *** C/RTL co-simulation finished: PASS ***
INFO: [COSIM 212-211] II is measurable only when transaction number is greater than 1 in RTL simulation. Otherwise, they will be marked as all NA. If user wants to calculate them, please make sure there are at least 2 transactions in RTL simulation.
INFO: [HLS 200-111] Finished Command cosim_design CPU user time: 23.04 seconds. CPU system time: 1.37 seconds. Elapsed time: 22.85 seconds; current allocated memory: 196.223 MB.
INFO: [HLS 200-112] Total CPU user time: 32.18 seconds. Total CPU system time: 2.64 seconds. Total elapsed time: 32.14 seconds; peak allocated memory: 191.482 MB.
INFO: [Common 17-206] Exiting vitis_hls at Fri Mar 12 03:53:57 2021...


ログのこの辺りで LLVM_CUSTOM_OPT が使われているようだ。

INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -load $::env(HLS_LLVM_PLUGIN_DIR)/LLVMCustomPasses.so -mem2reg -analyzer -renamer $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/lnx64/tools/clang-3.9-csynth/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/plugin_analyze_rename_flow_demo/proj/solution1/.autopilot/db/a.g.ld.6.user.bc
Loop at depth 1 containing: %2<header><exiting>,%3,%7<latch>
 Backedge Taken Count: 50
II:1
  %4 = load i32, i32* %arrayidx, align 4, !dbg !2252
 Access Pattern: {%a,+,4}<%2>  store i32 %4, i32* %arrayidx1, align 4, !dbg !2255
 Access Pattern: {%buff,+,4}<%2>  %5 = load i32, i32* %arrayidx2, align 4, !dbg !2256
 Access Pattern: {%buff,+,4}<%2>  store i32 %add, i32* %arrayidx3, align 4, !dbg !2259
 Access Pattern: {%buff,+,4}<%2>  %6 = load i32, i32* %arrayidx4, align 4, !dbg !2260
 Access Pattern: {%buff,+,4}<%2>  store i32 %6, i32* %arrayidx5, align 4, !dbg !2262
 Access Pattern: {%b,+,4}<%2>INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.

  1. 2021年03月12日 04:33 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる4

Xilinx Vitis HLS LLVM 2020.2 をやってみる3”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、、HLS/vitis_hls_examples/ ディレクトリの override_llvm_flow_demo をやってみた。ここでは、VitisHLS内でローカルLLVMビルドを使用してソースコードを合成した。今回は、HLS/vitis_hls_examples/override_opt_flow_demo をやってみよう。

override_opt_flow_demo の説明を、HLS/vitis_hls_examples/ ページの Google 翻訳から引用する。

VitisHLS内でローカルLLVMoptバイナリを使用する方法。



/HLS/vitis_hls_examples/override_opt_flow_demo ディレクトリに行って、内容を確認しよう。
hls_example.cpp と run_hls.tcl ファイルがある。
Vitis_HLS_LLVM_44_210310.png

run_hls.tcl を見てみよう。
set_part が Virtex7 だった。Virtex7 のライセンスは無いので、artix7 に変更した。

set ::LLVM_CUSTOM_OPT [pwd]/../../llvm/hls-build/bin/opt

で、ローカルの LLVM opt を指定した。

set ::LLVM_CUSTOM_CMD {$LLVM_CUSTOM_OPT -mem2reg -dce $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT}

で、$LLVM_CUSTOM_OPT でローカルの LLVM opt を指定し、$LLVM_CUSTOM_INPUT で入力bcファイルのファイルパスを指定し、 $LLVM_CUSTOM_OUTPUT で出力bcファイルのファイルパスを指定している。なお、

LVM_CUSTOM_CMDで使用される変数にグローバル名前空間(::)を使用しないでください

とのことだ。
Vitis_HLS_LLVM_45_210310.png

vitis_hls run_hls.tcl
を実行した。
Vitis_HLS_LLVM_46_210310.png
Vitis_HLS_LLVM_47_210310.png

Vitis HLS のプロジェクトの proj ディレクトリと vitis_hls.log が生成された。

Vitis HLS GUI を立ち上げて、proj ディレクトリを読み込んだ。
Vitis_HLS_LLVM_48_210310.png

C/RTL 協調シミュレーションを行った。
ダイアログで、Dump Trace を all に設定した。
Vitis_HLS_LLVM_50_210311.png

C/RTL 協調シミュレーションが終了した。
Vitis_HLS_LLVM_51_210311.png

C/RTL 協調シミュレーションの波形を示す。
まずは、DMA Read から示す。
Vitis_HLS_LLVM_52_210311.png

DMA Write の波形を示す。
Vitis_HLS_LLVM_53_210311.png

Export RTL を行った。結果を示す。
Vitis_HLS_LLVM_54_210311.png

Timing Error になっている。

最後に、実行ログを示す。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo$ vitis_hls run_hls.tcl 

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Wed Mar 10 03:34:58 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj'.
INFO: [HLS 200-1510] Running: add_files hls_example.cpp 
INFO: [HLS 200-10] Adding design file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: add_files -tb hls_example.cpp 
INFO: [HLS 200-10] Adding test bench file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: set_top example 
INFO: [HLS 200-1510] Running: open_solution -reset solution1 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/solution1.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part artix7 
INFO: [HLS 200-10] Setting target device to 'xc7a12ti-csg325-1L'
INFO: [HLS 200-1510] Running: create_clock -period 300MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.333ns.
INFO: [HLS 200-1510] Running: csim_design 
INFO: [SIM 211-2] *************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
   Compiling ../../../../hls_example.cpp in debug mode
   Generating csim.exe
Test passed.
INFO: [SIM 211-1] CSim done with 0 errors.
INFO: [SIM 211-3] *************** CSIM finish ***************
INFO: [HLS 200-111] Finished Command csim_design CPU user time: 0.74 seconds. CPU system time: 0.19 seconds. Elapsed time: 0.46 seconds; current allocated memory: 163.116 MB.
INFO: [HLS 200-1510] Running: csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 163.314 MB.
INFO: [HLS 200-10] Analyzing design file 'hls_example.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 1.65 seconds. CPU system time: 0.22 seconds. Elapsed time: 2.13 seconds; current allocated memory: 164.915 MB.
INFO: [HLS 200-1022] Execute customized passes: $LLVM_CUSTOM_OPT -mem2reg -dce $LLVM_CUSTOM_INPUT -o $LLVM_CUSTOM_OUTPUT
      LLVM_CUSTOM_OPT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/../../llvm/hls-build/bin/opt
      LLVM_CUSTOM_INPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/.autopilot/db/a.g.ld.5.gdce.bc
      LLVM_CUSTOM_OUTPUT:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/.autopilot/db/a.g.ld.6.user.bc
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
INFO: [HLS 214-115] Multiple burst reads of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'a' (hls_example.cpp:31:20)
INFO: [HLS 214-115] Multiple burst writes of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'b' (hls_example.cpp:31:20)
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.54 seconds. CPU system time: 0.3 seconds. Elapsed time: 5.1 seconds; current allocated memory: 165.936 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 165.937 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.01 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.731 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.02 seconds. CPU system time: 0 seconds. Elapsed time: 0.02 seconds; current allocated memory: 167.905 MB.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.06 seconds. CPU system time: 0 seconds. Elapsed time: 0.06 seconds; current allocated memory: 189.069 MB.
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.03 seconds. CPU system time: 0 seconds. Elapsed time: 0.04 seconds; current allocated memory: 181.703 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'example' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'VITIS_LOOP_31_1'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'VITIS_LOOP_31_1'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.04 seconds; current allocated memory: 181.970 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.07 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 182.169 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
WARNING: [RTGEN 206-101] Design contains AXI ports. Reset is fixed to synchronous and active low.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/a' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/b' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on function 'example' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'add_32ns_32ns_32_2_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'add_6ns_6ns_6_1_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'example'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.03 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.04 seconds; current allocated memory: 183.140 MB.
INFO: [RTMG 210-283] Generating pipelined adder/subtractor : 'example_add_32ns_32ns_32_2_1_Adder_1'
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 1.01 seconds. CPU system time: 0.02 seconds. Elapsed time: 1.06 seconds; current allocated memory: 191.461 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for example.
INFO: [VLOG 209-307] Generating Verilog RTL for example.
INFO: [HLS 200-1603] Design has MAXI bursts and missed bursts, see Vitis HLS GUI synthesis summary report for detailed information.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 411.00 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 6.56 seconds. CPU system time: 0.57 seconds. Elapsed time: 8.68 seconds; current allocated memory: 192.049 MB.
INFO: [HLS 200-1510] Running: cosim_design 
INFO: [COSIM 212-47] Using XSIM for RTL simulation.
INFO: [COSIM 212-14] Instrumenting C test bench ...
   Build using "/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/tps/lnx64/gcc-6.2.0/bin/g++"
   Compiling hls_example.cpp_pre.cpp.tb.cpp
   Compiling apatb_example.cpp
   Compiling apatb_example_ir.ll
   Generating cosim.tv.exe
INFO: [COSIM 212-302] Starting C TB testing ... 
Test passed.
INFO: [COSIM 212-333] Generating C post check test bench ...
INFO: [COSIM 212-12] Generating RTL test bench ...
INFO: [COSIM 212-1] *** C/RTL co-simulation file generation completed. ***
INFO: [COSIM 212-323] Starting verilog simulation. 
INFO: [COSIM 212-15] Starting XSIM ...
Vivado Simulator 2020.2
Copyright 1986-1999, 2001-2020 Xilinx, Inc. All Rights Reserved.
Running: /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vivado/2020.2/bin/unwrapped/lnx64.o/xelab xil_defaultlib.apatb_example_top glbl -prj example.prj -L smartconnect_v1_0 -L axi_protocol_checker_v1_1_12 -L axi_protocol_checker_v1_1_13 -L axis_protocol_checker_v1_1_11 -L axis_protocol_checker_v1_1_12 -L xil_defaultlib -L unisims_ver -L xpm -L floating_point_v7_0_18 -L floating_point_v7_1_11 --lib ieee_proposed=./ieee_proposed -s example 
Multi-threading is on. Using 2 slave threads.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    C_INCLUDE_PATH
    LIBRARY_PATH
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/glbl.v" into library work
INFO: [VRFC 10-311] analyzing module glbl
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_a.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_a
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example_b_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_b_m_axi
INFO: [VRFC 10-311] analyzing module example_b_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_b_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_b_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_b_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_b_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_b_m_axi_read
INFO: [VRFC 10-311] analyzing module example_b_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example_add_32ns_32ns_32_2_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1_comb_adder
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example_a_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_a_m_axi
INFO: [VRFC 10-311] analyzing module example_a_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_a_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_a_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_a_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_a_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_a_m_axi_read
INFO: [VRFC 10-311] analyzing module example_a_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example.autotb.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module apatb_example_top
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example_add_6ns_6ns_6_1_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1_Adder_0
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_b.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_b
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/sample_manager.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/sample_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/df_fifo_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/dump_file_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/nodf_module_monitor.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/df_process_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/dataflow_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [nodf_module_interface.sv:4]
INFO: [VRFC 10-311] analyzing module dataflow_monitor
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/csv_file_dump.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/df_process_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/df_fifo_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling package xil_defaultlib.$unit_dataflow_monitor_sv
Compiling module xil_defaultlib.example_a_m_axi_reg_slice(N=96)
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=9...
Compiling module xil_defaultlib.example_a_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DEPTH=5,DEP...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_a_m_axi_write(NUM_WRITE_...
Compiling module xil_defaultlib.example_a_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_a_m_axi_reg_slice(N=34)
Compiling module xil_defaultlib.example_a_m_axi_read(NUM_READ_OU...
Compiling module xil_defaultlib.example_a_m_axi_throttle(ADDR_WI...
Compiling module xil_defaultlib.example_a_m_axi(NUM_READ_OUTSTAN...
Compiling module xil_defaultlib.example_b_m_axi_reg_slice(N=96)
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=9...
Compiling module xil_defaultlib.example_b_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DEPTH=5,DEP...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_b_m_axi_write(NUM_WRITE_...
Compiling module xil_defaultlib.example_b_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_b_m_axi_reg_slice(N=34)
Compiling module xil_defaultlib.example_b_m_axi_read(NUM_READ_OU...
Compiling module xil_defaultlib.example_b_m_axi_throttle(ADDR_WI...
Compiling module xil_defaultlib.example_b_m_axi(NUM_READ_OUTSTAN...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1_Adder_...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1(ID=1,N...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1(ID=...
Compiling module xil_defaultlib.example
Compiling module xil_defaultlib.AESL_axi_master_a
Compiling module xil_defaultlib.AESL_axi_master_b
Compiling module xil_defaultlib.nodf_module_intf
Compiling module xil_defaultlib.dataflow_monitor_1
Compiling module xil_defaultlib.apatb_example_top
Compiling module work.glbl
Built simulation snapshot example

****** Webtalk v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/xsim.dir/example/webtalk/xsim_webtalk.tcl -notrace
INFO: [Common 17-206] Exiting Webtalk at Wed Mar 10 03:35:22 2021...

****** xsim v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source xsim.dir/example/xsim_script.tcl
# xsim {example} -autoloadwcfg -tclbatch {example.tcl}
Vivado Simulator 2020.2
Time resolution is 1 ps
source example.tcl
## run all
////////////////////////////////////////////////////////////////////////////////////
// Inter-Transaction Progress: Completed Transaction / Total Transaction
// Intra-Transaction Progress: Measured Latency / Latency Estimation * 100%
//
// RTL Simulation : "Inter-Transaction Progress" ["Intra-Transaction Progress"] @ "Simulation Time"
////////////////////////////////////////////////////////////////////////////////////
// RTL Simulation : 0 / 1 [0.00%] @ "109000"
// RTL Simulation : 1 / 1 [100.00%] @ "362000"
////////////////////////////////////////////////////////////////////////////////////
$finish called at time : 375750 ps : File "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_opt_flow_demo/proj/solution1/sim/verilog/example.autotb.v" Line 462
## quit
INFO: [Common 17-206] Exiting xsim at Wed Mar 10 03:35:31 2021...
INFO: [COSIM 212-316] Starting C post checking ...
Test passed.
INFO: [COSIM 212-1000] *** C/RTL co-simulation finished: PASS ***
INFO: [COSIM 212-211] II is measurable only when transaction number is greater than 1 in RTL simulation. Otherwise, they will be marked as all NA. If user wants to calculate them, please make sure there are at least 2 transactions in RTL simulation.
INFO: [HLS 200-111] Finished Command cosim_design CPU user time: 22.84 seconds. CPU system time: 1.14 seconds. Elapsed time: 22.49 seconds; current allocated memory: 196.155 MB.
INFO: [HLS 200-112] Total CPU user time: 32.16 seconds. Total CPU system time: 2.33 seconds. Total elapsed time: 33.54 seconds; peak allocated memory: 191.461 MB.
INFO: [Common 17-206] Exiting vitis_hls at Wed Mar 10 03:35:32 2021...

  1. 2021年03月11日 04:09 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

PIC16F1825 の使い方2(USART の設定)

PIC16F1825 の使い方1(32MHz クロックとポートの設定)”の続き。

PIC マイコンの PIC16F1825 を使うことになったので、使い方の覚書を書いておく。
今回は、USART つまり UART の設定について書いておく。

PIC16F1825 は秋月電子で販売しているそのマニュアルがこちら。

また、ほぼ互換品の”PIC12(L)F1822/PIC16(L)F1823 データ シート”日本語資料が Microchip にある。

SPBRGL レジスタの SYNC=0, BRGH=1、BAUDCON レジスタの BRG16=0: 8bit counter の時のボーレートの計算式は、

Fosc/(16 * (n + 1)) = 32000000 / (16 * (3 + 1)) = 500000 bps = 500 kbps


USART の設定

// UART
BAUDCON = 0; // BRG16=0: 8bit counter mode
SPBRGL = 3; // SYNC=0, BRGH=1, BRG16=0, 500000bps
TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
RCSTA = 0b10010000; // SPEN=1, CREN=1
// USART 割り込みありの場合
RCIE = 1;
RCIF = 0;
PEIE = 1;
GIE = 1;


SPEN:シリアルポート・イネーブル 1 - シリアルポートを有効にする
CREN:連続受信イネーブルビット 1 - レシーバーを有効にする
PIE1: 周辺機能割り込みイネーブル レジスタ 1  bit 5  RCIE: USART 受信割り込みイネーブルビット
PIR1: 周辺機能割り込み要求レジスタ 1    bit 5  RCIF: USART 受信割り込みフラグビット 1 - 受信割り込みを保留中
INTCON: 割り込み制御レジスタ        bit 6  PEIE: 周辺機能割り込みイネーブルビット 1 - 全てのアクティブな周辺機能割り込みを有効にする
                     bit 7  GIE: グローバル割り込みイネーブルビット

USART の TX と RX は 2 種類のピン・アサインをすることができる。
TX ー RC4、 RA0
RX ー RC5、 RA1

RC4, RC5 の組になるか、RA0, RA1 の組になるかは APFCON レジスタの値できまる。リセット後のピン・アサインは RC4, RC5 になっているので、それを使用する。
RC5 が USART の RX に割り当たるため TRISC の bit 5 を 1 (入力)にしている。

割り込みを使用しない場合のTX - RX ループバック・テスト
0x55 を送信して、受信したら +1 して、0x56 を送信するソフトウェア(割り込み無し)

/* * File:   acc3_uart.c * Author: ono * * Created on 2021/02/03, 11:09 */

#include <xc.h>

#pragma config FOSC = INTOSC
#pragma config LVP = OFF
#pragma config PWRTE = ON

unsigned char chr;
unsigned int n = 0;

void Delay(unsigned int m)
{
    for(n=0;n<m;n++);        //Delay
}

void main( void )
{
    OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
    OSCTUNE = 0x00;
    
    TRISA = 0;
    TRISC = 0x23// SCL, SDA, UART RX is input setting.
    ANSELA = 0;
    ANSELC = 0;

    //I2C
    SSP1ADD   = 0x13;        //speed 400KHz
    SSP1STAT = 0b00000000; // 400kHz
    SSP1CON1 = 0b00101000;    //SSP1EN=1, Master mode
    SSP1CON2 = 0b00000000;

        // UART
    BAUDCON = 0// BRG16=0: 8bit counter mode
    SPBRGL = 3// SYNC=0, BRGH=1, BRG16=0, 500000bps
    TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
    RCSTA = 0b10010000; // SPEN=1, CREN=1
        //INTCON = 0b11000000; // GIE=1, PEIE=1

     while(1){
        while(TRMT == 0);
        TXREG = 0x55;
        
        while(RCIF == 0);
        RCIF = 0;
        chr = RCREG;
              
        //Delay(10);
        
        while(TRMT == 0);
        TXREG = chr + 1;

        while(RCIF == 0);
        RCIF = 0;
        chr = RCREG;
       
        Delay(50);
    }
}


割り込みを使用した場合のTX - RX ループバック・テスト
0x55 を送信して、受信したら +1 して、0x56 を送信のソフトウェア(割り込みあり)

/* * File:   acc3_uart.c * Author: ono * * Created on 2021/02/03, 11:09 */

#include <xc.h>

#pragma config FOSC = INTOSC
#pragma config LVP = OFF
#pragma config PWRTE = ON

unsigned char chr;
unsigned int n = 0;

void Delay(unsigned int m)
{
    for(n=0;n<m;n++);        //Delay
}

void main( void )
{
    OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
    OSCTUNE = 0x00;
    
    TRISA = 0;
    TRISC = 0x23// SCL, SDA, UART RX is input setting.
    ANSELA = 0;
    ANSELC = 0;

    //I2C
    SSP1ADD   = 0x13;        //speed 400KHz
    SSP1STAT = 0b00000000; // 400kHz
    SSP1CON1 = 0b00101000;    //SSP1EN=1, Master mode
    SSP1CON2 = 0b00000000;

    // UART
    BAUDCON = 0// BRG16=0: 8bit counter mode
    SPBRGL = 3// SYNC=0, BRGH=1, BRG16=0, 500000bps
    TXSTA = 0b00100100; // TXEN=1, SYNC=0, BRGH=1
    RCSTA = 0b10010000; // SPEN=1, CREN=1
    //INTCON = 0b11000000; // GIE=1, PEIE=1
    RCIE = 1;
    RCIF = 0;
    PEIE = 1;
    GIE = 1;

     while(1){
        while(TRMT == 0);
        TXREG = 0x55;
        
        Delay(50);
    }
}

void interrupt RX_int(void){
    if(RCIF == 1){
        RCIF = 0;
        chr = RCREG;
        if(RCREG != 0x55)
            return;
              
        while(TRMT == 0);
        TXREG = chr + 1;
    }
}


  1. 2021年03月10日 20:59 |
  2. PIC
  3. | トラックバック:0
  4. | コメント:0

PIC16F1825 の使い方1(32MHz クロックとポートの設定)

PIC マイコンの PIC16F1825 を使うことになったので、使い方の覚書を書いておく。
なお PIC マイコンは、3軸加速度センターのデータを I2C で取得して、それを USART で RS-422 に変換して ZYBO Z7-20 に伝送するために使用する。
今回は、32 MHz クロックの設定とポートの設定を書いておく。

PIC16F1825 は秋月電子で販売しているそのマニュアルがこちら。

また、ほぼ互換品の”PIC12(L)F1822/PIC16(L)F1823 データ シート”日本語資料が Microchip にある。

PIC のツールだが純正品の MPLAB X IDE v5.40 を使用している。
まずはクロックだが、最大の 32 MHz クロックを使用している。

#pragma config FOSC = INTOSC

OSCCON = 0b11110000; // 4x PLL enable, 8MHz or 32MHz, FOSC
OSCTUNE = 0x00;

”サヌキテックネットPICマイコン Lab.第4章 PICA Tower(ピカタワー)で学ぶ4-12.レジスターの設定”参照。

TRISA = 0;
TRISC = 0x23; // SCL, SDA, UART RX is input setting.
ANSELA = 0;
ANSELC = 0;

ポートはAポートとCポートがある。
TRISA、TRISC は入出力切り替えで 1 が入力で、0 が出力。
電子回路初心者によるPICマイコン入門 TRISAレジスタ”参照。

ANSELA、ANSELC はデジタル/アナログ設定 0 がデジタルで、1 がアナログ。
  1. 2021年03月10日 20:55 |
  2. PIC
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる3

Xilinx Vitis HLS LLVM 2020.2 をやってみる2”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/plugins ディレクトリ以下の 2 つのプラグインをビルドした。今回は、HLS/vitis_hls_examples/ ディレクトリの override_llvm_flow_demo をやってみよう。

override_llvm_flow_demo の説明を、HLS/vitis_hls_examples/ ページの Google 翻訳から引用する。

”VitisHLS内でローカルLLVMビルドを使用する方法。ローカルLLVMは、clangフェーズとoptフェーズの両方に使用されます。”

それではやってみよう。

/HLS/vitis_hls_examples/override_llvm_flow_demo ディレクトリに行って、内容を確認しよう。
hls_example.cpp と run_hls.tcl ファイルがある。
Vitis_HLS_LLVM_36_210309.png

run_hls.tcl を見てみよう。
set_part が Virtex7 だった。Virtex7 のライセンスは無いので、artix7 に変更した。
XILINX_OPEN_SOURCE_LLVM_BUILD_PATH を "[pwd]/../../llvm/hls-build" に設定しているようだ。
Vitis_HLS_LLVM_37_210309.png

vitis_hls run_hls.tcl
を実行した。
Vitis_HLS_LLVM_38_210309.png

override_llvm_flow_demo ディレクトリには、proj ディレクトリが作成されていた。proj ディレクトリの中に hls.app があったので、Vitis HLS のプロジェクトのようだ。
Vitis HLS 2020.2 を立ち上げて proj プロジェクトを読み込んだ。
Vitis_HLS_LLVM_39_210309.png

次に、本当にローカルLLVMビルドを使用しているかどうか?を確かめるために、HLS/llvm ディレクトリから hls-build ディレクトリを移動した。
Vitis_HLS_LLVM_40_210309.png

/HLS/vitis_hls_examples/override_llvm_flow_demo ディレクトリのファイルを再び、hls_example.cpp と run_hls.tcl ファイルだけにして、
vitis_hls run_hls.tcl
を実行した。
すると、エラーで止まってしまう。
やはり、hls-build ディレクトリを使用しているようだ。
Vitis_HLS_LLVM_41_210309.png
Vitis_HLS_LLVM_42_210309.png

HLS/llvm ディレクトリに hls-build ディレクトリを戻した。
vitis_hls run_hls.tcl
を実行すると、成功するので、確かにローカルの LLVM ビルドを使用しているようだ。
Vitis_HLS_LLVM_43_210309.png

最後に、実行ログを示す。

masaaki@masaaki-H110M4-M01:/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo$ vitis_hls run_hls.tcl

****** Vitis HLS - High-Level Synthesis from C, C++ and OpenCL v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/scripts/vitis_hls/hls.tcl -notrace
INFO: [HLS 200-10] Running '/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/bin/unwrapped/lnx64.o/vitis_hls'
INFO: [HLS 200-10] For user 'masaaki' on host 'masaaki-H110M4-M01' (Linux_x86_64 version 4.15.0-136-generic) on Tue Mar 09 20:31:58 JST 2021
INFO: [HLS 200-10] On os Ubuntu 18.04.5 LTS
INFO: [HLS 200-10] In directory '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo'
WARNING: [HLS 200-40] Environment variable 'C_INCLUDE_PATH' is set to :/usr/local/cuda/include.
Sourcing Tcl script 'run_hls.tcl'
INFO: [HLS 200-1510] Running: open_project -reset proj 
INFO: [HLS 200-10] Creating and opening project '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj'.
INFO: [HLS 200-1510] Running: add_files hls_example.cpp 
INFO: [HLS 200-10] Adding design file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: add_files -tb hls_example.cpp 
INFO: [HLS 200-10] Adding test bench file 'hls_example.cpp' to the project
INFO: [HLS 200-1510] Running: set_top example 
INFO: [HLS 200-1510] Running: open_solution -reset solution1 
INFO: [HLS 200-10] Creating and opening solution '/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1'.
INFO: [HLS 200-10] Cleaning up the solution database.
WARNING: [HLS 200-40] No /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/solution1.aps file found.
INFO: [HLS 200-1505] Using default flow_target 'vivado'
Resolution: For help on HLS 200-1505 see www.xilinx.com/cgi-bin/docs/rdoc?v=2020.2;t=hls+guidance;d=200-1505.html
INFO: [HLS 200-1510] Running: set_part artix7 
INFO: [HLS 200-10] Setting target device to 'xc7a12ti-csg325-1L'
INFO: [HLS 200-1510] Running: create_clock -period 300MHz 
INFO: [SYN 201-201] Setting up clock 'default' with a period of 3.333ns.
INFO: [HLS 200-1510] Running: csim_design 
INFO: [SIM 211-2] *************** CSIM start ***************
INFO: [SIM 211-4] CSIM will launch GCC as the compiler.
   Compiling ../../../../hls_example.cpp in debug mode
   Generating csim.exe
Test passed.
INFO: [SIM 211-1] CSim done with 0 errors.
INFO: [SIM 211-3] *************** CSIM finish ***************
INFO: [HLS 200-111] Finished Command csim_design CPU user time: 0.44 seconds. CPU system time: 0.14 seconds. Elapsed time: 1.77 seconds; current allocated memory: 179.122 MB.
INFO: [HLS 200-1510] Running: csynth_design 
INFO: [HLS 200-111] Finished File checks and directory preparation: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0.01 seconds; current allocated memory: 179.289 MB.
INFO: [HLS 200-10] Analyzing design file 'hls_example.cpp' ... 
INFO: [HLS 200-111] Finished Source Code Analysis and Preprocessing: CPU user time: 19.15 seconds. CPU system time: 0.4 seconds. Elapsed time: 24.69 seconds; current allocated memory: 180.886 MB.
INFO: [HLS 200-777] Using interface defaults for 'Vivado' flow target.
WARNING: [HLS 207-586] overriding the module target triple with fpga64-xilinx-none
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
WARNING: [HLS 214-205] The INTERFACE pragma must have a max_widen_bitwidth setting that is both a power of 2 and in the range [0, 1024]. The current value of '0' will be ignored, in 'example(int*, int*)' (hls_example.cpp:27:0)
INFO: [HLS 214-115] Multiple burst reads of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'a' (hls_example.cpp:31:20)
INFO: [HLS 214-115] Multiple burst writes of length 50 and bit width 32 in loop 'VITIS_LOOP_31_1'(hls_example.cpp:31:20) has been inferred on port 'b' (hls_example.cpp:31:20)
INFO: [HLS 200-111] Finished Compiling Optimization and Transform: CPU user time: 3.51 seconds. CPU system time: 0.32 seconds. Elapsed time: 4.7 seconds; current allocated memory: 181.986 MB.
INFO: [HLS 200-111] Finished Checking Pragmas: CPU user time: 0 seconds. CPU system time: 0 seconds. Elapsed time: 0 seconds; current allocated memory: 181.987 MB.
INFO: [HLS 200-10] Starting code transformations ...
INFO: [HLS 200-111] Finished Standard Transforms: CPU user time: 0.06 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.45 seconds; current allocated memory: 183.780 MB.
INFO: [HLS 200-10] Checking synthesizability ...
INFO: [HLS 200-111] Finished Checking Synthesizability: CPU user time: 0.04 seconds. CPU system time: 0 seconds. Elapsed time: 0.07 seconds; current allocated memory: 183.954 MB.
INFO: [HLS 200-111] Finished Loop, function and other optimizations: CPU user time: 0.08 seconds. CPU system time: 0 seconds. Elapsed time: 0.08 seconds; current allocated memory: 205.119 MB.
INFO: [HLS 200-111] Finished Architecture Synthesis: CPU user time: 0.05 seconds. CPU system time: 0 seconds. Elapsed time: 0.08 seconds; current allocated memory: 197.771 MB.
INFO: [HLS 200-10] Starting hardware synthesis ...
INFO: [HLS 200-10] Synthesizing 'example' ...
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-42] -- Implementing module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [SCHED 204-11] Starting scheduling ...
INFO: [SCHED 204-61] Pipelining loop 'VITIS_LOOP_31_1'.
INFO: [HLS 200-1470] Pipelining result : Target II = 1, Final II = 1, Depth = 5, loop 'VITIS_LOOP_31_1'
INFO: [SCHED 204-11] Finished scheduling.
INFO: [HLS 200-111] Finished Scheduling: CPU user time: 0.08 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.15 seconds; current allocated memory: 198.036 MB.
INFO: [BIND 205-100] Starting micro-architecture generation ...
INFO: [BIND 205-101] Performing variable lifetime analysis.
INFO: [BIND 205-101] Exploring resource sharing.
INFO: [BIND 205-101] Binding ...
INFO: [BIND 205-100] Finished micro-architecture generation.
INFO: [HLS 200-111] Finished Binding: CPU user time: 0.08 seconds. CPU system time: 0 seconds. Elapsed time: 0.09 seconds; current allocated memory: 198.209 MB.
INFO: [HLS 200-10] ----------------------------------------------------------------
INFO: [HLS 200-10] -- Generating RTL for module 'example' 
INFO: [HLS 200-10] ----------------------------------------------------------------
WARNING: [RTGEN 206-101] Design contains AXI ports. Reset is fixed to synchronous and active low.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/a' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on port 'example/b' to 'm_axi'.
INFO: [RTGEN 206-500] Setting interface mode on function 'example' to 'ap_ctrl_hs'.
INFO: [RTGEN 206-100] Generating core module 'add_32ns_32ns_32_2_1': 1 instance(s).
INFO: [RTGEN 206-100] Generating core module 'add_6ns_6ns_6_1_1': 1 instance(s).
INFO: [RTGEN 206-100] Finished creating RTL model for 'example'.
INFO: [HLS 200-111] Finished Creating RTL model: CPU user time: 0.04 seconds. CPU system time: 0.01 seconds. Elapsed time: 0.07 seconds; current allocated memory: 199.179 MB.
INFO: [RTMG 210-283] Generating pipelined adder/subtractor : 'example_add_32ns_32ns_32_2_1_Adder_1'
INFO: [HLS 200-111] Finished Generating all RTL models: CPU user time: 1.07 seconds. CPU system time: 0.03 seconds. Elapsed time: 1.3 seconds; current allocated memory: 207.484 MB.
INFO: [VHDL 208-304] Generating VHDL RTL for example.
INFO: [VLOG 209-307] Generating Verilog RTL for example.
INFO: [HLS 200-1603] Design has MAXI bursts and missed bursts, see Vitis HLS GUI synthesis summary report for detailed information.
INFO: [HLS 200-790] **** Loop Constraint Status: All loop constraints were satisfied.
INFO: [HLS 200-789] **** Estimated Fmax: 411.00 MHz
INFO: [HLS 200-111] Finished Command csynth_design CPU user time: 24.25 seconds. CPU system time: 0.78 seconds. Elapsed time: 31.77 seconds; current allocated memory: 208.072 MB.
INFO: [HLS 200-1510] Running: cosim_design 
INFO: [COSIM 212-47] Using XSIM for RTL simulation.
INFO: [COSIM 212-14] Instrumenting C test bench ...
   Build using "/media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis_HLS/2020.2/tps/lnx64/gcc-6.2.0/bin/g++"
   Compiling hls_example.cpp_pre.cpp.tb.cpp
   Compiling apatb_example.cpp
   Compiling apatb_example_ir.ll
   Generating cosim.tv.exe
INFO: [COSIM 212-302] Starting C TB testing ... 
Test passed.
INFO: [COSIM 212-333] Generating C post check test bench ...
INFO: [COSIM 212-12] Generating RTL test bench ...
INFO: [COSIM 212-1] *** C/RTL co-simulation file generation completed. ***
INFO: [COSIM 212-323] Starting verilog simulation. 
INFO: [COSIM 212-15] Starting XSIM ...
Vivado Simulator 2020.2
Copyright 1986-1999, 2001-2020 Xilinx, Inc. All Rights Reserved.
Running: /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vivado/2020.2/bin/unwrapped/lnx64.o/xelab xil_defaultlib.apatb_example_top glbl -prj example.prj -L smartconnect_v1_0 -L axi_protocol_checker_v1_1_12 -L axi_protocol_checker_v1_1_13 -L axis_protocol_checker_v1_1_11 -L axis_protocol_checker_v1_1_12 -L xil_defaultlib -L unisims_ver -L xpm -L floating_point_v7_0_18 -L floating_point_v7_1_11 --lib ieee_proposed=./ieee_proposed -s example 
Multi-threading is on. Using 2 slave threads.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    C_INCLUDE_PATH
    LIBRARY_PATH
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/glbl.v" into library work
INFO: [VRFC 10-311] analyzing module glbl
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_a.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_a
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example_b_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_b_m_axi
INFO: [VRFC 10-311] analyzing module example_b_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_b_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_b_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_b_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_b_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_b_m_axi_read
INFO: [VRFC 10-311] analyzing module example_b_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example_add_32ns_32ns_32_2_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1_Adder_1_comb_adder
INFO: [VRFC 10-311] analyzing module example_add_32ns_32ns_32_2_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example_a_m_axi.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_a_m_axi
INFO: [VRFC 10-311] analyzing module example_a_m_axi_reg_slice
INFO: [VRFC 10-311] analyzing module example_a_m_axi_fifo
INFO: [VRFC 10-311] analyzing module example_a_m_axi_buffer
INFO: [VRFC 10-311] analyzing module example_a_m_axi_decoder
INFO: [VRFC 10-311] analyzing module example_a_m_axi_throttle
INFO: [VRFC 10-311] analyzing module example_a_m_axi_read
INFO: [VRFC 10-311] analyzing module example_a_m_axi_write
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example.autotb.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module apatb_example_top
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example_add_6ns_6ns_6_1_1.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1_Adder_0
INFO: [VRFC 10-311] analyzing module example_add_6ns_6ns_6_1_1
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/AESL_axi_master_b.v" into library xil_defaultlib
INFO: [VRFC 10-311] analyzing module AESL_axi_master_b
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/sample_manager.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/sample_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/df_fifo_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/dump_file_agent.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/nodf_module_monitor.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/df_process_interface.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/dataflow_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [nodf_module_interface.sv:4]
INFO: [VRFC 10-311] analyzing module dataflow_monitor
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/csv_file_dump.sv" into library xil_defaultlib
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'nodf_module_intf' [/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/nodf_module_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/df_process_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_process_intf' [df_process_interface.sv:4]
INFO: [VRFC 10-2263] Analyzing SystemVerilog file "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/df_fifo_monitor.sv" into library xil_defaultlib
WARNING: [VRFC 10-3609] overwriting previous definition of interface 'df_fifo_intf' [df_fifo_interface.sv:4]
Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling package xil_defaultlib.$unit_dataflow_monitor_sv
Compiling module xil_defaultlib.example_a_m_axi_reg_slice(N=96)
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=9...
Compiling module xil_defaultlib.example_a_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DEPTH=5,DEP...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_a_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_a_m_axi_write(NUM_WRITE_...
Compiling module xil_defaultlib.example_a_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_a_m_axi_reg_slice(N=34)
Compiling module xil_defaultlib.example_a_m_axi_read(NUM_READ_OU...
Compiling module xil_defaultlib.example_a_m_axi_throttle(ADDR_WI...
Compiling module xil_defaultlib.example_a_m_axi(NUM_READ_OUTSTAN...
Compiling module xil_defaultlib.example_b_m_axi_reg_slice(N=96)
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=9...
Compiling module xil_defaultlib.example_b_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DEPTH=5,DEP...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_b_m_axi_fifo(DATA_BITS=2...
Compiling module xil_defaultlib.example_b_m_axi_write(NUM_WRITE_...
Compiling module xil_defaultlib.example_b_m_axi_buffer(DATA_WIDT...
Compiling module xil_defaultlib.example_b_m_axi_reg_slice(N=34)
Compiling module xil_defaultlib.example_b_m_axi_read(NUM_READ_OU...
Compiling module xil_defaultlib.example_b_m_axi_throttle(ADDR_WI...
Compiling module xil_defaultlib.example_b_m_axi(NUM_READ_OUTSTAN...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1_Adder_...
Compiling module xil_defaultlib.example_add_6ns_6ns_6_1_1(ID=1,N...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1_Add...
Compiling module xil_defaultlib.example_add_32ns_32ns_32_2_1(ID=...
Compiling module xil_defaultlib.example
Compiling module xil_defaultlib.AESL_axi_master_a
Compiling module xil_defaultlib.AESL_axi_master_b
Compiling module xil_defaultlib.nodf_module_intf
Compiling module xil_defaultlib.dataflow_monitor_1
Compiling module xil_defaultlib.apatb_example_top
Compiling module work.glbl
Built simulation snapshot example

****** Webtalk v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/xsim.dir/example/webtalk/xsim_webtalk.tcl -notrace
INFO: [Common 17-206] Exiting Webtalk at Tue Mar  9 20:33:12 2021...

****** xsim v2020.2 (64-bit)
  **** SW Build 3064766 on Wed Nov 18 09:12:47 MST 2020
  **** IP Build 3064653 on Wed Nov 18 14:17:31 MST 2020
    ** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.

source xsim.dir/example/xsim_script.tcl
# xsim {example} -autoloadwcfg -tclbatch {example.tcl}
Vivado Simulator 2020.2
Time resolution is 1 ps
source example.tcl
## run all
////////////////////////////////////////////////////////////////////////////////////
// Inter-Transaction Progress: Completed Transaction / Total Transaction
// Intra-Transaction Progress: Measured Latency / Latency Estimation * 100%
//
// RTL Simulation : "Inter-Transaction Progress" ["Intra-Transaction Progress"] @ "Simulation Time"
////////////////////////////////////////////////////////////////////////////////////
// RTL Simulation : 0 / 1 [0.00%] @ "109000"
// RTL Simulation : 1 / 1 [100.00%] @ "362000"
////////////////////////////////////////////////////////////////////////////////////
$finish called at time : 375750 ps : File "/media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/vitis_hls_examples/override_llvm_flow_demo/proj/solution1/sim/verilog/example.autotb.v" Line 462
## quit
INFO: [Common 17-206] Exiting xsim at Tue Mar  9 20:33:33 2021...
INFO: [COSIM 212-316] Starting C post checking ...
Test passed.
INFO: [COSIM 212-1000] *** C/RTL co-simulation finished: PASS ***
INFO: [COSIM 212-211] II is measurable only when transaction number is greater than 1 in RTL simulation. Otherwise, they will be marked as all NA. If user wants to calculate them, please make sure there are at least 2 transactions in RTL simulation.
INFO: [HLS 200-111] Finished Command cosim_design CPU user time: 28.19 seconds. CPU system time: 2.01 seconds. Elapsed time: 45.23 seconds; current allocated memory: 212.210 MB.
INFO: [HLS 200-112] Total CPU user time: 57.29 seconds. Total CPU system time: 4.44 seconds. Total elapsed time: 101.39 seconds; peak allocated memory: 207.484 MB.
INFO: [Common 17-206] Exiting vitis_hls at Tue Mar  9 20:33:34 2021...

  1. 2021年03月10日 04:27 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる2

Xilinx Vitis HLS LLVM 2020.2 をやってみる1”の続き。

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにしたということで、前回は、HLS/llvm ディレクトリでビルドすると、hls-build ディレクトリが生成された。今回は、HLS/plugins ディレクトリ以下の 2 つのプラグインをビルドしてみよう。

まずは、HLS/plugins/auto_array_partition ディレクトリからやってみよう。
Xilinx/Vitis/2020.2/setttings64.sh を起動した。
source /media/masaaki/Ubuntu_Disk/tools/Xilinx/Vitis/2020.2/settings64.sh

HLS/plugins/auto_array_partition ディレクトリに行って、ビルドした。
cd /media/masaaki/Ubuntu_Disk/Xilinx_github/HLS/plugins/auto_array_partition
./build.sh

Vitis_HLS_LLVM_30_210308.png
Vitis_HLS_LLVM_31_210308.png

LLVMMemoryPartition.so と MemoryPartition.o が生成された。

Run the pass を実行すると、エラーだった。
opt -always-inline -mem2reg -gvn -reflow-simplify-type -reflow-combine -mem2reg -gvn -indvars -load ./LLVMMemoryPartition.so -auto-memory-partition *.bc
Vitis_HLS_LLVM_32_210308.png

次に、HLS/plugins/example_analyze_rename ディレクトリでビルドしてみよう。
cd ../example_analyze_rename
./build.sh

Vitis_HLS_LLVM_33_210308.png
Vitis_HLS_LLVM_34_210308.png

LLVMCustomPasses.so 、Renamer.o 、Analyzer.o が生成された。

Run the pass を実行しようとしたが、LLVMRenamer.so は生成されていないので明らかにおかしかった。
そこで、LLVMCustomPasses.so を指定してみたがやはりエラーだった。
opt -load ./LLVMCustomPasses.so -renamer *.bc

GitHub に書いてあるコマンドをやってみたが、やはりエラーだった。
opt -load ./LLVMRenamer.so -renamer *.bc
Vitis_HLS_LLVM_35_210308.png
  1. 2021年03月09日 04:55 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

Xilinx Vitis HLS LLVM 2020.2 をやってみる1

Xilinx は Vitis HLS のフロントエンドをオープンソースとして GitHub 上で公開することになったそうだ。その Vitis HLS の GitHub が”Xilinx Vitis HLS LLVM 2020.2”なので、それをやってみることにした。
関連する記事は”Opening a World of Possibilities: Vitis HLS Front-end is Now Open Source for All on GitHub”となる。この記事は知っていたのだが、ひでみさんの記事”Xilinx Vitis HLS LLVM 2020.2”からリンクをいただいた。

まずは、”Xilinx Vitis HLS LLVM 2020.2”を git clone した。
git clone https://github.com/Xilinx/HLS.git
Vitis_HLS_LLVM_1_210307.png

作成された HLS ディレクトリの内容を示す。
Vitis_HLS_LLVM_2_210307.png

Vitis HLS LLVM source code”をコンパイルしてみようということで、llvm ディレクトリに行って、README.md を見たところ、 CMake 3.4.3 or higher ということなので、 cmake --version で cmake のバージョンを確認した。
すると、 3.3.2 ということが分かった。(後から気がついたのだが、Xilinx/Vitis/2020.2/settings64.sh を実行すると強制的に 3.3.2 になってしまうようだ)
Vitis_HLS_LLVM_3_210307.png

次に ninja をインストールする。
sudo apt install ninja-build
ninja --version

Vitis_HLS_LLVM_5_210307.png

cmake 3.4.3 をインストールするに当たって、”[Linux][cmake] 最新のcmakeをインストールする方法”を参考にした。
wget https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz
cd cmake-3.4.3
./bootstrap && make

Vitis_HLS_LLVM_9_210307.png

make が成功した。
sudo make install
cmake --version

Vitis_HLS_LLVM_11_210307.png

一度、 ./build.sh でのビルドを失敗した。
cmake のバージョンが 3.3.2 だったのが原因だったが、それは、Xilinx/Vitis/2020.2/settings64.sh を実行したので強制的に 3.3.2 になってしまったのが原因だった。
Vitis_HLS_LLVM_13_210307.png

Xilinx/Vitis/2020.2/settings64.sh を実行は、llvm のコンパイルと関係ないので、Xilinx/Vitis/2020.2/settings64.sh を実行せずにコンパイルしたところエラーになった。
./build.sh
Vitis_HLS_LLVM_15_210307.png

いろいろとやってみたが、結局パッケージが足りないのが原因だった。
sudo apt install llvm
sudo apt install clang
sudo apt install doxygen

これらをインストールしてから ./build.sh を実行したところビルドが成功した。
Vitis_HLS_LLVM_26_210308.png

ビルドしたパソコンは、Ubuntu 18.04 LTS のメモリが 32 GB のマシンだが、メモリが足りなかったようだ。
ビルドには長い時間がかかっていたので、ビルドを続けさせて寝てしまったのだが、起きたら、スワップ領域が設定されていてパソコンが遅くなっていた。
Vitis_HLS_LLVM_27_210308.png

HLS/llvm ディレクトリを見ると hls-build ディレクトリが生成されている。
Vitis_HLS_LLVM_28_210308.png

hls-build ディレクトリを見た。
Vitis_HLS_LLVM_29_210308.png
  1. 2021年03月08日 04:32 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0

uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム3

uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム2”の続き。

前回は、本番用の uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム acc_gps_rs422 プロジェクトを示した。今回は、Vitis のプロジェクトをプロジェクトを作成して、プラットフォームとアプリケーション・プロジェクトを作成した。

Vivado から Vitis 2020.2 を立ち上げてワークスペースを vitis_work に指定した。
acc_gps_test_19_210306.png

arm_app_rs422 アプリケーション・プロジェクトを作成した。
使用するプロセッサは ps7_cortexa9_0 とした。
acc_gps_test_20_210306.png

プラットフォームとアプリケーション・プロジェクトが新規作成された。
acc_gps_test_21_210306.png

arm_app_rs422.c を作成した。
acc_gps_test_22_210306.png

ビルドを行ったところ成功した。
acc_gps_test_23_210306.png

ここでは、”FPGAプログラミング大全 Xilinx編 第2版”の”5-4 タイマー割り込みとAPIの利用”のコードを参照して、Zynq のタイマー割り込みを使用する予定だ。

次に、GPS は MicroBlaze プロセッサを使用しているので、それ用のプラットフォームとアプリケーション・プロジェクトを作成する。
gps_mb_platform を作成して、 gps_uartlite_microblaze を使用した mb_gps アプリケーション・プロジェクトを作成する。
acc_gps_test_24_210306.png

gps_mb_platform と mb_gps_system アプリケーション・プロジェクトが作成された。
acc_gps_test_25_210306.png

これは以前と同じソースコードが使えるので、 mb_gps.c を新規作成した。
acc_gps_test_26_210306.png

ビルドしたが問題なく成功した。
acc_gps_test_27_210306.png

3軸加速度センサー側にプロセッサを入れる予定なので、そこができたいないため、まだ実機テストができない。
プロセッサには PIC16F1825 を使用する予定だ。
  1. 2021年03月07日 04:43 |
  2. FPGAを使用したシステム
  3. | トラックバック:0
  4. | コメント:0

uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム2

uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム1”の続き。

前回はテスト用に Vivado 2020.2 で acc_gps_test プロジェクトを作成し、uart_rx, uart_rx_axi4ls, uart_tx IP を使用したブロックデザインを作成し、論理合成、インプリメンテーション、ビットストリームの生成を行った。そして、ハードウェアをエクスポートし、Vivado 2020.2 を起動して、プラットフォームを作成できた。今回は、本番用の uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム acc_gps_rs422 プロジェクトをご紹介する。

Vivado 2020.2 の acc_gps_rs422 プロジェクトを示す。
acc_gps_test_10_210305.png

acc_gps_bd ブロックデザインを 3 分割して示す。
acc_gps_test_11_210305.png
acc_gps_test_12_210305.png
acc_gps_test_13_210305.png

多少重なっている部分があるので注意して欲しい。
前回の acc_gps_test_bd ブロック・デザインが 9 個入っているイメージだ。
その内の 1 個、 ch0 モジュールを示す。
acc_gps_test_18_210305.png

Address Editor を示す。
acc_gps_test_14_210305.png

Address Map を示す。
acc_gps_test_15_210305.png
acc_gps_test_16_210305.png

これで、論理合成、インプリメンテーション、ビットストリームの生成を行って、成功した。
Project Summary を示す。
acc_gps_test_17_210305.png

ハードウェアをエクスポートして、 acc_gps_bd_wrapper.xsa ファイルを作成した。
  1. 2021年03月06日 03:59 |
  2. FPGAを使用したシステム
  3. | トラックバック:0
  4. | コメント:0

FPGAの部屋のまとめサイトの更新(2021年3月5日)

FPGAの部屋のまとめサイトを更新しました。GENESYS Dev Env を追加して、2021 年 3 月 5 日までの記事を更新しました。
  1. 2021年03月05日 03:43 |
  2. その他のFPGAの話題
  3. | トラックバック:0
  4. | コメント:0

uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システム1

今まで実装してきた uart_rx, uart_rx_axi4ls, uart_tx を使用した 3 軸加速度センサー・システムを書いておこうと思う。
今回は、ノイズに弱い I2C ではなく、伝送線路に RS-422 を使用する。 uart_rx, uart_tx の信号は RS-422 変換 IC を通って、RS-422 に変換されて、LAN ケーブルを伝送する。
今回は、その 1 チャネル分の acc_gps_test プロジェクトを示す。なお、Vitis HLS 2020.2 のバグ?を回避するために、Ubuntu 18.04 LTS でツールを使用している。

まずは、Vivado 2020.2 で acc_gps_test プロジェクトを作成した。
acc_gps_test_1_210228.png

acc_gps_test プロジェクトのディレクトリ下に uart_rx, uart_rx_axi4ls, uart_tx のディレクトリを作成し、その下に、Vitis HLS 2020.2 で作成した IP をコピーした。
acc_gps_test_2_210228.png

Vivado の IP Catalog でに uart_rx, uart_rx_axi4ls, uart_tx IP を追加した。
acc_gps_test_3_210228.png

Vivado でブロック・デザインを作成して、完成させた。
acc_gps_test_4_210228.png

acc_gps_test_bd ブロック・デザインを示す。
acc_gps_test_5_210228.png

Address Editor 画面を示す。
acc_gps_test_6_210228.png

Address Map 画面を示す。
acc_gps_test_7_210228.png

論理合成、インプリメンテーション、ビットストリームの生成を行って、成功した。
Project Summary を示す。
acc_gps_test_8_210302.png

ハードウェアをエクスポートし、XSA ファイルを作成した。
Vitis 2020.2 を起動して、プラットフォームとHelloWorld アプリケーション・プロジェクトを作成して、ビルドし、成功した。
acc_gps_test_9_210302.png

やはり、Linux だとプラットフォームも正常にビルドできる。
  1. 2021年03月04日 04:20 |
  2. FPGAを使用したシステム
  3. | トラックバック:0
  4. | コメント:0

非同期外部入力に xpm_cdc を使用する

これまで、uart_rx や uart_tx を作ってきたが、uart_rx の入力は自分の FPGA の内部クロックに同期していない信号となる。そこで、自分の内部クロックに同期させる必要があるわけだ。以前は、Synchronizer IP を自分で作っていたのだが、 ”Vivado 2020.2 の新機能1”で紹介したように、新たに xpm_cdc IP が追加されたので、使ってみよう。

なぜ、自分の内部クロックに同期させる必要があるかわからない方は”Fpgaでの非同期信号の扱い方とvivadoによるサポート(公開用)”を参照のこと。

uart_rx, uart_rx_axi4ls, uart_tx を接続したブロックデザインを示す。
uart_rx の rxst_V_dout[0:0] の前段に xpm_cdc IP が接続されている。
xpm_cdc_1_210228.png

外部入力の rx_422_rx0 を xpm_cdc の src_in に入力して、dest_out から uart_rx の rxst_V_dout[0:0] に入力されている。
src_clk と dest_clk は uart_rx の ap_clk に接続されている。UART では、src_clk が無いので、何処に接続したものか?と悩んだが、後で述べるように、これで良さそうだ。

xpm_cdc_gen_0 の設定を見てみよう。
CDC Type は Single-bit Synchronizer に設定した。
INPUT REGISTER FOR SOURCE CLOCK DOMAIN は src_clk が無いので、チェックを外した。
xpm_cdc_2_210228.png

CDC-Type の設定値を見てみよう。
xpm_cdc_3_210228.png

論理合成後の xpm_cdc の Schematic を見てみよう。
dest_clk をクロックにいれた 4 段の FF があるのが分かる。これで良さそうだ。
xpm_cdc_4_210301.png
  1. 2021年03月03日 03:27 |
  2. IP
  3. | トラックバック:0
  4. | コメント:0

Windows 10 版の Vitis HLS 2020.2 で作成した AXI4Lite インターフェースの IP を使用した回路は Vitis 2020.2 でプラットフォームがビルドできない

Windows 10 で Vitis HLS 2020.2 のAXI4Lite インターフェースを使用した IP を使用した Vivado 2020.2 のプロジェクトを論理合成、インプリメンテーション、ビットストリームの生成をした。ハードウェアをエクスポートして、Vitis 2020.2 で XSA ファイルを元にプラットフォームを作って、ビルドしたらエラーになってしまった。これは Vitis HLS 2020.2 のAXI4Lite インターフェースを使用した IP を使用した複数の Vivado 2020.2 のプロジェクトで起こるようだ。バグじゃないだろうか? なお、このバグは Windows 版の Vitis HLS 2020.2 だけで発生して、Linux 版の Vitis HLS 2020.2 では発生しない。

AXI4 Lite インターフェースで PWM 値をセットする pwm モジュールを Windows 10 の Vitis HLS 2020.2 で作成した。
そして、Zybo Z7-10 ボード用の Vivado 2020.2 の pwm_axi4ls_test プロジェクトを作成した。
pwm_axi4ls_bd ブロックデザインを生成した。
論理合成、インプリメンテーション、ビットストリームの生成を行って成功し、XSA ファイルをエクスポートした。
vitis_202_bug_1_210301.png

pwm_axi4ls_bd ブロックデザインを示す。
vitis_202_bug_2_210301.png

Address Map を示す。
vitis_202_bug_3_210301.png

Vitis 2020.2 を起動して、XSA ファイルを利用してプラットフォームを生成した。
生成したプラットフォームをビルドするとエラーが発生した。
vitis_202_bug_4_210301.png

process_begin: CreateProcess(NULL, #echo "Copying 'xpwm.h' to '../../../include/xpwm.h'", ...) failed.


ネットで検索すると”Vitis for Windows can't build platform for Vitis_HLS project.”が見つかった。
どうやら、Vitis HLS 2020.2 のバグのようだ。

Windows 10 版の Vitis HLS 2020.2 のAXI4Lite インターフェースを使用した IP を使用した回路が Vitis 2020.2 でプラットフォームが生成できないとなると Windows 版の Vitis HLS 2020.2 は使えないよね。。。どうしよう?

なお、Vitis に 2020.2.2 アップデートをかけてみたのだが、同じバグが発生した。orz

Windows 版 Vitis HLS 2020.1 にも同じようなバグがあるようです。”Create IP AXI4-Lite
2020.1 のバグの回避方法は”FPGAプログラミング大全 Xilinx編 第2版”の 478 ページの”API の Makefile にバグ?”に載っています。

(追記)
Vivado, Vitis 2020.2の手順はこれでも良いか?(うまく行った)
1.Vitis HLS でAXI4-Lite インターフェースの IP を作る
2.Windows の Vivado で Vitis HLS の IP を使って回路を作ってビットストリームを作成する。
3.WSL2 の Linux (Ubuntu 18.04) の Vitis でプラットフォームだけ作ってビルドしておく。
4.Winodws の Vitis でアプリケーション・プロジェクトを作成して、実機テスト。
  1. 2021年03月02日 03:29 |
  2. Vitis HLS
  3. | トラックバック:0
  4. | コメント:0
»