﻿1
00:00:06,950 --> 00:00:13,780
‫Welcomes the Alieu arithmetic logic unit explain lecture in this lecture I'm going to explain what North

2
00:00:13,790 --> 00:00:19,770
‫tech logic unit is and what will be designing and implementing on our FPGA for this lab.

3
00:00:21,080 --> 00:00:29,050
‫What is an arithmetic logic unit in Alieu is a part of a processor that performs all the logical and

4
00:00:29,080 --> 00:00:35,990
‫mathematical operations and the ACLU is very critical because it determines which mathematical operations

5
00:00:35,990 --> 00:00:37,510
‫or processor supports.

6
00:00:37,550 --> 00:00:44,270
‫If you're doing an image an addition subtraction multiplication division or any other mathematical operation

7
00:00:44,360 --> 00:00:48,170
‫it's all going to go through the arithmetic logic unit.

8
00:00:48,470 --> 00:00:53,640
‫And when you're designing an embedded system or selecting what kind of processor you want to use or

9
00:00:53,730 --> 00:00:59,480
‫if you're designing your own processor and FPGA or Nasik you're going to have to there there's several

10
00:00:59,480 --> 00:01:03,240
‫questions you have to ask yourself what do we want the Alieu to support.

11
00:01:03,470 --> 00:01:08,930
‫And some of these common questions will be was the number of floating point operations per second.

12
00:01:09,080 --> 00:01:14,030
‫If you're doing like a digital signal processing application you need to know how many of these operations

13
00:01:14,030 --> 00:01:16,120
‫can you do and your certain timeframe.

14
00:01:16,220 --> 00:01:17,780
‫So it becomes very important.

15
00:01:17,920 --> 00:01:23,570
‫And also the number of multiply and accumulate instructions per second if doing a good digital filtering

16
00:01:23,570 --> 00:01:26,090
‫operation this is very critical.

17
00:01:26,110 --> 00:01:32,410
‫Another thing you have to take into consideration what is the core size the common you have are 8 that

18
00:01:32,480 --> 00:01:36,350
‫16 bit 32 bit or 64 bit.

19
00:01:36,440 --> 00:01:41,060
‫If you're doing a really small and obviously the larger your bit size is of your core size.

20
00:01:41,060 --> 00:01:43,280
‫The more expensive your processor typically is.

21
00:01:43,280 --> 00:01:44,420
‫So you have to do that tradeoff.

22
00:01:44,420 --> 00:01:47,350
‫What do I need and what can I spend.

23
00:01:47,600 --> 00:01:50,590
‫In our case we're going to be designing one in VHDL.

24
00:01:50,600 --> 00:01:58,700
‫We're going to have it so we can have it an eight 16 32 64 128 will make it so that we can select any

25
00:01:58,700 --> 00:02:07,490
‫size core size we want what the different parts of the arithmetic logic unit they vary.

26
00:02:07,500 --> 00:02:13,530
‫You can customize them and design them in any way but the very basic or the core parts of an arithmetic

27
00:02:13,530 --> 00:02:14,690
‫logic are.

28
00:02:14,940 --> 00:02:24,360
‫You have various inputs and various outputs and these inputs you have a B in code your input is one

29
00:02:24,360 --> 00:02:26,860
‫of the values that you're going to be operating on.

30
00:02:27,100 --> 00:02:28,350
‫And same with your B input.

31
00:02:28,350 --> 00:02:30,870
‫This is another value you're going to be operating on.

32
00:02:30,870 --> 00:02:38,550
‫And so depending upon your core size if you have a core size 8 that's your a and b are going to be 8

33
00:02:38,550 --> 00:02:39,700
‫bits wide.

34
00:02:39,750 --> 00:02:45,450
‫Same if you like the core size of 32 bits you're a and b are going to be 32 bits wide and so on and

35
00:02:45,450 --> 00:02:46,440
‫so forth.

36
00:02:46,440 --> 00:02:52,230
‫And as we'll see in the lab we can make this configurable so you to select the core size and you automatically

37
00:02:52,230 --> 00:02:57,390
‫make a and b and all the other signals and registers that need to be that size.

38
00:02:57,420 --> 00:03:01,340
‫Why exactly assume that then you also have the opcode.

39
00:03:01,530 --> 00:03:08,700
‫This determines the operation of the ACLU or the multiplying or subtracting or dividing and that's based

40
00:03:08,700 --> 00:03:14,190
‫on the input of the opcode and we'll go through and explain a little more detail how the opcode interacts

41
00:03:14,190 --> 00:03:16,370
‫with a A and B inputs.

42
00:03:16,590 --> 00:03:21,060
‫You also have the outputs which we have the result in the air.

43
00:03:21,060 --> 00:03:25,050
‫The result is as the name indicates the result of your operation.

44
00:03:25,050 --> 00:03:32,550
‫So if my opcode says I want to add my result it's going to be a plus b if I'm going to subtract my results

45
00:03:32,550 --> 00:03:37,920
‫going to be a minus B or BMI my essay and that's all going to be determined by the opcode.

