0
1
00:00:00,870 --> 00:00:05,970
Now that we are familiar with the testbench concepts and its coding style, we are ready to use the 
1

2
00:00:06,030 --> 00:00:10,130
Viviado-HLS IDE to perform the C and Co simulations in action. 
2

3
00:00:11,950 --> 00:00:17,140
Let’s consider this simple combinational circuit, which was explained in the previous section, as an 
3

4
00:00:17,140 --> 00:00:23,200
example to implement in HLS and test its correctness. This combinational circuit has three
4

5
00:00:23,200 --> 00:00:24,630
inputs and one output.
5

6
00:00:24,940 --> 00:00:27,640
So its truth table consists of eight rows. 
6

7
00:00:28,860 --> 00:00:33,500
We use this truth table as our golden model to compare with the design results.
7

8
00:00:36,010 --> 00:00:41,170
Open the corresponding Vivado-HLS project with the name of simple_combinational_circuit-vhls, 
8

9
00:00:41,320 --> 00:00:45,100
explained in the previous section.
9

10
00:00:45,830 --> 00:00:48,340
The project only contains the design source file.
10

11
00:01:03,040 --> 00:01:09,400
Create a testbench source file with the name of simple_combinational_circuit-tb.cpp
11

12
00:01:09,410 --> 00:01:16,570
under the Test Bench folder in the explorer view. Then create a testbench header file with the name 
12

13
00:01:16,570 --> 00:01:24,730
of simple_combinational_circuit-tb.h in the same folder. Add the design 
13

14
00:01:24,730 --> 00:01:26,370
top-function prototype in the testbench header file.
14

15
00:01:26,530 --> 00:01:29,510
Now in the testbench source file,
15

16
00:01:29,770 --> 00:01:30,090
write 
16

17
00:01:30,120 --> 00:01:33,160
the main function that returns an integer value.
17

18
00:01:34,630 --> 00:01:40,570
Define three boolean variables to pass values to the design inputs and a Boolean array with a size
18

19
00:01:40,570 --> 00:01:47,230
of 8 to keep all the possible design outputs. Define another Boolean array with a size of 8 
19

20
00:01:47,620 --> 00:01:51,820
to save all golden results extracted from the function truth table.
20

21
00:01:52,810 --> 00:01:59,110
Now, we should generate all the possible design input values. Three nested loops can do this task.
21

22
00:01:59,800 --> 00:02:04,090
Inside the nested loops, call the design function as shown in this code.
22

23
00:02:14,910 --> 00:02:21,280
Use another loop to compare the design outputs with the golden model values and report proper messages. 
23

24
00:02:22,080 --> 00:02:26,400
Don’t forget to update the status value according to the comparison results. 
24

25
00:02:29,410 --> 00:02:34,450
Now perform the C-simulation and have a look at the report to make sure that the design functionality 
25

26
00:02:34,660 --> 00:02:35,370
is correct.
26

27
00:02:47,810 --> 00:02:52,980
You can also perform the C-Simulation debugging process by choosing the Launch Debugger option. 
27

28
00:02:53,860 --> 00:02:55,940
This action opens the debug perspective 
28

29
00:03:04,670 --> 00:03:09,560
through which standard debugging features such as step execution, insert brake port are
29

30
00:03:09,560 --> 00:03:14,330
available.  Also, you can examine the variable contents through debugging. 
30

31
00:03:51,690 --> 00:03:56,550
To insert a breakpoint, you only need to click on the blue area next to each desired line. 
31

32
00:04:26,490 --> 00:04:31,200
After performing the C-Simulation successfully, we are allowed to run the HLS synthesis.
32

33
00:04:35,690 --> 00:04:42,350
Now we can perform the C/RTL Co-simulation to test the design cycle-accurate correctness. After finishing
33

34
00:04:42,350 --> 00:04:45,440
the simulation, check the report for the successful simulation. 
34

35
00:05:03,500 --> 00:05:09,920
You can also dump the design internal and port signal values in a file for showing them through a waveform 
35

36
00:05:09,920 --> 00:05:15,310
viewer. For this purpose, choose the proper option in the Co-Simulation Debug dialog. 
36

37
00:05:35,600 --> 00:05:39,770
After finishing the simulation, click on the waveform viewer icon, 
37

38
00:05:40,880 --> 00:05:42,950
which will open the Vivado for this purpose. 
38

39
00:06:01,110 --> 00:06:06,630
Select the design input and output ports to be shown in the waveform viewer. Then check the values. 
39

40
00:07:08,090 --> 00:07:14,030
This lecture is the last in this section that explained the design concepts and techniques. So the 
40

41
00:07:14,030 --> 00:07:20,540
next lecture will give you a couple of hardware designs as exercises through which you review and 
41

42
00:07:20,540 --> 00:07:22,750
master the proposed techniques in this section. 
42

43
00:07:25,380 --> 00:07:31,320
These are our takeaway messages. Through C-Simulation we can check the design functionality before
43

44
00:07:31,320 --> 00:07:32,280
HLS synthesis.
44

45
00:07:33,210 --> 00:07:37,860
Through RT/C Co-Simulation we check the cycle accuracy of the design.
45

46
00:07:38,550 --> 00:07:44,580
Also, we can dump the signal values through Co-simulation and examine them in the Vivado Waveform 
46

47
00:07:44,580 --> 00:07:45,000
viewer.
47

48
00:07:47,570 --> 00:07:48,590
Now, the quiz question.
48

49
00:07:49,730 --> 00:07:51,590
We know that the final hardware circuit is 
49

50
00:07:52,790 --> 00:07:59,720
combinational, but Why does the final waveform viewer contain reset, clock, start and other signals?
