0
1
00:00:00,500 --> 00:00:05,720
Now we are ready to write a C function to show a decimal digit on a single 7-segment display.
1

2
00:00:06,680 --> 00:00:12,530
In our example, we are going to show a digit whose binary code is represented by the four right-hand 
2

3
00:00:12,530 --> 00:00:15,950
side slide switches on the right-hand side 7-segment.
3

4
00:00:17,850 --> 00:00:21,270
The algorithm that controls the 7-segment has three steps.
4

5
00:00:22,580 --> 00:00:29,180
1- Receiving the decimal digit binary code, 2-Encoding the decimal digit into the corresponding
5

6
00:00:29,180 --> 00:00:34,340
7-segment code, 3- Drive the target 7-segment display with this code
6

7
00:00:35,240 --> 00:00:42,020
This table shows a decimal digit, its binary and 7-segment codes. A multiplexer can be used 
7

8
00:00:42,020 --> 00:00:43,520
to encode the decimal digit. 
8

9
00:00:44,390 --> 00:00:50,030
The 10 7-segment codes drive the multiplexer inputs, and the decimal digit feeds the multiplexer control 
9

10
00:00:50,030 --> 00:00:53,580
signals as an index to connect proper input code to the output. 
10

11
00:00:54,260 --> 00:00:57,470
For example, Let’s consider the digit 6 as the input, 
11

12
00:00:57,950 --> 00:01:03,080
then its corresponding code is connected to the output and illuminates the 7-segments.
12

13
00:01:04,620 --> 00:01:08,130
Now, let’s write the HLS code for this simple combinational design. 
13

14
00:01:08,990 --> 00:01:16,350
A switch-case statement can describe the multiplexer. Each case represents an input in our multiplexer. 
14

15
00:01:17,260 --> 00:01:24,340
Notice that in the default case, I’ve assumed that all segments are off. This switch can be encapsulated 
15

16
00:01:24,340 --> 00:01:30,030
in a function that receives the decimal digit and returns the 7-segment control and data signals.
16

17
00:01:30,580 --> 00:01:33,130
As we just want to enable only one display, 
17

18
00:01:33,520 --> 00:01:37,450
the corresponding signal is 0 in the value of the common anode. 
18

19
00:01:37,990 --> 00:01:43,930
Finally, we should define the function arguments’ interfaces. As a group of simple wires implements them, 
19

20
00:01:44,080 --> 00:01:46,910
then their interface is ap_none. 
20

21
00:01:47,740 --> 00:01:51,490
In addition, there is no block-level signalling in this simple example, 
21

22
00:01:51,640 --> 00:01:57,280
then the interface attached to the funtion return is ap_ctrl_none.
22

23
00:01:59,590 --> 00:02:05,950
Now, we are able to show a decimal digit on a 7-segment. Is there any coding mechanism that facilitates 
23

24
00:02:05,950 --> 00:02:10,330
representing a multiple-digit decimal number on a set of seven-segments? 
24

25
00:02:11,110 --> 00:02:13,270
To answer this question, in the next lecture, 
25

26
00:02:13,390 --> 00:02:20,350
I will explain the Binary Coded Decimal (BCD) technique, which is widely used to represent multiple-digit 
26

27
00:02:20,350 --> 00:02:21,310
decimal numbers.
27

28
00:02:21,580 --> 00:02:27,200
Also, I show how to convert this coding mechanism into the 7-Segment display code.
28

29
00:02:27,910 --> 00:02:33,220
The takeaway message from this lecture is: The C-Code representing a combinational multiplexer can 
29

30
00:02:33,220 --> 00:02:35,500
describe the single 7-segment controller.
30

31
00:02:36,940 --> 00:02:37,940
Now the quiz question.
31

32
00:02:38,380 --> 00:02:44,050
Write the one_digit_seven_segment function explained earlier in this lecture by using the if-else 
32

33
00:02:44,050 --> 00:02:45,670
statement instead of switch-case.