46
00:03:38,130 --> 00:03:40,400
‫And then also all have an air.

47
00:03:40,410 --> 00:03:45,150
‫This will tell you if you have certain operations one if your opcode is telling you to do something

48
00:03:45,150 --> 00:03:51,730
‫that your Alieu doesn't support or a lot of times this is a very commonly used with an overflow flag.

49
00:03:51,960 --> 00:03:57,960
‫If you're doing an addition an A and B are such large numbers that the result is not large enough it

50
00:03:57,960 --> 00:04:00,000
‫can't fit in there or it overflows.

51
00:04:00,150 --> 00:04:06,030
‫You'll get an there and you can also add different things onto your alle Alieu earth to logic.

52
00:04:06,180 --> 00:04:12,290
‫This is just kind of a basic general set of where you most likely start.

53
00:04:12,650 --> 00:04:15,630
‫Now let's talk about Alieu instruction set.

54
00:04:15,630 --> 00:04:21,240
‫So for example as I said you want to support multiple different instructions so your opcode is what's

55
00:04:21,240 --> 00:04:23,320
‫determining what the output is.

56
00:04:23,580 --> 00:04:24,550
‫So we have a table.

57
00:04:24,600 --> 00:04:30,480
‫And when you're designing an Alieu you want to have a table that tells the user or whoever you are designing

58
00:04:30,480 --> 00:04:34,950
‫this for can understand OK what are my different operations the Alieu supports.

59
00:04:34,950 --> 00:04:42,670
‫So for example mount code zero I'll get an output of say the code is 1 I get an output a B if my code

60
00:04:42,670 --> 00:04:46,220
‫is for I get not a version of AA.

61
00:04:46,500 --> 00:04:49,800
‫And in this case we have opcodes 0 through 11.

62
00:04:49,950 --> 00:04:56,150
‫So we're supporting 12 different operations and we can have the many operations as we want.

63
00:04:56,280 --> 00:05:01,550
‫Just the more you add the more complex and maybe the more expensive it is we have to make a decision

64
00:05:01,560 --> 00:05:03,780
‫what operations do I need.

65
00:05:03,880 --> 00:05:09,510
‫Logical and mathematical do I need my arithmetic logic unit to support my processor.

66
00:05:13,020 --> 00:05:17,510
‫Now let's talk about the VHDL representation of an arithmetic logic unit.

67
00:05:17,520 --> 00:05:21,570
‫So now we kind of understand OK here's the background here's what I want it to do.

68
00:05:21,600 --> 00:05:24,410
‫I have an opcode I have a B results.

69
00:05:24,450 --> 00:05:27,660
‫Err how to actually make that happen in the HGL.

70
00:05:27,990 --> 00:05:32,460
‫Well the way you would do that and there are various ways but the way I would suggest or the way I would

71
00:05:32,460 --> 00:05:35,880
‫do it is using a case statement.

72
00:05:35,880 --> 00:05:43,470
‫So for example we have a process we're calling state up and we have the inputs or in the sensitivity

73
00:05:43,470 --> 00:05:46,410
‫list opcode A and B.

74
00:05:46,530 --> 00:05:55,500
‫So anytime I change my opcode or I change my A or my B value my result in my air my outputs are going

75
00:05:55,500 --> 00:05:56,430
‫to be updated.

76
00:05:56,610 --> 00:06:02,610
‫So we'll begin a K-State and then make the most sense that is K-State operate on the opcode because

77
00:06:02,610 --> 00:06:08,540
‫based on the opcode is going to determine what we do with a and b to get our result in air.

78
00:06:08,790 --> 00:06:15,510
‫So in this case we have a opcode if the opcode is all zeroes the output is a refer back to the opcode

79
00:06:15,660 --> 00:06:16,560
‫table.

80
00:06:16,590 --> 00:06:18,460
‫So my result is equal to A.

81
00:06:18,540 --> 00:06:19,820
‫And I don't have any errors.

82
00:06:19,860 --> 00:06:22,020
‫So air is equal to zero.

83
00:06:22,510 --> 00:06:26,380
‫Just Similarly if my opcode is one my output is B.

84
00:06:26,400 --> 00:06:31,080
‫So now my result is equal to the B and my air is equal to zero.

85
00:06:31,080 --> 00:06:37,660
‫And if I do my now is equal to then I know that my output is a plus b.

86
00:06:37,650 --> 00:06:40,230
‫So my result is equal to A plus B.

87
00:06:40,350 --> 00:06:42,440
‫My air is equal to zero.

88
00:06:42,740 --> 00:06:46,470
‫And so if we add more instructions we would just extend this case statement.

89
00:06:46,500 --> 00:06:52,770
‫So if we have if we support 100 different Alieu instructions in my case is going to have 100 different

90
00:06:52,770 --> 00:06:59,260
‫cases and you can kind of customize or add more cases as your instruction set to Alieu grows.

91
00:06:59,260 --> 00:07:05,550
‫And so this is just kind of an example way you could represent an Alieu and VHDL.

92
00:07:05,630 --> 00:07:10,530
‫Now you understand how when Alieu is and how it works let's get started designing one.

