-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathvp_fpga.html
More file actions
759 lines (748 loc) · 64.9 KB
/
vp_fpga.html
File metadata and controls
759 lines (748 loc) · 64.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Virtual Platform On AWS FPGA — NVDLA Documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="_static/nvdla.css?v=f25946e3" />
<link rel="stylesheet" type="text/css" href="_static/styles.css?v=af91e327" />
<script src="_static/documentation_options.js?v=7026087e"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Open NVDLA Repository Updates" href="updates.html" />
<link rel="prev" title="Virtual Platform" href="vp.html" />
<style>
#onetrust-banner-sdk.otFloatingRounded {
margin-left:-10px !important;
margin-bottom:-10px !important;
width: 100% !important;
max-width: 100% !important;
}
</style>
<script src="https://assets.adobedtm.com/5d4962a43b79/814eb6e9b4e1/launch-4bc07f1e0b0b.min.js"></script>
<!-- OneTrust Cookies Consent Notice start for nvdla.org -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" data-document-language="true" type="text/javascript" charset="UTF-8" data-domain-script="018f0667-2548-7720-98d6-fef08f0e7436" ></script>
<script type="text/javascript">
function OptanonWrapper() {
var event = new Event('bannerLoaded');
window.dispatchEvent(event);
}
</script>
<script type="text/javascript" src="https://images.nvidia.com/aem-dam/Solutions/ot-js/ot-custom.js"></script>
<!-- OneTrust Cookies Consent Notice end for nvdla.org -->
</head><body>
<header class="navbar">
<nav class="container navbar navbar-light bg-faded">
<a class="navbar-brand" href="https://www.nvidia.com/">
<div class="logo"></div>
</a>
</nav>
</header>
<div class="related" role="navigation" aria-label="related navigation">
<div class="container">
<div class="row">
<h3>Navigation</h3>
<ul>
<li class="right first">
<a href="updates.html" title="Open NVDLA Repository Updates"
accesskey="N">next</a></li>
<li class="right">
<a href="vp.html" title="Virtual Platform"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NVDLA Open Source Project</a>»</li>
<li class="nav-item nav-item-1"><a href="contents.html">Documentation</a>»</li>
</ul>
</div>
</div>
</div>
<div class="document">
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-9">
<section id="virtual-platform-on-aws-fpga">
<h1>Virtual Platform On AWS FPGA<a class="headerlink" href="#virtual-platform-on-aws-fpga" title="Link to this heading">¶</a></h1>
<section id="overview">
<h2>1. Overview<a class="headerlink" href="#overview" title="Link to this heading">¶</a></h2>
<p>Virtual Platform (<a class="reference internal" href="vp.html#overview"><span class="std std-ref">1. Overview</span></a>) can run on Amazon Web Services (AWS) FPGA platform. <a class="reference internal" href="#fig-vp-fpga"><span class="std std-numref">Fig. 82</span></a> below shows the top level diagram of the NVDLA virtual simulator on AWS FPGA platform.</p>
<figure class="align-center" id="id3">
<span id="fig-vp-fpga"></span><img alt="NVDLA Virtual Platform FPGA Diagram." src="_images/nvdla-vp-fpga.svg" /><figcaption>
<p><span class="caption-number">Fig. 82 </span><span class="caption-text">NVDLA Virtual Platform on AWS FPGA platform.</span><a class="headerlink" href="#id3" title="Link to this image">¶</a></p>
</figcaption>
</figure>
<p>To launch an instance which is a virtual server in the cloud, Amazon Machine Image (AMI) is required. Virtual simulator can run on the instance with FPGA board connected. The following sections describe how virtual simulator runs on different AMIs.</p>
<ul class="simple">
<li><p><a class="reference internal" href="#using-the-virtual-simulator-on-nvidia-ami">2. Using the Virtual Simulator on NVIDIA AMI</a>: NVIDIA provides NVDLA AMI (ubuntu14.04 based) included all necessary system requirements which allow users to run virtual simulator without any additional operation.</p></li>
<li><p><a class="reference internal" href="#using-the-virtual-simulator-on-aws-ami">3. Using the Virtual Simulator on AWS AMI</a>: Virtual simulator can run on basic ubuntu/centos AMI delivered by AWS. This section shows how to run virtual simulator on basic AMI step by step.</p></li>
<li><p><a class="reference internal" href="#generating-the-afi-on-aws-fpga-ami">4. Generating the AFI on AWS FPGA AMI</a>: Amazon FPGA Image (AFI) is necessary for AWS FPGA platform. Before running virtual simulator on AWS FPGA platform, AFI needs to be registered and loaded to AWS. NVIDIA provides one demo AFI which has been verified. Users also can develop their own FPGA design, when design completes, users can generate AFI with FPGA AWS AMI pre-built included FPGA development and run-time tools. This section shows how to generate AFI on AWS FPGA AMI step by step.</p></li>
</ul>
</section>
<section id="using-the-virtual-simulator-on-nvidia-ami">
<h2>2. Using the Virtual Simulator on NVIDIA AMI<a class="headerlink" href="#using-the-virtual-simulator-on-nvidia-ami" title="Link to this heading">¶</a></h2>
<section id="setup-aws-ec2-instance-machine">
<h3>2.1 Setup AWS EC2 instance machine<a class="headerlink" href="#setup-aws-ec2-instance-machine" title="Link to this heading">¶</a></h3>
<section id="set-up-and-log-into-your-aws-account">
<h4>2.1.1 Set up and log into your AWS account<a class="headerlink" href="#set-up-and-log-into-your-aws-account" title="Link to this heading">¶</a></h4>
<p>Log into the <a class="reference external" href="https://console.aws.amazon.com/">AWS Management Console</a> and set up your root account.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Please set your aws region to US East (N.Virginia) since each AWS region is independent.</p>
</div>
</section>
<section id="launch-an-amazon-ec2-instance">
<h4>2.1.2 Launch an Amazon EC2 instance<a class="headerlink" href="#launch-an-amazon-ec2-instance" title="Link to this heading">¶</a></h4>
<p>In the <a class="reference external" href="https://us-west-2.console.aws.amazon.com/ec2/v2/home?region=us-west-2">Amazon EC2 Dashboard</a>, choose “Launch Instance” to create and configure your virtual machine.</p>
</section>
<section id="configure-your-instance">
<h4>2.1.3 Configure your instance<a class="headerlink" href="#configure-your-instance" title="Link to this heading">¶</a></h4>
<p>In this tutorial, you have the option to configure your instance features. Below are some guidelines on setting up your first instance.</p>
<ul class="simple">
<li><p><strong>Choose an Amazon Machine Image (AMI)</strong>: we recommend the <em>“nvdla_vp_fpga_ami_ubuntu”</em></p></li>
<li><p><strong>Choose an instance type</strong>: we recommend the <em>“f1.2xlarge”</em>.</p></li>
<li><p><strong>Launch instance</strong>: review your instance configuration and choose “Launch”.</p></li>
<li><p><strong>Create a key pair</strong>: Select “Create a new key pair” and assign a name. The key pair file (.pem) will download automatically - save this in a safe place as we will later use this file to log in to the instance. Finally, choose “Launch Instances” to complete the set up.</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It may take a few minutes to initialize your instance.</p>
</div>
</section>
<section id="connect-to-your-instance">
<h4>2.1.4 Connect to your instance<a class="headerlink" href="#connect-to-your-instance" title="Link to this heading">¶</a></h4>
<p>After you launch your instance, you can connect to it and use it the way that you’d use a computer sitting in front of you. To connect from the console, follow the steps below:</p>
<ul class="simple">
<li><p>Select the EC2 instance you created and choose “Connect”.</p></li>
<li><p>Select “A Java SSH client directly from my browser”. Ensure Java is installed and enabled.</p></li>
<li><p>Enter the Private key path (example: C:KeyPairsmy-key-pair.pem). Choose “Launch SSH Client”.</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>You can also connect via SSH or PuTTY, <a class="reference external" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html">click here</a> to learn more.</p>
</div>
</section>
</section>
<section id="setup-aws-sdk">
<h3>2.2 Setup AWS SDK<a class="headerlink" href="#setup-aws-sdk" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>clone<span class="w"> </span>https://github.com/aws/aws-fpga.git<span class="w"> </span><span class="c1"># Pull AWS SDK</span>
<span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>v1.4.0<span class="w"> </span><span class="c1"># Use tag v1.4.0 version of AWS SDK for NVIDIA AMI</span>
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>aws-fpga<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span>sdk_setup.sh<span class="w"> </span><span class="c1"># Setup AWS SDK</span>
<span class="gp">$ </span>lsmod<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>edma<span class="w"> </span><span class="c1"># Check if the edma driver is intalled</span>
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$SDK_DIR</span>/linux_kernel_drivers/edma<span class="w"> </span><span class="c1"># If nothing shows up, following the instructions below to install it</span>
<span class="gp">$ </span>make
<span class="gp">$ </span><span class="nb">echo</span><span class="w"> </span><span class="s1">'edma'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>--append<span class="w"> </span>/lib/modules-load.d/edma.conf
<span class="gp">$ </span>sudo<span class="w"> </span>cp<span class="w"> </span>edma-drv.ko<span class="w"> </span>/lib/modules/<span class="sb">`</span>uname<span class="w"> </span>-r<span class="sb">`</span>/
<span class="gp">$ </span>sudo<span class="w"> </span>depmod
<span class="gp">$ </span>sudo<span class="w"> </span>modprobe<span class="w"> </span>edma-drv
</pre></div>
</div>
</section>
<section id="load-aws-fpga-image">
<h3>2.3 Load AWS FPGA image<a class="headerlink" href="#load-aws-fpga-image" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>sudo<span class="w"> </span>fpga-clear-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span>
<span class="gp">$ </span>sudo<span class="w"> </span>fpga-load-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span><span class="w"> </span>-I<span class="w"> </span>agfi-09c2a21805a8b9257<span class="w"> </span><span class="c1"># Load MSI-X interrupt fixed AFI</span>
<span class="gp">$ </span>sudo<span class="w"> </span>fpga-clear-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span>
<span class="gp">$ </span>sudo<span class="w"> </span>fpga-describe-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span><span class="w"> </span>-H
<span class="gp">$ </span>sudo<span class="w"> </span>fpga-load-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span><span class="w"> </span>-I<span class="w"> </span><your-image-afi-global-id><span class="w"> </span><span class="c1"># Load the image</span>
<span class="gp">$ </span>sudo<span class="w"> </span>fpga-describe-local-image<span class="w"> </span>-S<span class="w"> </span><span class="m">0</span><span class="w"> </span>-R<span class="w"> </span>-H
<span class="gp">$ </span>sudo<span class="w"> </span>rmmod<span class="w"> </span>edma-drv<span class="w"> </span><span class="c1"># Only needed if edma driver has been installed</span>
<span class="gp">$ </span>sudo<span class="w"> </span>insmod<span class="w"> </span><span class="nv">$SDK_DIR</span>/linux_kernel_drivers/edma/edma-drv.ko<span class="w"> </span><span class="c1"># Re-install the edma driver to make sure the MSI is registered to /dev/fpga0_event0</span>
</pre></div>
</div>
<p>AFI <em>agfi-09c2a21805a8b9257</em> is necessary for MSI-X interrupts issue.</p>
<p>You can generate your own AWS FPGA Image (AFI) by <a class="reference internal" href="#generating-the-afi-on-aws-fpga-ami">4. Generating the AFI on AWS FPGA AMI</a> Or can use NVIDIA Sample AFI (refer to <a class="reference external" href="https://github.com/nvdla/vp_awsfpga/blob/master/README.md">VP AWS FPGA README</a>) if just want to run tests on AWS FPGA platform.</p>
<p>More details please refer to <a class="reference external" href="https://aws.amazon.com/ec2/getting-started/">AWS Getting Started</a>.</p>
</section>
<section id="running-virtual-simulator">
<h3>2.4 Running Virtual Simulator<a class="headerlink" href="#running-virtual-simulator" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>/usr/local/nvdla
<span class="gp">$ </span>sudo<span class="w"> </span>./aarch64_toplevel<span class="w"> </span>-c<span class="w"> </span>aarch64_nvdla.lua<span class="w"> </span>--fpga
<span class="go">Login the kernel with account 'root' and password 'nvdla'</span>
</pre></div>
</div>
<p>You should be able to find the string <em>“Initialize AWS FPGA with slot_id=0, pci_vendor_id=0x1d0f, pci_device_id=0xf001”</em> from output if virtual simulator is running on FPGA platform.</p>
</section>
<section id="running-software-sanity-test">
<h3>2.5 Running software sanity test<a class="headerlink" href="#running-software-sanity-test" title="Link to this heading">¶</a></h3>
<p>After login the kenerl system, you can run one software sanity test for NVDLA small configure.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"># </span>mount<span class="w"> </span>-t<span class="w"> </span>9p<span class="w"> </span>-o<span class="w"> </span><span class="nv">trans</span><span class="o">=</span>virtio<span class="w"> </span>r<span class="w"> </span>/mnt
<span class="gp"># </span><span class="nb">cd</span><span class="w"> </span>/mnt/sw/prebuilt/linux/
<span class="gp"># </span>insmod<span class="w"> </span>drm.ko
<span class="gp"># </span>insmod<span class="w"> </span>opendla_small.ko
<span class="gp"># </span>./nvdla_runtime<span class="w"> </span>--loadable<span class="w"> </span>kmd/CDP/CDP_L0_0_small_fbuf
</pre></div>
</div>
<p>You should be able to see ‘Test pass’ printed in the screen at the end of test. You are now ready to try out the NVDLA software in the virtual simulator on FPGA! Please refer to <a class="reference internal" href="sw/contents.html"><span class="doc">Software Manual</span></a> for details.</p>
<p>If you want to exit the virtual simulator, press ‘ctrl+a x’.</p>
</section>
</section>
<section id="using-the-virtual-simulator-on-aws-ami">
<h2>3. Using the Virtual Simulator on AWS AMI<a class="headerlink" href="#using-the-virtual-simulator-on-aws-ami" title="Link to this heading">¶</a></h2>
<section id="setup-aws-ec2-instance-machine-on-aws-ami">
<h3>3.1 Setup AWS EC2 instance machine on AWS AMI<a class="headerlink" href="#setup-aws-ec2-instance-machine-on-aws-ami" title="Link to this heading">¶</a></h3>
<p>Please refer to <a class="reference internal" href="#setup-aws-ec2-instance-machine">2.1 Setup AWS EC2 instance machine</a> and the AMI we recommend to choose <em>“ami-38708b45”</em> (Ubuntu) or <em>“FPGA Developer AMI”</em> (CentOS)</p>
</section>
<section id="download-the-virtual-simulator">
<h3>3.2 Download the Virtual Simulator<a class="headerlink" href="#download-the-virtual-simulator" title="Link to this heading">¶</a></h3>
<section id="download-virtual-simulator">
<h4>3.2.1 Download Virtual Simulator<a class="headerlink" href="#download-virtual-simulator" title="Link to this heading">¶</a></h4>
<p>Please refer to <a class="reference internal" href="vp.html#download-the-virtual-simulator"><span class="std std-ref">2.2 Download the Virtual Simulator</span></a></p>
</section>
<section id="download-nvdla-aws-fpga-custom-logic-cl">
<h4>3.2.2 Download NVDLA AWS FPGA Custom Logic (CL)<a class="headerlink" href="#download-nvdla-aws-fpga-custom-logic-cl" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nvdla/vp_awsfpga.git
</pre></div>
</div>
</section>
</section>
<section id="install-dependencies">
<h3>3.3 Install Dependencies<a class="headerlink" href="#install-dependencies" title="Link to this heading">¶</a></h3>
<section id="install-required-tools-and-libraries">
<h4>3.3.1 Install required tools and libraries<a class="headerlink" href="#install-required-tools-and-libraries" title="Link to this heading">¶</a></h4>
<p>For CentOS:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>sudo<span class="w"> </span>yum<span class="w"> </span>install<span class="w"> </span>cmake<span class="w"> </span>swig<span class="w"> </span>glib2-devel<span class="w"> </span>git<span class="w"> </span>pixman-devel<span class="w"> </span>boost-devel<span class="w"> </span>libattr-devel<span class="w"> </span>libpcap-devel<span class="w"> </span><span class="s1">'perl(Data::Dumper)'</span><span class="w"> </span><span class="s1">'perl(YAML)'</span><span class="w"> </span><span class="s1">'perl(Capture::Tiny)'</span><span class="w"> </span><span class="s1">'perl(XML::Simple)'</span><span class="w"> </span>java-1.7.0-openjdk-devel.x86_64<span class="w"> </span>libtermcap-devel<span class="w"> </span>ncurses-devel<span class="w"> </span>libevent-devel<span class="w"> </span>readline-devel<span class="w"> </span>python-devel
</pre></div>
</div>
<p>For Ubuntu:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>sudo<span class="w"> </span>apt-get<span class="w"> </span>update
<span class="gp">$ </span>sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>g++<span class="w"> </span>cmake<span class="w"> </span>libboost-dev<span class="w"> </span>git<span class="w"> </span>lua5.2<span class="w"> </span>python-dev<span class="w"> </span>libglib2.0-dev<span class="w"> </span>libpixman-1-dev<span class="w"> </span>liblua5.2-dev<span class="w"> </span>swig<span class="w"> </span>libcap-dev<span class="w"> </span>libattr1-dev<span class="w"> </span>libconfig-yaml-perl<span class="w"> </span>openjdk-7-jre-headless<span class="w"> </span>libxml-simple-perl<span class="w"> </span>libcapture-tiny-perl
</pre></div>
</div>
</section>
<section id="download-and-install-systemc-2-3-0">
<h4>3.3.2 Download and install SystemC 2.3.0<a class="headerlink" href="#download-and-install-systemc-2-3-0" title="Link to this heading">¶</a></h4>
<p>Please be noted that SystemC 2.3.1/2.3.2 is currently not supported currently</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>wget<span class="w"> </span>-O<span class="w"> </span>systemc-2.3.0a.tar.gz<span class="w"> </span>https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.0a.tar.gz
<span class="gp">$ </span>tar<span class="w"> </span>-xzvf<span class="w"> </span>systemc-2.3.0a.tar.gz
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>systemc-2.3.0a
<span class="gp">$ </span>sudo<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>/usr/local/systemc-2.3.0/
<span class="gp">$ </span>mkdir<span class="w"> </span>objdir
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>objdir
<span class="gp">$ </span>../configure<span class="w"> </span>--prefix<span class="o">=</span>/usr/local/systemc-2.3.0
<span class="gp">$ </span>make
<span class="gp">$ </span>sudo<span class="w"> </span>make<span class="w"> </span>install
</pre></div>
</div>
</section>
<section id="download-and-install-lua-5-3-2-for-centos">
<h4>3.3.3 Download and install Lua 5.3.2 (For CentOS)<a class="headerlink" href="#download-and-install-lua-5-3-2-for-centos" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>curl<span class="w"> </span>-R<span class="w"> </span>-O<span class="w"> </span>https://www.lua.org/ftp/lua-5.3.2.tar.gz
<span class="gp">$ </span>tar<span class="w"> </span>zxf<span class="w"> </span>lua-5.3.2.tar.gz
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>lua-5.3.2
<span class="gp">$ </span>make<span class="w"> </span>linux<span class="w"> </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s2">"-fPIC -DLUA_USE_LINUX"</span><span class="w"> </span><span class="nb">test</span>
<span class="gp">$ </span>sudo<span class="w"> </span>make<span class="w"> </span>install
</pre></div>
</div>
</section>
<section id="download-and-install-perl-package-required">
<h4>3.3.4 Download and install perl package required<a class="headerlink" href="#download-and-install-perl-package-required" title="Link to this heading">¶</a></h4>
<p>We need to install perl package YAML.pm and Tee.pm to build NVDLA CMOD.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>wget<span class="w"> </span>-O<span class="w"> </span>YAML-1.24.tar.gz<span class="w"> </span>https://search.cpan.org/CPAN/authors/id/T/TI/TINITA/YAML-1.24.tar.gz
<span class="gp">$ </span>tar<span class="w"> </span>-xzvf<span class="w"> </span>YAML-1.24.tar.gz
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>YAML-1.24
<span class="gp">$ </span>perl<span class="w"> </span>Makefile.PL
<span class="gp">$ </span>make
<span class="gp">$ </span>sudo<span class="w"> </span>make<span class="w"> </span>install
<span class="gp">$ </span>wget<span class="w"> </span>-O<span class="w"> </span>IO-Tee-0.65.tar.gz<span class="w"> </span>https://search.cpan.org/CPAN/authors/id/N/NE/NEILB/IO-Tee-0.65.tar.gz
<span class="gp">$ </span>tar<span class="w"> </span>-xzvf<span class="w"> </span>IO-Tee-0.65.tar.gz
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>IO-Tee-0.65
<span class="gp">$ </span>perl<span class="w"> </span>Makefile.PL
<span class="gp">$ </span>make
<span class="gp">$ </span>sudo<span class="w"> </span>make<span class="w"> </span>install
</pre></div>
</div>
</section>
<section id="download-and-build-nvdla-cmod-and-vmod">
<h4>3.3.5 Download and build NVDLA CMOD and VMOD<a class="headerlink" href="#download-and-build-nvdla-cmod-and-vmod" title="Link to this heading">¶</a></h4>
<p>Please refer to <a class="reference internal" href="hw/v1/integration_guide.html#tree-build"><span class="std std-ref">Tree Build</span></a> for details on building the NVDLA hardware tree, and make sure the required tools listed in <a class="reference internal" href="hw/v1/integration_guide.html#env-setup"><span class="std std-ref">Environment Setup</span></a> are installed first.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/nvdla/hw.git
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span>hw
<span class="gp">$ </span>git<span class="w"> </span>reset<span class="w"> </span>--hard<span class="w"> </span><HW<span class="w"> </span>verion<span class="w"> </span>index><span class="w"> </span><span class="c1"># HW versison must be matched with virtual simulator, refer to section 'HW verion index' of README.md in nvdla/vp</span>
<span class="gp">$ </span>make
<span class="gp">$ </span>tools/bin/tmake<span class="w"> </span>-build<span class="w"> </span>cmod_top<span class="w"> </span>-build<span class="w"> </span>vmod
</pre></div>
</div>
<p>The header files and library will be generated in <em>hw/outdir/<project>/cmod/release</em> and <em>hw/outdir/<project>/vmod/release</em>.</p>
<p><HW verion index> must be matched with virtual simulator, refer to <a class="reference external" href="https://github.com/nvdla/vp/blob/master/README.md">VP README</a> for details.</p>
<p>If you need to run the random HW regression tests on FPGA, please run the below commands to build tests for random HW regression.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>./tools/bin/tmake<span class="w"> </span>-build<span class="w"> </span>verif_trace_generator
<span class="gp">$ </span>./verif/tools/run_plan.py<span class="w"> </span>-P<span class="w"> </span>nv_small<span class="w"> </span>-tp<span class="w"> </span>nv_small<span class="w"> </span>-otag<span class="w"> </span>L10<span class="w"> </span>L11<span class="w"> </span>-l_num<span class="o">=</span><span class="m">4</span><span class="w"> </span>-r_num<span class="o">=</span><span class="m">10</span><span class="w"> </span>-timeout<span class="w"> </span><span class="m">500</span><span class="w"> </span>-monitor<span class="w"> </span>--dump_trace_only
</pre></div>
</div>
<p>After build finish, there will be nv_small_XXXX folder in hw tree and trace tests are generated in nv_small_XXXX/nvdla_utb.
You can also generate random HW regression tests for other configurations like nv_large by command “./verif/tools/run_plan.py -P nv_large -tp nv_large -otag L10
L11 -l_num=4 -r_num=10 -timeout 500 -monitor –dump_trace_only”.</p>
</section>
</section>
<section id="build-and-install-the-virtual-simulator-with-nvdla-fpga">
<h3>3.4 Build and Install the Virtual Simulator with NVDLA FPGA<a class="headerlink" href="#build-and-install-the-virtual-simulator-with-nvdla-fpga" title="Link to this heading">¶</a></h3>
<section id="download-aws-ec2-fpga-hardware-and-software-development-kit">
<h4>3.4.1 Download AWS EC2 FPGA Hardware and Software Development Kit<a class="headerlink" href="#download-aws-ec2-fpga-hardware-and-software-development-kit" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/aws/aws-fpga.git
<span class="gp">$ </span>git<span class="w"> </span>checkout<span class="w"> </span>v1.4.0
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Always sync latest version for AWS EC2 FPGA Hardware and Software Development Kits. Please sync aws repository to specified version (refer to <a class="reference external" href="https://github.com/nvdla/vp_awsfpga/blob/master/README.md">VP AWS FPGA README</a>) which was verified with any issue.</p>
</div>
</section>
<section id="setup-aws-sdk-and-edma-driver">
<h4>3.4.2 Setup AWS SDK and edma driver<a class="headerlink" href="#setup-aws-sdk-and-edma-driver" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>aws-fpga<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span>sdk_setup.sh<span class="w"> </span><span class="c1"># Setup AWS SDK</span>
<span class="gp">$ </span>lsmod<span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span>edma<span class="w"> </span><span class="c1"># Check if the edma driver is intalled</span>
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$SDK_DIR</span>/linux_kernel_drivers/edma<span class="w"> </span><span class="c1"># If nothing shows up, following the instructions below to install it</span>
<span class="gp">$ </span>make
<span class="gp">$ </span><span class="nb">echo</span><span class="w"> </span><span class="s1">'edma'</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>--append<span class="w"> </span>/etc/modules-load.d/edma.conf
<span class="gp">$ </span>sudo<span class="w"> </span>cp<span class="w"> </span>edma-drv.ko<span class="w"> </span>/lib/modules/<span class="sb">`</span>uname<span class="w"> </span>-r<span class="sb">`</span>/
<span class="gp">$ </span>sudo<span class="w"> </span>depmod
<span class="gp">$ </span>sudo<span class="w"> </span>modprobe<span class="w"> </span>edma-drv
</pre></div>
</div>
<p><em>aws-fpga prefix</em> is the local aws repository.</p>
</section>
<section id="id1">
<h4>3.4.3 Load AWS FPGA image<a class="headerlink" href="#id1" title="Link to this heading">¶</a></h4>
<p>Please refer to <a class="reference internal" href="#load-aws-fpga-image">2.3 Load AWS FPGA image</a>.</p>
</section>
<section id="cmake-build-under-the-vp-repository-directory">
<h4>3.4.4 Cmake build under the vp repository directory<a class="headerlink" href="#cmake-build-under-the-vp-repository-directory" title="Link to this heading">¶</a></h4>
<p>For CentOS:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cmake<span class="w"> </span>-DCMAKE_INSTALL_PREFIX<span class="o">=[</span>install<span class="w"> </span>dir<span class="o">]</span><span class="w"> </span>-DSYSTEMC_PREFIX<span class="o">=[</span>systemc<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span>-DNVDLA_HW_PREFIX<span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span>-DNVDLA_HW_PROJECT<span class="o">=[</span>nvdla_hw<span class="w"> </span>project<span class="w"> </span>name<span class="o">]</span><span class="w"> </span>-DAWS_FPGA_PRESENT<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DAWS_SDK_PREFIX<span class="o">=[</span>aws<span class="w"> </span>sdk<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span>-DLUA_INCLUDE_DIR<span class="o">=</span>/usr/local/include<span class="w"> </span>-DLUA_LIBRARIES<span class="o">=</span>/usr/local/lib/liblua.a
</pre></div>
</div>
<p>For Ubuntu:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cmake<span class="w"> </span>-DCMAKE_INSTALL_PREFIX<span class="o">=[</span>install<span class="w"> </span>dir<span class="o">]</span><span class="w"> </span>-DSYSTEMC_PREFIX<span class="o">=[</span>systemc<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span>-DNVDLA_HW_PREFIX<span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span>-DNVDLA_HW_PROJECT<span class="o">=[</span>nvdla_hw<span class="w"> </span>project<span class="w"> </span>name<span class="o">]</span><span class="w"> </span>-DAWS_FPGA_PRESENT<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DAWS_SDK_PREFIX<span class="o">=[</span>aws<span class="w"> </span>sdk<span class="w"> </span>prefix<span class="o">]</span>
</pre></div>
</div>
<p><em>install dir</em> is where you would like to install the virtual simulator, <em>systemc prefix</em> is the SystemC installation directory, <em>nvdla_hw prefix</em> is the local NVDLA HW repository, <em>nvdla_hw project name</em> is the NVDLA HW project name and <em>aws sdk prefix</em> is the AWS sdk directory</p>
<p>Example:</p>
<p>For CentOS:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cmake<span class="w"> </span>-DCMAKE_INSTALL_PREFIX<span class="o">=</span>build<span class="w"> </span>-DSYSTEMC_PREFIX<span class="o">=</span>/usr/local/systemc-2.3.0/<span class="w"> </span>-DNVDLA_HW_PREFIX<span class="o">=</span>/usr/local/nvdla/hw<span class="w"> </span>-DNVDLA_HW_PROJECT<span class="o">=</span>nv_small<span class="w"> </span>-DAWS_FPGA_PRESENT<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DAWS_SDK_PREFIX<span class="o">=</span>/usr/local/aws-fpga/sdk<span class="w"> </span>-DLUA_INCLUDE_DIR<span class="o">=</span>/usr/local/include<span class="w"> </span>-DLUA_LIBRARIES<span class="o">=</span>/usr/local/lib/liblua.a
</pre></div>
</div>
<p>For Ubuntu:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>cmake<span class="w"> </span>-DCMAKE_INSTALL_PREFIX<span class="o">=</span>build<span class="w"> </span>-DSYSTEMC_PREFIX<span class="o">=</span>/usr/local/systemc-2.3.0/<span class="w"> </span>-DNVDLA_HW_PREFIX<span class="o">=</span>/usr/local/nvdla/hw<span class="w"> </span>-DNVDLA_HW_PROJECT<span class="o">=</span>nv_small<span class="w"> </span>-DAWS_FPGA_PRESENT<span class="o">=</span><span class="m">1</span><span class="w"> </span>-DAWS_SDK_PREFIX<span class="o">=</span>/usr/local/aws-fpga/sdk
</pre></div>
</div>
</section>
<section id="compile-and-install">
<h4>3.4.5 Compile and install:<a class="headerlink" href="#compile-and-install" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>make
<span class="gp">$ </span>make<span class="w"> </span>install
</pre></div>
</div>
</section>
</section>
<section id="running-hw-regression-tests-on-fpga">
<h3>3.5 Running HW regression tests on FPGA<a class="headerlink" href="#running-hw-regression-tests-on-fpga" title="Link to this heading">¶</a></h3>
<section id="run-nvdla-l0-1-2-tests">
<h4>3.5.1 Run NVDLA L0/1/2 tests<a class="headerlink" href="#run-nvdla-l0-1-2-tests" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>vp_awsfpga<span class="w"> </span>prefix<span class="o">]</span>/cl_nvdla/verif/regression
<span class="gp">$ </span>make<span class="w"> </span><span class="nv">AWS_FPGA</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">NVDLA_HW_ROOT</span><span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span>
<span class="gp">$ </span>make<span class="w"> </span>check<span class="w"> </span><span class="c1"># Check last regression status</span>
</pre></div>
</div>
<p><em>nvdla_hw prefix</em> is the local NVDLA HW repository, <em>vp_awsfpga prefix</em> is the local nvdla aws fpga CL repository.</p>
</section>
<section id="run-nvdla-random-regression-tests">
<h4>3.5.2 Run NVDLA random regression tests<a class="headerlink" href="#run-nvdla-random-regression-tests" title="Link to this heading">¶</a></h4>
<p>You can run NVDLA random regression tests which has HW full coverage with below commands.</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>vp_awsfpga<span class="w"> </span>prefix<span class="o">]</span>/cl_nvdla/verif/regression
<span class="gp">$ </span>make<span class="w"> </span><span class="nv">AWS_FPGA</span><span class="o">=</span><span class="m">1</span><span class="w"> </span><span class="nv">NVDLA_HW_ROOT</span><span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span><span class="nv">NVDLA_HW_TRACE_LIST</span><span class="o">=</span>nv_small_random<span class="w"> </span><span class="nv">NVDLA_HW_TRACE_ROOT</span><span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span>/nv_small_XXXX/nvdla_utb<span class="w"> </span><span class="nv">RANDOM_TEST</span><span class="o">=</span><span class="m">1</span>
<span class="gp">$ </span>make<span class="w"> </span>check<span class="w"> </span><span class="nv">NVDLA_HW_TRACE_LIST</span><span class="o">=</span>nv_small_random<span class="w"> </span><span class="c1"># Check last regression status</span>
</pre></div>
</div>
<p><em>nvdla_hw prefix</em> is the local NVDLA HW repository, <em>vp prefix</em> is the local nvdla aws fpga CL repository.</p>
</section>
</section>
<section id="running-the-virtual-simulator">
<h3>3.6 Running the Virtual Simulator<a class="headerlink" href="#running-the-virtual-simulator" title="Link to this heading">¶</a></h3>
<section id="prepare-kernel-image">
<h4>3.6.1 Prepare Kernel Image<a class="headerlink" href="#prepare-kernel-image" title="Link to this heading">¶</a></h4>
<p>A demo linux kernel image is provided in the github release. You can run this image in the virtual simulator, and run the NVDLA KMD/UMD inside it.</p>
<p>If you would like to build a linux kernel on your own, please refer to <a class="reference internal" href="vp.html#building-linux-kernel"><span class="std std-ref">3. Building Linux Kernel for NVDLA Virtual Simulator</span></a>.</p>
<p>After the image is ready, modify the <em>conf/aarch64_nvdla.lua</em> for the image and rootfs file location.</p>
</section>
<section id="standard-qemu-arguments">
<h4>3.6.2 Standard QEMU Arguments<a class="headerlink" href="#standard-qemu-arguments" title="Link to this heading">¶</a></h4>
<p>The configuration of the virtual simulator is defined in <em>conf/aarch64_nvdla.lua</em>. You can change the standard QEMU arguments in <em>extra_arguments</em> inside the lua file.</p>
</section>
<section id="running-kernel-image-in-the-virtual-simulator">
<h4>3.6.3 Running Kernel Image In the Virtual Simulator<a class="headerlink" href="#running-kernel-image-in-the-virtual-simulator" title="Link to this heading">¶</a></h4>
<p>Start the virtual simulator:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>sudo<span class="w"> </span>./build/bin/aarch64_toplevel<span class="w"> </span>-c<span class="w"> </span>conf/aarch64_nvdla.lua<span class="w"> </span>--fpga
<span class="go">Login the kernel. The demo image uses account 'root' and password 'nvdla'.</span>
</pre></div>
</div>
<p>Some demo tests are provided in the <em>tests</em> directory, you can run them after login as root:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp"># </span>mount<span class="w"> </span>-t<span class="w"> </span>9p<span class="w"> </span>-o<span class="w"> </span><span class="nv">trans</span><span class="o">=</span>virtio<span class="w"> </span>r<span class="w"> </span>/mnt
<span class="gp"># </span><span class="nb">cd</span><span class="w"> </span>/mnt/tests/hello
<span class="gp"># </span>./aarch64_hello
</pre></div>
</div>
<p>You should be able to see ‘Hello World!’ printed in the screen. You are now ready to try out the NVDLA software in the virtual simulator! Please refer to <a class="reference internal" href="sw/contents.html"><span class="doc">Software Manual</span></a> for details.</p>
<p>If you want to exit the virtual simulator, press ‘ctrl+a x’.</p>
</section>
</section>
<section id="debugging-the-virtual-simulator">
<h3>3.7 Debugging the Virtual Simulator<a class="headerlink" href="#debugging-the-virtual-simulator" title="Link to this heading">¶</a></h3>
<p>Refer to <a class="reference internal" href="vp.html#debugging-the-virtual-simulator"><span class="std std-ref">2.7 Debugging the Virtual Simulator</span></a> to debug virtual simulator</p>
</section>
</section>
<section id="generating-the-afi-on-aws-fpga-ami">
<h2>4. Generating the AFI on AWS FPGA AMI<a class="headerlink" href="#generating-the-afi-on-aws-fpga-ami" title="Link to this heading">¶</a></h2>
<section id="setup-aws-ec2-instance-machine-on-fpga-ami">
<h3>4.1 Setup AWS EC2 instance machine on FPGA AMI<a class="headerlink" href="#setup-aws-ec2-instance-machine-on-fpga-ami" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="#setup-aws-ec2-instance-machine">2.1 Setup AWS EC2 instance machine</a>: we recommend to choose <em>“FPGA Developer AMI”</em> (CentOS)</p></li>
<li><p><a class="reference internal" href="#install-dependencies">3.3 Install Dependencies</a>: Follow the CentOS steps.</p></li>
</ul>
</section>
<section id="download-source-code">
<h3>4.2 Download source code<a class="headerlink" href="#download-source-code" title="Link to this heading">¶</a></h3>
<ul class="simple">
<li><p><a class="reference internal" href="#download-nvdla-aws-fpga-custom-logic-cl">Download NVDLA AWS FPGA Custom Logic (CL)</a></p></li>
<li><p><a class="reference internal" href="#download-and-build-nvdla-cmod-and-vmod">Download and build NVDLA</a></p></li>
<li><p><a class="reference internal" href="#download-aws-ec2-fpga-hardware-and-software-development-kit">AWS EC2 FPGA Hardware and Software Development Kits</a></p></li>
</ul>
</section>
<section id="build-nvdla-rtl">
<h3>4.3 Build NVDLA RTL<a class="headerlink" href="#build-nvdla-rtl" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span>
<span class="gp">$ </span>make
<span class="gp">$ </span>./tools/bin/tmake<span class="w"> </span>-build<span class="w"> </span>vmod
</pre></div>
</div>
<p>Please refer to <a class="reference internal" href="hw/v1/integration_guide.html#tree-build"><span class="std std-ref">Tree Build</span></a> for details on building the NVDLA hardware tree, and make sure the required tools listed in <a class="reference internal" href="hw/v1/integration_guide.html#env-setup"><span class="std std-ref">Environment Setup</span></a> are installed first.</p>
</section>
<section id="generate-vivado-ip">
<h3>4.4 Generate Vivado IP<a class="headerlink" href="#generate-vivado-ip" title="Link to this heading">¶</a></h3>
<p>Before generate NVDLA AFI, users need to generate some necessary Xilinx
Vivado IP in AWS EC2 instance. The generated IP is not distributed with the
NVDLA source distribution because of licensing restrictions.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<ul class="simple">
<li><p>You need to access the AWS EC2 instance from GUI machine to use Xilinx tool.</p></li>
<li><p>Vivado veresion is /opt/Xilinx/SDx/2017.1.op/Vivado/bin/vivado</p></li>
<li><p>For IP location, we recommend to use [vp_awsfpga prefix]/common/design/xilinx_ip/</p></li>
</ul>
</div>
<section id="start-xilinx-tool-in-aws-ec2-instance">
<h4>4.4.1 Start Xilinx tool in AWS EC2 instance<a class="headerlink" href="#start-xilinx-tool-in-aws-ec2-instance" title="Link to this heading">¶</a></h4>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>vivado
</pre></div>
</div>
</section>
<section id="configure-ip-setting">
<h4>4.4.2 Configure IP setting<a class="headerlink" href="#configure-ip-setting" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>Click “Manage IP”</p></li>
<li><p>Click “New IP Location”</p></li>
<li><p>Click “Next”</p></li>
<li><p>Configure the Manage IP Settings page, set “part” to “xcvu9p-flgb2104-2-i”</p></li>
<li><p>Click “Finish”</p></li>
</ul>
</section>
<section id="generate-ip-axi2apb">
<h4>4.4.3 Generate IP axi2apb<a class="headerlink" href="#generate-ip-axi2apb" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, search axi_apb</p></li>
<li><p>Double click “AXI APB Bridge”</p></li>
<li><p>Set “Component Name” to “axi_apb_bridge_0”</p></li>
<li><p>Set “Number Of Slaves” to “1”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
<section id="generate-ip-axi-interconnect-nvdla-64b">
<h4>4.4.4 Generate IP axi_interconnect_nvdla_64b<a class="headerlink" href="#generate-ip-axi-interconnect-nvdla-64b" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, expand “AXI_Infrastructure”, double click “AXI Interconnect RTL”</p></li>
<li><p>Set “Component Name” to “axi_interconnect_nvdla_64b”</p></li>
<li><p>Click the tab “Global”</p></li>
<li><p>Set “Number of Slave Interface” to “2”</p></li>
<li><p>Set “Slave Interface Thread ID Width” to “8”</p></li>
<li><p>Set “Address Width” to “64”</p></li>
<li><p>Set “Interconnect Internal Data Width” to “512”</p></li>
<li><p>Click the tab “Interfaces”</p></li>
<li><p>Set “Master Interface Data Width” to “512”</p></li>
<li><p>Set “Slave Interface 0 data width” to “512”</p></li>
<li><p>Set “Slave Interface 1 data width” to “64”</p></li>
<li><p>Click the tab “Read Write Channels”</p></li>
<li><p>Set all the “Acceptance” to “32”</p></li>
<li><p>Set all the “FIFO Depth” to “512”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
<section id="generate-ip-axi-interconnect-nvdla-512b">
<h4>4.4.5 Generate IP axi_interconnect_nvdla_512b<a class="headerlink" href="#generate-ip-axi-interconnect-nvdla-512b" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, expand “AXI_Infrastructure”, double click “AXI Interconnect RTL”</p></li>
<li><p>Set “Component Name” to “axi_interconnect_nvdla_512b”</p></li>
<li><p>Click the tab “Global”</p></li>
<li><p>Set “Number of Slave Interface” to “3”</p></li>
<li><p>Set “Slave Interface Thread ID Width” to “8”</p></li>
<li><p>Set “Address Width” to “64”</p></li>
<li><p>Set “Interconnect Internal Data Width” to “512”</p></li>
<li><p>Click the tab “Interfaces”</p></li>
<li><p>Set all the “Data Width” to “512”</p></li>
<li><p>Click the tab “Read Write Channels”</p></li>
<li><p>Set all the “Acceptance” to “32”</p></li>
<li><p>Set all the “FIFO Depth” to “512”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
<section id="generate-ip-axi-interconnect-nvdla-256b">
<h4>4.4.6 Generate IP axi_interconnect_nvdla_256b<a class="headerlink" href="#generate-ip-axi-interconnect-nvdla-256b" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, expand “AXI_Infrastructure”, double click “AXI Interconnect RTL”</p></li>
<li><p>Set “Component Name” to “axi_interconnect_nvdla_256b”</p></li>
<li><p>Click the tab “Global”</p></li>
<li><p>Set “Number of Slave Interface” to “3”</p></li>
<li><p>Set “Slave Interface Thread ID Width” to “8”</p></li>
<li><p>Set “Address Width” to “64”</p></li>
<li><p>Set “Interconnect Internal Data Width” to “512”</p></li>
<li><p>Click the tab “Interfaces”</p></li>
<li><p>Set all the “Data Width” to “256”</p></li>
<li><p>Click the tab “Read Write Channels”</p></li>
<li><p>Set all the “Acceptance” to “32”</p></li>
<li><p>Set all the “FIFO Depth” to “512”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
<section id="generate-ip-axi-protocol-converter-axi-to-axil">
<h4>4.4.7 Generate IP axi_protocol_converter_axi_to_axil<a class="headerlink" href="#generate-ip-axi-protocol-converter-axi-to-axil" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, expand “AXI_Infrastructure”, double click “AXI Protocol Converter”</p></li>
<li><p>Set “Component Name” to “axi_protocol_converter_axi_to_axil”</p></li>
<li><p>Set “Address Width” to “64”</p></li>
<li><p>Set “Data Width” to “64”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
<section id="generate-ip-axi-dwidth-converter-512b-to-64b">
<h4>4.4.8 Generate IP axi_dwidth_converter_512b_to_64b<a class="headerlink" href="#generate-ip-axi-dwidth-converter-512b-to-64b" title="Link to this heading">¶</a></h4>
<ul class="simple">
<li><p>In the IP catalog, expand “AXI_Infrastructure”, double click “AXI Data Width Converter”</p></li>
<li><p>Set “Component Name” to “axi_dwidth_converter_512b_to_64b”</p></li>
<li><p>Set “Address Width” to “64”</p></li>
<li><p>Set “SI Data Width” to “512”</p></li>
<li><p>Set “SI ID Width” to “16”</p></li>
<li><p>Click “OK”</p></li>
<li><p>Click “Generate”</p></li>
<li><p>Click “OK” and wait the task in “Design Runs” panel to finish</p></li>
</ul>
</section>
</section>
<section id="install-aws-cli">
<h3>4.5 Install AWS CLI<a class="headerlink" href="#install-aws-cli" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>aws<span class="w"> </span>configure<span class="w"> </span><span class="c1"># to set your credentials (found in your console.aws.amazon.com page) and default region</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>You need to setup access keys for your AWS account, please refer to <a class="reference external" href="https://docs.aws.amazon.com/general/latest/gr/managing-aws-access-keys.html">Managing Access Keys for Your AWS Account</a></p>
</div>
</section>
<section id="generate-design-checkpoint-dcp">
<h3>4.6 Generate design checkpoint (DCP)<a class="headerlink" href="#generate-design-checkpoint-dcp" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="o">[</span>aws<span class="w"> </span>fpga<span class="w"> </span>prefix<span class="o">]</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span>hdk_setup.sh
<span class="gp">$ </span><span class="nb">export</span><span class="w"> </span><span class="nv">CL_DIR</span><span class="o">=[</span>vp_awsfpga<span class="w"> </span>prefix<span class="o">]</span>/cl_nvdla
<span class="gp">$ </span><span class="nb">export</span><span class="w"> </span><span class="nv">NV_HW_ROOT</span><span class="o">=[</span>nvdla_hw<span class="w"> </span>prefix<span class="o">]</span>
<span class="gp">$ </span><span class="nb">cd</span><span class="w"> </span><span class="nv">$CL_DIR</span>/build/scripts
<span class="gp">$ </span>./filelist.sh
<span class="gp">$ </span><span class="nv">$HDK_DIR</span>/common/shell_stable/build/scripts/aws_build_dcp_from_cl.sh<span class="w"> </span>-foreground<span class="w"> </span>-clock_recipe_a<span class="w"> </span>A2<span class="w"> </span><span class="c1"># Create DCP with 15.625M</span>
</pre></div>
</div>
<p>The DCP generation process could take hours to finish, you should not stop the EC2 instance during this process. After the DCP is generated successfully, a tarball file should be generated under [vp_awsfpga prefix]/cl_nvdla/build/checkpoints/to_aws.</p>
</section>
<section id="generate-afi">
<h3>4.7 Generate AFI<a class="headerlink" href="#generate-afi" title="Link to this heading">¶</a></h3>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>aws<span class="w"> </span>s3<span class="w"> </span>mb<span class="w"> </span>s3://<your-bucket-name><span class="w"> </span>--region<span class="w"> </span><region><span class="w"> </span><span class="c1"># Create an S3 bucket (choose a unique bucket name)</span>
<span class="gp">$ </span>aws<span class="w"> </span>s3<span class="w"> </span>mb<span class="w"> </span>s3://<your-bucket-name>/<your-dcp-folder-name><span class="w"> </span><span class="c1"># Create folder for your tarball files</span>
<span class="gp">$ </span>aws<span class="w"> </span>s3<span class="w"> </span>cp<span class="w"> </span><span class="nv">$CL_DIR</span>/build/checkpoints/to_aws/<your-dcp-tallball><span class="w"> </span>s3://<your-bucket-name>/<your-dcp-folder-name>/<span class="w"> </span><span class="c1"># Upload the file to S3</span>
<span class="gp">$ </span>aws<span class="w"> </span>s3<span class="w"> </span>mb<span class="w"> </span>s3://<your-bucket-name>/<your-logs-folder-name><span class="w"> </span><span class="c1"># Create a folder to keep your logs</span>
<span class="gp">$ </span>touch<span class="w"> </span>LOGS_FILES_GO_HERE.txt<span class="w"> </span><span class="c1"># Create a temp file</span>
<span class="gp">$ </span>aws<span class="w"> </span>s3<span class="w"> </span>cp<span class="w"> </span>LOGS_FILES_GO_HERE.txt<span class="w"> </span>s3://<your-bucket-name>/<your-logs-folder-name>/<span class="w"> </span><span class="c1"># Which creates the folder on S3</span>
<span class="gp">$ </span>aws<span class="w"> </span>ec2<span class="w"> </span>create-fpga-image<span class="w"> </span>--name<span class="w"> </span><your-afi-name><span class="w"> </span>--description<span class="w"> </span><your-afi-description><span class="w"> </span>--input-storage-location<span class="w"> </span><span class="nv">Bucket</span><span class="o">=</span><your-bucket-name>,Key<span class="o">=</span><your-dcp-folder-name>/<your-dcp-tallball><span class="w"> </span>--logs-storage-location<span class="w"> </span><span class="nv">Bucket</span><span class="o">=</span><your-bucket-name>,Key<span class="o">=</span><your-logs-folder-name><span class="w"> </span><span class="c1"># create AFI</span>
<span class="go">NOTE: The trailing '/' is required after <dcp-folder-name></span>
</pre></div>
</div>
<p>You will get a unique AFI ID and global AFI ID for your fpga image. You do not need to keep the EC2 instance running during this process. You can check the status using:</p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="gp">$ </span>aws<span class="w"> </span>ec2<span class="w"> </span>describe-fpga-images<span class="w"> </span>--fpga-image-ids<span class="w"> </span><your-image-afi-id>
</pre></div>
</div>
<p>More details please refer to <a class="reference external" href="https://github.com/aws/aws-fpga/blob/master/hdk/cl/examples/README.md#3-submit-the-design-checkpoint-to-aws-to-create-the-afi">How to submit checkpoint to aws</a></p>
</section>
</section>
</section>
</div>
<div class="col-xs-12 col-md-3">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<div>
<h3><a href="contents.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Virtual Platform On AWS FPGA</a><ul>
<li><a class="reference internal" href="#overview">1. Overview</a></li>
<li><a class="reference internal" href="#using-the-virtual-simulator-on-nvidia-ami">2. Using the Virtual Simulator on NVIDIA AMI</a><ul>
<li><a class="reference internal" href="#setup-aws-ec2-instance-machine">2.1 Setup AWS EC2 instance machine</a><ul>
<li><a class="reference internal" href="#set-up-and-log-into-your-aws-account">2.1.1 Set up and log into your AWS account</a></li>
<li><a class="reference internal" href="#launch-an-amazon-ec2-instance">2.1.2 Launch an Amazon EC2 instance</a></li>
<li><a class="reference internal" href="#configure-your-instance">2.1.3 Configure your instance</a></li>
<li><a class="reference internal" href="#connect-to-your-instance">2.1.4 Connect to your instance</a></li>
</ul>
</li>
<li><a class="reference internal" href="#setup-aws-sdk">2.2 Setup AWS SDK</a></li>
<li><a class="reference internal" href="#load-aws-fpga-image">2.3 Load AWS FPGA image</a></li>
<li><a class="reference internal" href="#running-virtual-simulator">2.4 Running Virtual Simulator</a></li>
<li><a class="reference internal" href="#running-software-sanity-test">2.5 Running software sanity test</a></li>
</ul>
</li>
<li><a class="reference internal" href="#using-the-virtual-simulator-on-aws-ami">3. Using the Virtual Simulator on AWS AMI</a><ul>
<li><a class="reference internal" href="#setup-aws-ec2-instance-machine-on-aws-ami">3.1 Setup AWS EC2 instance machine on AWS AMI</a></li>
<li><a class="reference internal" href="#download-the-virtual-simulator">3.2 Download the Virtual Simulator</a><ul>
<li><a class="reference internal" href="#download-virtual-simulator">3.2.1 Download Virtual Simulator</a></li>
<li><a class="reference internal" href="#download-nvdla-aws-fpga-custom-logic-cl">3.2.2 Download NVDLA AWS FPGA Custom Logic (CL)</a></li>
</ul>
</li>
<li><a class="reference internal" href="#install-dependencies">3.3 Install Dependencies</a><ul>
<li><a class="reference internal" href="#install-required-tools-and-libraries">3.3.1 Install required tools and libraries</a></li>
<li><a class="reference internal" href="#download-and-install-systemc-2-3-0">3.3.2 Download and install SystemC 2.3.0</a></li>
<li><a class="reference internal" href="#download-and-install-lua-5-3-2-for-centos">3.3.3 Download and install Lua 5.3.2 (For CentOS)</a></li>
<li><a class="reference internal" href="#download-and-install-perl-package-required">3.3.4 Download and install perl package required</a></li>
<li><a class="reference internal" href="#download-and-build-nvdla-cmod-and-vmod">3.3.5 Download and build NVDLA CMOD and VMOD</a></li>
</ul>
</li>
<li><a class="reference internal" href="#build-and-install-the-virtual-simulator-with-nvdla-fpga">3.4 Build and Install the Virtual Simulator with NVDLA FPGA</a><ul>
<li><a class="reference internal" href="#download-aws-ec2-fpga-hardware-and-software-development-kit">3.4.1 Download AWS EC2 FPGA Hardware and Software Development Kit</a></li>
<li><a class="reference internal" href="#setup-aws-sdk-and-edma-driver">3.4.2 Setup AWS SDK and edma driver</a></li>
<li><a class="reference internal" href="#id1">3.4.3 Load AWS FPGA image</a></li>
<li><a class="reference internal" href="#cmake-build-under-the-vp-repository-directory">3.4.4 Cmake build under the vp repository directory</a></li>
<li><a class="reference internal" href="#compile-and-install">3.4.5 Compile and install:</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-hw-regression-tests-on-fpga">3.5 Running HW regression tests on FPGA</a><ul>
<li><a class="reference internal" href="#run-nvdla-l0-1-2-tests">3.5.1 Run NVDLA L0/1/2 tests</a></li>
<li><a class="reference internal" href="#run-nvdla-random-regression-tests">3.5.2 Run NVDLA random regression tests</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-the-virtual-simulator">3.6 Running the Virtual Simulator</a><ul>
<li><a class="reference internal" href="#prepare-kernel-image">3.6.1 Prepare Kernel Image</a></li>
<li><a class="reference internal" href="#standard-qemu-arguments">3.6.2 Standard QEMU Arguments</a></li>
<li><a class="reference internal" href="#running-kernel-image-in-the-virtual-simulator">3.6.3 Running Kernel Image In the Virtual Simulator</a></li>
</ul>
</li>
<li><a class="reference internal" href="#debugging-the-virtual-simulator">3.7 Debugging the Virtual Simulator</a></li>
</ul>
</li>
<li><a class="reference internal" href="#generating-the-afi-on-aws-fpga-ami">4. Generating the AFI on AWS FPGA AMI</a><ul>
<li><a class="reference internal" href="#setup-aws-ec2-instance-machine-on-fpga-ami">4.1 Setup AWS EC2 instance machine on FPGA AMI</a></li>
<li><a class="reference internal" href="#download-source-code">4.2 Download source code</a></li>
<li><a class="reference internal" href="#build-nvdla-rtl">4.3 Build NVDLA RTL</a></li>
<li><a class="reference internal" href="#generate-vivado-ip">4.4 Generate Vivado IP</a><ul>
<li><a class="reference internal" href="#start-xilinx-tool-in-aws-ec2-instance">4.4.1 Start Xilinx tool in AWS EC2 instance</a></li>
<li><a class="reference internal" href="#configure-ip-setting">4.4.2 Configure IP setting</a></li>
<li><a class="reference internal" href="#generate-ip-axi2apb">4.4.3 Generate IP axi2apb</a></li>
<li><a class="reference internal" href="#generate-ip-axi-interconnect-nvdla-64b">4.4.4 Generate IP axi_interconnect_nvdla_64b</a></li>
<li><a class="reference internal" href="#generate-ip-axi-interconnect-nvdla-512b">4.4.5 Generate IP axi_interconnect_nvdla_512b</a></li>
<li><a class="reference internal" href="#generate-ip-axi-interconnect-nvdla-256b">4.4.6 Generate IP axi_interconnect_nvdla_256b</a></li>
<li><a class="reference internal" href="#generate-ip-axi-protocol-converter-axi-to-axil">4.4.7 Generate IP axi_protocol_converter_axi_to_axil</a></li>
<li><a class="reference internal" href="#generate-ip-axi-dwidth-converter-512b-to-64b">4.4.8 Generate IP axi_dwidth_converter_512b_to_64b</a></li>
</ul>
</li>
<li><a class="reference internal" href="#install-aws-cli">4.5 Install AWS CLI</a></li>
<li><a class="reference internal" href="#generate-design-checkpoint-dcp">4.6 Generate design checkpoint (DCP)</a></li>
<li><a class="reference internal" href="#generate-afi">4.7 Generate AFI</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div>
<h4>Previous topic</h4>
<p class="topless"><a href="vp.html"
title="previous chapter">Virtual Platform</a></p>
</div>
<div>
<h4>Next topic</h4>
<p class="topless"><a href="updates.html"
title="next chapter">Open NVDLA Repository Updates</a></p>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/vp_fpga.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<div class="container">
<div class="row">
<h3>Navigation</h3>
<ul>
<li class="right first">
<a href="updates.html" title="Open NVDLA Repository Updates"
>next</a></li>
<li class="right">
<a href="vp.html" title="Virtual Platform"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">NVDLA Open Source Project</a>»</li>
<li class="nav-item nav-item-1"><a href="contents.html">Documentation</a>»</li>
</ul>
</div>
</div>
</div>
<div class="footer" role="contentinfo">
<div class="container">
<div class="footer-links">
<a href="https://www.nvidia.com/en-us/about-nvidia/privacy-policy/">Privacy Policy</a>
<span class="footer-sep">|</span>
<a href="https://www.nvidia.com/en-us/about-nvidia/privacy-center/">Your Privacy Choices</a>
<span class="footer-sep">|</span>
<a href="https://www.nvidia.com/en-us/about-nvidia/terms-of-service/">Terms of Service</a>
<span class="footer-sep">|</span>
<a href="https://www.nvidia.com/en-us/about-nvidia/accessibility/">Accessibility</a>
<span class="footer-sep">|</span>
<a href="https://www.nvidia.com/en-us/about-nvidia/company-policies/">Corporate Policies</a>
<span class="footer-sep">|</span>
<a href="https://www.nvidia.com/en-us/contact/">Contact</a>
<span class="footer-sep">|</span>
<a href="#" id="ot-sdk-btn" class="ot-sdk-show-settings footer-cookie-link">Cookie Settings</a>
</div>
<div class="footer-meta">
<p>Copyright © 2026 NVIDIA Corporation | Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6.</p>
</div>
</div>
</div>
<script type="text/javascript">_satellite.pageBottom();</script>
</body>
</html>