YouTube2Text

W2 SystemVerilog Part2 EN — Transcript

by Hasan Erdem Yantır · 10,122 words · 1,759 segments · language en · Watch on YouTube

Full transcript

  1. 0:02So, then we can switch to English,
  2. 0:04right?
  3. 0:06Okay. Welcome.
  4. 0:10Did you understand that? No problem? Did
  5. 0:13you understand fully?
  6. 0:15Is there any question?
  7. 0:19Okay, these are for the sequential and
  8. 0:22compilation logic.
  9. 0:24And then now we now we are going to
  10. 0:26switch the blocking and non-blocking
  11. 0:27assignments.
  12. 0:28Uh
  13. 0:30There are two type of assignment
  14. 0:32statements in System Verilog. One of
  15. 0:34them is blocking and other one is
  16. 0:36non-blocking. There is a small
  17. 0:38difference between them. Not small, by
  18. 0:39the way. It is very important concept.
  19. 0:42Uh if you
  20. 0:44describing it as a smaller than equal,
  21. 0:47it's a non-blocking assignment. If it is
  22. 0:49equal, blocking assignment.
  23. 0:51In here, I didn't mention, but
  24. 0:54as you
  25. 0:55can notice, this is a different
  26. 0:58assignment statement when you look at
  27. 1:00the
  28. 1:01combinational ones. Combinational one is
  29. 1:03just equal,
  30. 1:04but in sequential ones, while assigning,
  31. 1:07I use
  32. 1:08less than and equal sign.
  33. 1:12So,
  34. 1:14in here,
  35. 1:16while writing a sequential statement, I
  36. 1:18am using
  37. 1:19non-blocking assignment. And while
  38. 1:21writing a combinational logic, while
  39. 1:24describing a combinational logic, I am
  40. 1:25using the blocking assignment.
  41. 1:28Non-blocking assignment means that it
  42. 1:30occurs simultaneously with others, as
  43. 1:32parallel. And blocking assignment means
  44. 1:35that it occurs in order it appears in
  45. 1:37file.
  46. 1:38Uh let's do an example and understand
  47. 1:41the difference.
  48. 1:42For example, in here,
  49. 1:44I have an example
  50. 1:46uh for
  51. 1:48non-blocking assignments. I have a
  52. 1:50clock. I have a D input and Q output.
  53. 1:52This is a just a flip-flop.
  54. 1:55But in here,
  55. 1:57when clock comes
  56. 2:00I am getting the D input and assigning
  57. 2:02it to N1. And N1, by the way, is a logic
  58. 2:05inside the module. We we define a logic
  59. 2:07signal also inside the module.
  60. 2:10And then this N1
  61. 2:13if clock comes in the rising edge of
  62. 2:15clock
  63. 2:17I am assigning D to N1 and assigning N1
  64. 2:20to Q.
  65. 2:22Okay?
  66. 2:23In here
  67. 2:25I used the non-blocking assignment. So,
  68. 2:27when I synthesize this circuit, what
  69. 2:29happens?
  70. 2:31This clock comes.
  71. 2:33Whenever this clock rises
  72. 2:35this D is assigned to N1.
  73. 2:38But, since this assignment is
  74. 2:40non-blocking
  75. 2:41these assignments occurs at the same
  76. 2:43time. So, this D
  77. 2:46sends the new value. This N1 gets the
  78. 2:48value of D, but this Q gets the value of
  79. 2:52N1, but not the
  80. 2:55the not not the current value, previous
  81. 2:57value of N1. So, this circuit
  82. 3:00corresponds to two flip-flops.
  83. 3:03When clock comes, this is clock. When
  84. 3:05this clock comes, D is assigned to this
  85. 3:09N1.
  86. 3:10Here is the N1 point.
  87. 3:12But, at the same time the previous value
  88. 3:15of N1 is stored in this flip-flop.
  89. 3:18That's why we this this code corresponds
  90. 3:22to two flip-flops connected as
  91. 3:25serial.
  92. 3:28This is the use of non-blocking
  93. 3:30assignment.
  94. 3:32What about the misuse?
  95. 3:35For example, in an always FF block, if I
  96. 3:37use a blocking assignment then it means
  97. 3:41that
  98. 3:42blocking assignment says that it occurs
  99. 3:44in order it appears in file.
  100. 3:47So
  101. 3:48in this assignment it for
  102. 3:50first N1 gets the value of D.
  103. 3:53And we are doing this assignment in
  104. 3:56sequential. This
  105. 3:58N1 gets the new value.
  106. 4:01And in the second
  107. 4:03statement, this new value is assigned to
  108. 4:06Q.
  109. 4:07So, for example,
  110. 4:10in the non-blocking one, the N1 was
  111. 4:14getting the value of D and Q was getting
  112. 4:16the previous value of N1. For this
  113. 4:18reason, we put two two flip-flops. But,
  114. 4:20in here,
  115. 4:21N1 was getting the value of D and Q was
  116. 4:24getting the value of N1, but the new
  117. 4:26value. So, it means that Q was getting Q
  118. 4:29is getting the value of D.
  119. 4:31So, then it turns to a single flip-flop.
  120. 4:35Because whenever clock comes, D is
  121. 4:38directly assigned to Q. For this reason,
  122. 4:41if you misuse uh
  123. 4:44for example, if you use a blocking
  124. 4:46non-blocking assignment in a always FF
  125. 4:48block instead of non-blocking
  126. 4:50assignment, it turns to a single
  127. 4:52flip-flop. And this is the misuse,
  128. 4:54because maybe you want to build this two
  129. 4:57flip-flop like shift register, for
  130. 4:59example. Uh
  131. 5:00but, if you use a blocking assignment in
  132. 5:03here,
  133. 5:04uh
  134. 5:06you can get the single flip-flop uh
  135. 5:09mistakenly.
  136. 5:11Is this clear?
  137. 5:15So, it's a rule that if you are building
  138. 5:18a logic always FF block, for example, if
  139. 5:20you are building a logic in always FF
  140. 5:23block, you have to use non-blocking
  141. 5:24assignment. And in always comp
  142. 5:26statements, you have to use blocking
  143. 5:28assignments. This is a general rule.
  144. 5:30Rule. Uh
  145. 5:32yeah, I can give an example, for
  146. 5:33example, in for the for the always comp
  147. 5:36block. For example, this is always comp
  148. 5:39block.
  149. 5:40And in always comp block, for example, I
  150. 5:43am assign I am doing D and C operation
  151. 5:46and assigning it to A and in the second
  152. 5:51row, I am for example getting not of A
  153. 5:54and assigning it to the D.
  154. 5:57In always comp block, most likely you
  155. 5:59want to do first end operation and after
  156. 6:02that you want to get the inverse of this
  157. 6:05end operation and assign it to D. For
  158. 6:07this reason, people use blocking
  159. 6:09assignments because in always comp
  160. 6:12block, we are doing it in sequentially.
  161. 6:14First doing this one, this operation,
  162. 6:16and then using the result of this
  163. 6:18operation as an input to the next
  164. 6:20operation. But in sequential blocks,
  165. 6:23people generally want to build
  166. 6:27sequential logic. Uh so,
  167. 6:30in here
  168. 6:32it is different. People wants to use for
  169. 6:34example use this operation, but at the
  170. 6:37same time people want to also do this
  171. 6:40operation.
  172. 6:41Uh not using the result of
  173. 6:45the
  174. 6:46the result of the previous flip-flop,
  175. 6:48for example.
  176. 6:50For this reason, people generally if you
  177. 6:52are writing a code in SystemVerilog, you
  178. 6:56you want to use non-blocking assignment
  179. 6:58in always FF statements and blocking
  180. 7:00assignment is in always comp blocks.
  181. 7:04So, it's a rule of thumb.
  182. 7:08And in simple combination logic, also
  183. 7:10people use continuous assignment. This
  184. 7:12is continuous assignment. This is a
  185. 7:14different assign-
  186. 7:16And more complicated combination logic,
  187. 7:18we use always comp and use blocking
  188. 7:21assignment. And in synchronous
  189. 7:22sequential logic in always FF statement,
  190. 7:25we use non-blocking assignments.
  191. 7:28Uh
  192. 7:29this is the question that you ask.
  193. 7:31Assign a signal in only one always
  194. 7:34statement or continuous assignment
  195. 7:36statement. Otherwise, the tool cannot
  196. 7:38understand and it generates
  197. 7:40uh wrong
  198. 7:42actually circuit.
  199. 7:46Is there any question
  200. 7:48until now about System Verilog?
  201. 7:54No question?
  202. 7:57Okay, we can see one more concept. In In
  203. 7:59this class, I will show you some
  204. 8:00concepts of System Verilog, but you can
  205. 8:03take a System
  206. 8:05Verilog course
  207. 8:07uh because I will I will try to teach
  208. 8:09you System Verilog in just one week, uh
  209. 8:11but of course System Verilog is very
  210. 8:13huge class.
  211. 8:14Uh
  212. 8:15huge topic. So, if you want, you can
  213. 8:17Google it. You can take a class on
  214. 8:20System Verilog.
  215. 8:22Uh
  216. 8:23but there are lots of different concepts
  217. 8:25of a System Verilog you you can learn.
  218. 8:28Uh most likely I will not teach you. For
  219. 8:30example, there are functions, uh there
  220. 8:32are package types. I will mention a
  221. 8:33little bit, but you can learn yourself
  222. 8:36also because in here I will teach in
  223. 8:38just in one week.
  224. 8:41Another concept in System Verilog is the
  225. 8:43module parameterization.
  226. 8:45Uh for example, previously
  227. 8:48we wrote a module mux two, and it was
  228. 8:51getting four-bit inputs.
  229. 8:54But what if for example if I want to
  230. 8:56write I want to write a module, and this
  231. 8:59module can get n-bit input?
  232. 9:02For example, if I give the n as
  233. 9:04four-bit, this module will behave as a
  234. 9:06four-bit mux. If I give it a eight, this
  235. 9:09module will behave as a eight-bit mux.
  236. 9:11How can I do it? Uh the method is module
  237. 9:14parameterization.
  238. 9:15In here, while defining the module,
  239. 9:18I am putting a dash in here, module
  240. 9:20module name, and I am putting a dash in
  241. 9:23here, and
  242. 9:25in here I am specifying the parameters.
  243. 9:28For example, in here I have a parameter.
  244. 9:30This parameter says that uh the module
  245. 9:32has a width parameter. This is integer
  246. 9:34parameter. If I I If I didn't write
  247. 9:36anything, it means it is integer
  248. 9:38parameter. Parameter width and it is
  249. 9:41default value. Default value is eight.
  250. 9:43And
  251. 9:44inside the module
  252. 9:46from now on, I am defining everything in
  253. 9:48terms of width. For example, my D0 and
  254. 9:51D1 inputs are
  255. 9:53the width size.
  256. 9:56Defining according to this parameter.
  257. 9:59And my output is in the same size and S
  258. 10:02is single bit input. There is no
  259. 10:04parameter definition in here and this is
  260. 10:06my output.
  261. 10:07So, while using this max module, while
  262. 10:10calling it
  263. 10:11then now I am also giving the parameter
  264. 10:15width. For example, in here
  265. 10:18By the way, if I want to use it as a
  266. 10:20with default value, default value is
  267. 10:22eight. You don't have to specify default
  268. 10:24value, but if you if you want to use it
  269. 10:27with your default value and if you
  270. 10:29define it
  271. 10:31then for example, you can just call the
  272. 10:35module
  273. 10:37as is as we did before.
  274. 10:39And since it is default value is eight,
  275. 10:41it it behaves as a eight-bit max.
  276. 10:44But
  277. 10:45if you want to make it for example
  278. 10:4712-bit then you you want you need to
  279. 10:51give
  280. 10:52this 12 as the parameter width
  281. 10:54parameter.
  282. 10:55So, for example, in here our
  283. 10:58in in this call,
  284. 11:00I am giving the width 12 and this module
  285. 11:03becomes 12-bit max from now on.
  286. 11:07So, in here this D0 and D1 inputs must
  287. 11:10be 12-bits.
  288. 11:13There is also another construct that you
  289. 11:15can use type def enum.
  290. 11:18This type def is used to create a new
  291. 11:20data type. For example, until now we saw
  292. 11:22only one data type. It was logic and we
  293. 11:25saw three, but forget three. No problem
  294. 11:27with three. We will not use it.
  295. 11:29But for example, you can define a logic
  296. 11:32data type For example, you can define a
  297. 11:34data type that corresponds to 8-bit
  298. 11:37value. For example, this say We are In
  299. 11:40here, we are defining a data type uh
  300. 11:43type def logic
  301. 11:4570. It means that 8-bit value, and I
  302. 11:48named it as a logic 8.
  303. 11:51So, from now on, whenever I wrote logic
  304. 11:548, it means that logic 70. But, I am
  305. 11:58just calling it as a logic 8. For
  306. 12:00example, in here, I told logic 8
  307. 12:02example, it means that example is a
  308. 12:058-bit value, 8-bit signal.
  309. 12:08So, these are
  310. 12:10these two are equal.
  311. 12:18There is also another struct enum. Enum
  312. 12:21is used to create enumerated data type.
  313. 12:24Uh this is a little bit different.
  314. 12:27Uh In here, I was I was defining a data
  315. 12:30type, but in enum, I am saying that
  316. 12:35I I have
  317. 12:37two bit signals. For example, in here, I
  318. 12:40am saying that type def enum,
  319. 12:42and I am saying that enum type def enum
  320. 12:44is a keyword in here, and I am saying
  321. 12:46that I have a two bit two bit signal.
  322. 12:51And this two bit signal can take these
  323. 12:53values: idle, reading, writing.
  324. 12:56And the name of this enum type is FSMT.
  325. 13:02So,
  326. 13:04for example, in here, I defined a FSMT
  327. 13:07type FSM I I
  328. 13:11defined FSMT and
  329. 13:13name it as example state.
  330. 13:17This example state actually is a two bit
  331. 13:19logic value, but its value becomes idle,
  332. 13:22reading, or writing.
  333. 13:24You can, for example, assign For
  334. 13:26example, example state
  335. 13:29and assign example state to idle.
  336. 13:32How this
  337. 13:34runs?
  338. 13:35For example, the in here, the tool
  339. 13:37assigns some values to idle, reading,
  340. 13:39and writing. For example, it says that
  341. 13:41idle is 00, reading is 01, writing is
  342. 13:4411, for example.
  343. 13:46And then whenever you assign idle to
  344. 13:49this example state, actually it assigns
  345. 13:5100.
  346. 13:52The good thing in using enum is that
  347. 13:55while running simulation in the
  348. 13:57waveform, you can instead of reading the
  349. 13:59zeros ones, you can read the state. For
  350. 14:02example, if you define a, for example,
  351. 14:04finite state machines and it has
  352. 14:05different states, for example, it has a
  353. 14:07init state, it has read state, it has a
  354. 14:09write state. Instead of looking to do
  355. 14:120011 in the waveform, you can just
  356. 14:16directly see the state names. For
  357. 14:18example, read, write, idle. So, the good
  358. 14:20thing by using enum is
  359. 14:23only this one. But and it is very, by
  360. 14:26the way, it's very useful
  361. 14:28data type.
  362. 14:33This is This was typedef. If you want to
  363. 14:36just define a basic type definition by
  364. 14:39using logic,
  365. 14:40you can use typedef. Typedef enum is
  366. 14:43that I described. You are enumerating
  367. 14:45the type. Yeah, just enumerating it
  368. 14:47means that you are assigning a word to a
  369. 14:49number.
  370. 14:51And there is also another structure,
  371. 14:54typedef struct. This is very useful,
  372. 14:56also.
  373. 14:57You can use typedef struct
  374. 15:00to create a new struct data type. Struct
  375. 15:02means in here that it consists of more
  376. 15:04than data type. For example, in here, I
  377. 15:07am designing a typedef struct.
  378. 15:09Typedef struct package. This is a
  379. 15:11package data type and its name is called
  380. 15:15ST control, for example.
  381. 15:18For example, in here,
  382. 15:20in this data type, I have a four-bit
  383. 15:24mode,
  384. 15:25three-bit configuration, and one-bit
  385. 15:27enable field, for example. So, it
  386. 15:29consists of this data type. ST control
  387. 15:32consists of these three different
  388. 15:35values.
  389. 15:37And each of them has different number of
  390. 15:40bits, for example.
  391. 15:42So, how can you use it? Maybe I can give
  392. 15:45an example. For example, this are By the
  393. 15:47way, this is bit.
  394. 15:49Until now, I showed you logic logic 108
  395. 15:53and Z. If you define it as a bit, bit
  396. 15:56logic is same, but bit can have a value
  397. 15:59only one or zero,
  398. 16:01not X and Z.
  399. 16:03So, you can use bit also, but what when
  400. 16:06you run simulation and if you use bit,
  401. 16:08you can only see one or zero.
  402. 16:11But if you use logic in the simulation,
  403. 16:13you can see X and Z also at the same
  404. 16:17time.
  405. 16:18But, of course, if you use logic,
  406. 16:20logic
  407. 16:22corresponds to two-bit because it has a
  408. 16:24four states.
  409. 16:26Then, simulation runs a little bit
  410. 16:28slower. So, there is a slight difference
  411. 16:30only. But still, but using logic is
  412. 16:34better still.
  413. 16:35I can give an example to this struct
  414. 16:38type. For example, in here, you want to
  415. 16:41define
  416. 16:42a
  417. 16:44ST control data type.
  418. 16:46For example, I can say that my control,
  419. 16:49for example. I
  420. 16:50In a similar way,
  421. 16:52I am just writing the type name. This is
  422. 16:54a type name, type def name, and this is
  423. 16:57my type. And my controller
  424. 17:01from now on, my controller has these
  425. 17:04fields. It's a signal. This my control
  426. 17:07is a signal, and this signal has
  427. 17:10four-bit mode, three-bit configuration,
  428. 17:12and one-bit enable. And in order to
  429. 17:14access these values, you will to just
  430. 17:17write my control
  431. 17:19{dot} for example enable. If you want to
  432. 17:21enable access to enable bit. If you want
  433. 17:24to access the mode for example, you need
  434. 17:26to say my control {dot} mode.
  435. 17:29You can access with {dot}.
  436. 17:37This is type def struct. If you write
  437. 17:38type def struct, you are combining
  438. 17:40different types of data types
  439. 17:44and then forming a new data type.
  440. 17:46But there is also type def union.
  441. 17:49Type def the union, there is a slight
  442. 17:51difference between type def struct and
  443. 17:52type def union. In type def union,
  444. 17:55you are forming the different views of
  445. 17:57the same data.
  446. 17:59In here for example, this this struct
  447. 18:02actually
  448. 18:03total there is four bit in here, three
  449. 18:06bit in here, one bit here. This is total
  450. 18:08eight bit.
  451. 18:09But in here, I defined a data type type
  452. 18:13def union patch. Now, I use union.
  453. 18:17And this data type says that I have a
  454. 18:20data this data. For example, I can
  455. 18:23create a data by using this union type
  456. 18:25data type data. For example, my data.
  457. 18:29And this my data consists of either data
  458. 18:33byte view or data half view. For
  459. 18:35example, when you look at data byte is
  460. 18:3816 bit.
  461. 18:39Data half is 16 bit.
  462. 18:42But they keep the same value. It is not
  463. 18:44total. It is totally 16 bit.
  464. 18:48It's not 32 bit. In here, it was the
  465. 18:51combination of them. But in union, it is
  466. 18:54either of them.
  467. 18:56Either you can represent it as a
  468. 18:58either data byte or data half.
  469. 19:01But it is same. It is same 16 bit. You
  470. 19:04can either represent it as a 0 to 15 or
  471. 19:08it says that two dimensional logic
  472. 19:10array.
  473. 19:11It says that either two dimensional
  474. 19:13logic array from zero to seven.
  475. 19:18By the way,
  476. 19:21we saw one dimensional vectors. This is
  477. 19:24one dimensional vector. This is two
  478. 19:25dimensional vector. If you want to
  479. 19:27define a two dimensional vector like
  480. 19:29this one,
  481. 19:30you are saying that this is one to zero
  482. 19:33and each of them is
  483. 19:35from zero to seven. So, it is a two
  484. 19:38dimensional vector.
  485. 19:39You can define two dimensional logic
  486. 19:41vector in this way also.
  487. 19:43And everyone, you can add more
  488. 19:45dimensions here and you can define three
  489. 19:48dimensions also.
  490. 19:54So, in my data, for example, if you want
  491. 19:57to represent it as a data hub, you need
  492. 20:00to write my data data hub.
  493. 20:03If you want to represent it as a data
  494. 20:05byte, you need to write my data dot data
  495. 20:08byte.
  496. 20:10But, for example, if you change the, for
  497. 20:12example,
  498. 20:13fourth bit of this data hub,
  499. 20:16it also changed the data byte
  500. 20:17corresponding bit of the data byte
  501. 20:19because they are the same data. It's
  502. 20:21only representation. Union
  503. 20:23actually only representation changes the
  504. 20:25representation. While accessing by using
  505. 20:28data hub, you can access it as a one
  506. 20:30dimensional vector. While accessing
  507. 20:32through the data byte, you can access it
  508. 20:35by using two dimensional access. In
  509. 20:38order to do access, for example, if you
  510. 20:40say that my data
  511. 20:43data hub, for example,
  512. 20:46five,
  513. 20:47it is the same data as my data
  514. 20:51data byte
  515. 20:54first dimension, zero and five.
  516. 20:57It is same.
  517. 20:59If it is, for example, 10, my data data
  518. 21:01hub 10, it corresponds to my data dot
  519. 21:05data byte one because I need to switch
  520. 21:08the other row.
  521. 21:10And
  522. 21:11uh in here second element of the other
  523. 21:14row.
  524. 21:15Okay?
  525. 21:18Yes, one two.
  526. 21:21Is it clear?
  527. 21:24Okay.
  528. 21:25Now, I will give you some examples about
  529. 21:28the finite state machines.
  530. 21:30Uh
  531. 21:31Finite state machines are two types.
  532. 21:33Now, we will see how to define the
  533. 21:35finite state machines using the
  534. 21:36SystemVerilog.
  535. 21:37Uh finite state machines
  536. 21:39uh has next state logic, state register,
  537. 21:42and output logic. In here I have a I
  538. 21:45have a register. This keeps the state.
  539. 21:47And in order to build a finite state
  540. 21:49machine, always you have these three
  541. 21:52components: next state logic, state
  542. 21:54register, and output logic. This is the
  543. 21:56output logic. Output logic decides on
  544. 21:58the output. Next state logic decides on
  545. 22:01the next state. So, whenever I reach a
  546. 22:05state in order to decide on the next
  547. 22:07state, I need to give
  548. 22:09this state to my next state logic and
  549. 22:11inputs also. And this one
  550. 22:14this block generates the next state.
  551. 22:16But, this is combinational block.
  552. 22:18Whenever clock comes, we are switching
  553. 22:20to next state.
  554. 22:22And this here in here we are keeping our
  555. 22:25state.
  556. 22:29There are two types, Moore and Mealy.
  557. 22:32The only difference is that in Moore
  558. 22:34output is depends on the state. In
  559. 22:37Mealy, output is depends on both input
  560. 22:39and state at the same time. This is the
  561. 22:41difference. But, by the way, while
  562. 22:42writing a code, we don't care whether it
  563. 22:45is Moore and Mealy. Well, the synthesize
  564. 22:48tool
  565. 22:49uh can do what can put whatever
  566. 22:52it wants.
  567. 22:53Uh that's why I mentioned about
  568. 22:55abstraction. We don't care whether it is
  569. 22:57Moore and Mealy because it is abstracted
  570. 22:59to us. Uh we don't deal with them.
  571. 23:03So, in here I have an example of a
  572. 23:05finite state machine. I have a clock
  573. 23:07input, reset input, and Q. Reset in here
  574. 23:10is important because this is a good
  575. 23:12example. While when I started the finite
  576. 23:15state machine, I need to start with a
  577. 23:17known state. For this reason, I have to
  578. 23:20use reset, for example.
  579. 23:21For this reason in here, I have to use
  580. 23:23reset
  581. 23:25to initialize the registers.
  582. 23:29In here, I have module module as clock,
  583. 23:32reset, input, and Q output. This module
  584. 23:34has no
  585. 23:35has no input, by the way. It has a
  586. 23:39output, just output.
  587. 23:41And what it does, it has three state,
  588. 23:44and I defined the state as enum.
  589. 23:48So, type def enum logic, it says that
  590. 23:50two-bit value. I have a two-bit
  591. 23:52enumerated values, and they are S0, S1,
  592. 23:56and S2. You can put S3, by the way, but
  593. 24:00we are not using S3, for this reason we
  594. 24:01do not put. Most likely, S3 corresponds
  595. 24:03to zero, S1 corresponds to, for example,
  596. 24:0501, S2 corresponds to 10, and there is
  597. 24:09no state corresponding to 11.
  598. 24:12This is two-bit. Two-bit represents four
  599. 24:14value, but we are only using three-bit.
  600. 24:18Still, we keep we need to use two-bit to
  601. 24:19keep it, but we we we have three-bit in
  602. 24:23here.
  603. 24:24And
  604. 24:26by using this enumerated state type, I
  605. 24:29am defining two variables, two signals.
  606. 24:31One of them is state, and other one is
  607. 24:33the next state.
  608. 24:35So, most likely, this is the next state.
  609. 24:38Whenever clock comes, I have I will
  610. 24:41assign this next state to state.
  611. 24:44In here, I have a flip-flop.
  612. 24:47This flip-flop has a asynchronous reset,
  613. 24:50and positive edge flip-flop. Whenever
  614. 24:53reset comes, I am initializing the state
  615. 24:55to S0.
  616. 24:57But otherwise, if there is no reset,
  617. 25:01I am always assigning next state to
  618. 25:03state as I draw here.
  619. 25:06And this is the next state logic.
  620. 25:08By the way, for the flip-flop, in order
  621. 25:11to use form flip-flop, I use always FF
  622. 25:14statement.
  623. 25:16In here, in order to define on the next
  624. 25:18state logic,
  625. 25:20I am using always comb block
  626. 25:23because this is combinational.
  627. 25:25And in this combinational logic, I am
  628. 25:28saying that, by the way, this finite
  629. 25:30state machine just it has an input, for
  630. 25:33example, clock input.
  631. 25:36And whenever, for example, this clock
  632. 25:38comes three times,
  633. 25:41and in the, for example, in here, when
  634. 25:44it comes third time, it gives one.
  635. 25:48It gives a one value. It is divide by
  636. 25:50three. So, clock comes
  637. 25:55and
  638. 25:56at each at every
  639. 25:59third occurrence of the clock, it gives
  640. 26:01a logic one.
  641. 26:03Okay, what what this FSM is doing.
  642. 26:06So, when I look at the next state logic,
  643. 26:10every time
  644. 26:12when when I was in a state, I am
  645. 26:14switching to the next state. For
  646. 26:16example, while I was in S0 state, I am
  647. 26:19switching to the S1 state. If I am in S1
  648. 26:22state, I am switching to S2 S2 state.
  649. 26:25Which as in S2, I am switching to S0
  650. 26:27state.
  651. 26:28And in default, I put a default value in
  652. 26:30here not to create a latch
  653. 26:34mistakenly
  654. 26:36for
  655. 26:37This is my default value.
  656. 26:40In the default one, the next state is
  657. 26:42S0. And output logic, this is also a
  658. 26:45combinational logic. You can build the
  659. 26:47combinational logic by using always
  660. 26:49comb. But in here,
  661. 26:50in the example, we put we use a size
  662. 26:53statement. In this assignment statement
  663. 26:55it says that
  664. 26:57if state is zero S0, it is equality
  665. 27:00comparison. If state if if state is S0,
  666. 27:04this gives one.
  667. 27:06So, state equal equal means that
  668. 27:08comparison. If state is equal to S0, I
  669. 27:11am assigning
  670. 27:13uh
  671. 27:14one to Q.
  672. 27:17So, whenever state becomes, for example,
  673. 27:19in here it is first
  674. 27:21uh
  675. 27:23Yeah, in for example, assume that it is
  676. 27:25in here, state is S1.
  677. 27:28It is S2 S2 and immediately it goes to
  678. 27:32S0. Whenever it becomes state becomes
  679. 27:34S0, during that time Q becomes Q gives
  680. 27:37the value of one.
  681. 27:40And this is the corresponding
  682. 27:42uh system Verilog code. Is it clear?
  683. 27:45Do you have any question?
  684. 27:50Uh this is also another example.
  685. 27:53Uh in here I am doing a sequence
  686. 27:55detection.
  687. 28:01So,
  688. 28:02for example, which sequence I am
  689. 28:04detecting in here?
  690. 28:05Uh
  691. 28:07For example,
  692. 28:10yeah, this is the FSM state diagram.
  693. 28:13Most likely you are familiar with this
  694. 28:15diagrams from your logic design course.
  695. 28:19Uh so, in the I said I'm starting with
  696. 28:21S0 state and in S0 I am giving the
  697. 28:24output as zero. Whenever one comes, I am
  698. 28:27staying in S0, but whenever
  699. 28:30zero comes, I am switching to S1 state.
  700. 28:33But in S1 state I am still giving the
  701. 28:36output as zero.
  702. 28:37In S1 state, while zero comes, I am
  703. 28:40staying in this state and whenever one
  704. 28:42comes, I am switching to S2 state and in
  705. 28:45S2 state I am giving an output one.
  706. 28:49And while in S2 state, if zero comes, I
  707. 28:53am switching back to S1 state. If one
  708. 28:55comes, I am switching to S0 state.
  709. 28:57So, basically, actually, this one just
  710. 28:59detects
  711. 29:01For example, when you look at here, it
  712. 29:03detects
  713. 29:04for example, zero
  714. 29:07one.
  715. 29:08Right? If uh when I started from here,
  716. 29:11if zero comes and then after one comes,
  717. 29:14if I detect zero one, it gives one.
  718. 29:17So, that's why when another zero comes
  719. 29:20here, it goes back to S1 state and waits
  720. 29:23for another one to to give one. So,
  721. 29:26whenever in this one, if another zero
  722. 29:29comes, it goes to S1 state and waits for
  723. 29:31another one. So,
  724. 29:33it switches back to S2 state and gives
  725. 29:35the one as output.
  726. 29:37And this is the corresponding Verilog
  727. 29:39code. Still, I am using a type def enum
  728. 29:41logic in here to to to show the states
  729. 29:45state types. And I have two state types,
  730. 29:47one of them current one and other one is
  731. 29:49the next one. This is my flip flop.
  732. 29:51This is just two flip two two-bit flip
  733. 29:54flop because it keeps states.
  734. 29:56And
  735. 29:58this is my next state logic always comb
  736. 30:01block.
  737. 30:02Uh now,
  738. 30:03I am not just changing the state because
  739. 30:06input is also important. I have an input
  740. 30:08in here. My input is A.
  741. 30:10And
  742. 30:12if, for example, A in S0 state, if A is
  743. 30:16one, I am keep staying in S0 state.
  744. 30:20Uh but, if it is zero, I am switching to
  745. 30:24S1 state. So, in the next state logic,
  746. 30:27now,
  747. 30:28the input also matters for this reason.
  748. 30:31Uh I am also uh
  749. 30:34using if-else statements to decide on
  750. 30:36the next state. This one uh decides on
  751. 30:40the next state.
  752. 30:42And also in here, I have also
  753. 30:46the assignment. And in this assignment
  754. 30:49uh I am deciding on the output logic.
  755. 30:51And this output logic the output is
  756. 30:54smile. The smile is becoming one
  757. 30:56whenever my state is is S S2.
  758. 31:00Okay? Is
  759. 31:02Is there anything
  760. 31:04you didn't understand in this Verilog
  761. 31:06code?
  762. 31:13This is the Mealy version of it. In
  763. 31:16Mealy version, the difference is that in
  764. 31:18here I mentioned in Mealy version
  765. 31:21uh the output in here the output was
  766. 31:24depending on the only state. In Mealy
  767. 31:26one, it was also depending on the input.
  768. 31:29So, in the Mealy version
  769. 31:32while
  770. 31:34actually deciding on the next state, at
  771. 31:36the same time I am also deciding on the
  772. 31:40output logic. So, while
  773. 31:42I am looking to state and both state and
  774. 31:45inputs also
  775. 31:47uh
  776. 31:48gives the smile
  777. 31:50uh output also.
  778. 31:53So, in here this is the same.
  779. 31:56The state register deciding is same.
  780. 31:58Always I am switching to the next state.
  781. 32:01And in here in always comp block, now I
  782. 32:04will decide on the next state and output
  783. 32:06logic.
  784. 32:07So,
  785. 32:08in here first I I am initializing the
  786. 32:12smile as zero.
  787. 32:15And for example, if state is S0 and uh A
  788. 32:20is one, then I am staying in this S0.
  789. 32:24Because this is Mealy by the way.
  790. 32:26So,
  791. 32:27this representation FSM representation
  792. 32:30is a little bit different because more
  793. 32:33depends on only state output in more
  794. 32:35depends on only output.
  795. 32:37But in Mealy, it depends on state and
  796. 32:40input also at the same time. For this
  797. 32:42reason,
  798. 32:43>> [clears throat]
  799. 32:44>> in here, in this state diagram,
  800. 32:47I am mentioning about the input, but
  801. 32:49also I am giving the output,
  802. 32:51corresponding output. So, in here, this
  803. 32:53output depends on this input and also
  804. 32:55state it is on.
  805. 32:57It is in.
  806. 32:59So, in here, if state is S0 and if A is
  807. 33:031, my next state is S0.
  808. 33:06Otherwise, my next state is S1.
  809. 33:09When you look at for the S1 state case,
  810. 33:13whenever
  811. 33:14in S1 state, if
  812. 33:17input 1 comes, I am giving the output as
  813. 33:201. For this reason, in S1 state, if A is
  814. 33:231, then I am saying that smile needs to
  815. 33:26be 1.
  816. 33:27Otherwise, this is the default value.
  817. 33:30Smile is always in other cases, smile is
  818. 33:330, but only while running this code,
  819. 33:36this is blocking statement, by the way.
  820. 33:38This is
  821. 33:39First, I am running this one.
  822. 33:41And after
  823. 33:43running the others,
  824. 33:45if I do another assignment, smile is
  825. 33:48replaced with the new assignment,
  826. 33:50because this is the blocking assignment.
  827. 33:59So, only in this condition, in
  828. 34:03S1 state, and if input is 1,
  829. 34:07I am
  830. 34:09giving the output as 1, smile output as
  831. 34:121. In other cases, I am going switching
  832. 34:15to the next state and smile is always
  833. 34:17kept as 0.
  834. 34:20You can later, after the course, you can
  835. 34:23later also inspect the examples.
  836. 34:27So, I can we can do some more examples.
  837. 34:29In In I have an
  838. 34:31arithmetic logic unit and operations
  839. 34:32example. For example, while you are
  840. 34:34defining a
  841. 34:35uh uh
  842. 34:36processor, you will use these examples.
  843. 34:39You will write such codes, for example.
  844. 34:41In here, I have a basic ALU module. And
  845. 34:44this ALU module takes M-bit inputs for
  846. 34:47A, B, and it it takes
  847. 34:50A and B are the inputs. Most likely, we
  848. 34:52will do addition, subtraction, and
  849. 34:55operations on these inputs depending on
  850. 34:57the ALU control signal. ALU control is a
  851. 34:592-bit signal.
  852. 35:00And I am giving the M-bit result as a
  853. 35:03result.
  854. 35:05And this module does behaves as if ALU
  855. 35:08control is 0 0, I am doing the add
  856. 35:10function. If it is 0 1, I am doing
  857. 35:12subtraction. If it is 1 0, I am doing
  858. 35:14and and so on.
  859. 35:17So, depending this ALU control, I am
  860. 35:18doing some operation on these A and B
  861. 35:21inputs. So, for example, this table says
  862. 35:24that if it is 0 0, I need to do and. So,
  863. 35:27this is just In here, there is nothing
  864. 35:29sequential. It is a combination logic.
  865. 35:32And I am writing always come begin
  866. 35:34case ALU control. And depending ALU ALU
  867. 35:37control signal, I am doing to I am
  868. 35:39writing the corresponding operation. For
  869. 35:41example, in here, if ALU control is 0 0,
  870. 35:44it is going to this 0 0 case statement,
  871. 35:46and the result is becoming A plus B.
  872. 35:49And these are the other ones. I am
  873. 35:51writing still in I am I am defining the
  874. 35:54default statement because
  875. 35:56I want I don't want to infer latch for
  876. 35:59the result. This is why I use default
  877. 36:01statement in here as I told before.
  878. 36:06So, and if you synthesize it, this is
  879. 36:08the logical correspondence of this
  880. 36:10circuit.
  881. 36:11But this is the this is abstraction for
  882. 36:14us. We don't deal In this course,
  883. 36:16actually, I showed you some logic uh
  884. 36:18fundamentals, but we will not deal with
  885. 36:20the logic, also.
  886. 36:24The more examples, for example,
  887. 36:26shifters, logical shifters,
  888. 36:28uh arithmetic shifters. There is a small
  889. 36:30difference, slight difference between
  890. 36:32them. Logical shifter shifts the value
  891. 36:33to left or right and fills the empty
  892. 36:36spaces with zeros. And arithmetic
  893. 36:38shifters same as logical shifter, but on
  894. 36:41the right shift you you are filling the
  895. 36:44empty space with the old most
  896. 36:46significant bit.
  897. 36:47This is important because in arithmetic
  898. 36:50shift you need to you want to keep the
  899. 36:52sign of the number.
  900. 36:55For example,
  901. 36:57people use arithmetic shifter, for
  902. 36:59example, divide the negative number. For
  903. 37:01example, while dividing a minus eight,
  904. 37:03for example, you want to divide minus
  905. 37:05eight by half and the result is minus
  906. 37:07four.
  907. 37:09If you do
  908. 37:11logical shifter, you you don't you
  909. 37:13cannot get minus
  910. 37:16minus four. You are getting four.
  911. 37:19But if you use arithmetic shifter, in
  912. 37:21this way you are getting minus four.
  913. 37:25>> [clears throat]
  914. 37:25>> Logical shifter always fills it with
  915. 37:27zero, left or right. In here, you are
  916. 37:32you in here I have a value and in here I
  917. 37:35am saying that how much bits needs to be
  918. 37:37shifted. For example, this says that
  919. 37:3911001 number is shifted
  920. 37:43right by two.
  921. 37:45So, it shifts two.
  922. 37:50These are the shifters. RISC-V is using
  923. 37:53all these shifter types in
  924. 37:55in their operation types. There are
  925. 37:58shifters, shift operations in RISC-V.
  926. 38:01Counters increments on each clock edge.
  927. 38:05So,
  928. 38:06>> [clears throat]
  929. 38:07>> you can use just a adder, for example,
  930. 38:10and add one at every time and build a
  931. 38:13counter.
  932. 38:14So, counters are used digital clock
  933. 38:16displays and for program counters. We
  934. 38:18will see program counters. For example,
  935. 38:19we We
  936. 38:20in while defining a risk 5 processor, we
  937. 38:23will use program counters. Uh so, for
  938. 38:26example, you can use program counter to
  939. 38:28keep track of the current instruction
  940. 38:30executing, but we will show it later.
  941. 38:33So, counters, it's just a flip-flop, but
  942. 38:37it is counting.
  943. 38:39Uh but its implementation is of course
  944. 38:41if you are incrementing it by one by one
  945. 38:44by one,
  946. 38:45then you have a one-bit adder in here
  947. 38:47also.
  948. 38:49So, this is a counter implementation.
  949. 38:52At each clock, if reset comes, counter
  950. 38:54starts with zero because you have to
  951. 38:56start with a known value.
  952. 38:58And otherwise,
  953. 39:00at every time you are increasing Q to
  954. 39:02one one one by
  955. 39:04So, this is a basic counter
  956. 39:06implementation.
  957. 39:09Uh every time you are adding one to Q
  958. 39:11and assigning it to it. But this is the
  959. 39:13alternative version.
  960. 39:15Uh
  961. 39:16in here,
  962. 39:17I have a
  963. 39:19Q output, but also I have a next Q
  964. 39:21value.
  965. 39:22And I am assigning next Q always as Q
  966. 39:25plus one, and whenever clock comes, I am
  967. 39:28assigning next Q to Q.
  968. 39:31Uh this is more verbose one, but
  969. 39:34generally we use these versions while
  970. 39:36coding
  971. 39:37processors.
  972. 39:39Always we are always separating the
  973. 39:41combinational and logic blocks.
  974. 39:43And in here, instead of assign
  975. 39:45statements, we are using always comp.
  976. 39:48Generally, this is our coding style, for
  977. 39:50example, in in Tubitak, this is our
  978. 39:52coding style.
  979. 39:54So, we are using this version actually
  980. 39:56because it is
  981. 39:57uh if you are doing more complex logic,
  982. 40:00this always FF block becomes more
  983. 40:02complex. So, instead of it making a very
  984. 40:06complex of FF always FF, it is better to
  985. 40:09separate it into always comp and always
  986. 40:12FF blocks.
  987. 40:14So, this is the shift register
  988. 40:16implementation example.
  989. 40:18So, if load is one, for example, you are
  990. 40:22writing a value to M bit register. And
  991. 40:25when load is zero, it is at each clock
  992. 40:29edge, it is shifting
  993. 40:31one bit to to right.
  994. 40:36Yeah, so it is a like serial to parallel
  995. 40:38converter. First, you are loading the
  996. 40:40value as parallel. For example, if you
  997. 40:42have a 8-bit register, you are loading
  998. 40:44the 8-bit value.
  999. 40:46And after this load operation,
  1000. 40:48at every time you are shifting it one
  1001. 40:50bit right and giving the shifted one,
  1002. 40:53the
  1003. 40:54right most one to the output.
  1004. 40:57And this is the corresponding system
  1005. 40:59Verilog code for this shift register.
  1006. 41:11So, in here maybe we can give a break
  1007. 41:14because
  1008. 41:15we we finished at 30, right? In the
  1009. 41:18previous one.
  1010. 41:19Open it's more than 1 hour we started.
  1011. 41:22Okay, we can give a break.
  1012. 41:25And we can start again at 45.
  1013. 41:3214:45
  1014. 42:39>> We will go back.
  1015. 42:50So, now we will see the system Verilog
  1016. 42:52memory types.
  1017. 42:55Memory types are used to define the
  1018. 42:56memory. Normally, memory means actually
  1019. 42:59flip-flop latches. They are memories.
  1020. 43:01But, if you want to build many of them,
  1021. 43:03for example, a memory 2 megabyte for
  1022. 43:05example, if you want to build a 2
  1023. 43:06megabyte memory, you have to define
  1024. 43:09multi-dimensional
  1025. 43:11logic gates, logics, actually logic
  1026. 43:13structures.
  1027. 43:14You need to use multi-dimensional
  1028. 43:16logics.
  1029. 43:18And
  1030. 43:19it's yeah, memory is used efficiently to
  1031. 43:21store large amounts of data. And, for
  1032. 43:23example, you can define the data value
  1033. 43:25read width, for example, M bit.
  1034. 43:28And at each time you can read M bit
  1035. 43:31value and write M bit value, for
  1036. 43:33example. And you can keep it in M bit
  1037. 43:36address, for example. If you are keeping
  1038. 43:38M bit value at M bit address, it means
  1039. 43:42that
  1040. 43:43you are keeping M times 2 to the N.
  1041. 43:47You have M times 2 to the N bit.
  1042. 43:51Because this is the address.
  1043. 43:52So, you are defining you are giving an
  1044. 43:54address, for example, if you define five
  1045. 43:56if you are giving five bit address, it
  1046. 43:58means that you are
  1047. 44:00addressing between 0 to 31.
  1048. 44:02So, and if you each if each address
  1049. 44:05keeps 32 bit value, 32 value. Then total
  1050. 44:09size is becoming
  1051. 44:112 to the 5 * 32
  1052. 44:13bits
  1053. 44:14or 2 to the 2 to the 5 * 4
  1054. 44:18byte, for example.
  1055. 44:21So,
  1056. 44:22if you want to store a data in
  1057. 44:25uh in uh
  1058. 44:27chip, in an integrated circuit, there
  1059. 44:30are three different values three
  1060. 44:32different types. One of them is DRAM,
  1061. 44:35dynamic random memory access memory. Uh
  1062. 44:38DRAM consists of a transistor and
  1063. 44:40capacitor. This capacitor keeps the
  1064. 44:41value. And if you want to access the
  1065. 44:44value stored in this capacitor,
  1066. 44:47yeah, this is not like
  1067. 44:48cross-coupled inverter. This is just a
  1068. 44:50capacitor and capacitor keeps the value.
  1069. 44:52For example, if you load a voltage to a
  1070. 44:54capacitor, and then keep this value in
  1071. 44:57this capacitor, then it is a storage.
  1072. 44:59It's like a storage. Uh but, if you want
  1073. 45:02to read it, you need to just apply to
  1074. 45:04one to this word line and read it from
  1075. 45:06the bit line. This is
  1076. 45:08basic DRAM memory.
  1077. 45:11Uh
  1078. 45:12Another one is a static asset memory.
  1079. 45:14This is the one we we saw. This is
  1080. 45:17cross-coupled inverter.
  1081. 45:19It has a bit line and cross bit line and
  1082. 45:22not of them. And if you want if you want
  1083. 45:24to access it, you need to just trigger
  1084. 45:26this word line and then get read the
  1085. 45:28data.
  1086. 45:30And other type is the read-only memory.
  1087. 45:32Read-only memory means that
  1088. 45:35just, for example,
  1089. 45:37you have a wire and you are just
  1090. 45:39connecting into the VDD or VSS.
  1091. 45:42Then it is a read-only memory because
  1092. 45:45if you connect a wire to one to be, for
  1093. 45:48example, VDD, then if you read a if you
  1094. 45:50read this wire, you are always getting
  1095. 45:53one.
  1096. 45:54This is read-only memory. You cannot
  1097. 45:56change it. In read-only memory, you
  1098. 45:57cannot change it.
  1099. 45:59And in all by using all these
  1100. 46:02structures, you are defining
  1101. 46:04two-dimensional
  1102. 46:05data
  1103. 46:06and these two-dimensional data forms the
  1104. 46:09memory.
  1105. 46:10So, in here at the beginning I mentioned
  1106. 46:12that M-bit data value and M-bit address.
  1107. 46:15So, M * 2 to the N value you can build a
  1108. 46:19memory.
  1109. 46:20And the memory capacity is so. In order
  1110. 46:23to access the memory, we need to use
  1111. 46:25decoder. For example, if address is
  1112. 46:262-bit,
  1113. 46:28I can access 0 0, 1,
  1114. 46:302, or third rows. So, you have to use
  1115. 46:34you need if you get a 2-bit address,
  1116. 46:36then you need to select the
  1117. 46:38corresponding word line
  1118. 46:40to access and this word line can be
  1119. 46:43either this one, this one, this one,
  1120. 46:44this one. So, this 2-bit address needs
  1121. 46:47to be converted to two 4-bit signal.
  1122. 46:51So, for example, if you want to access
  1123. 46:54in here, if you want to access uh
  1124. 46:57row
  1125. 46:58three,
  1126. 46:59then you are giving address 1 1 and this
  1127. 47:021 1 activates this
  1128. 47:04word line
  1129. 47:05and you can read
  1130. 47:07the values stored in here.
  1131. 47:10By the way, this when you look at here,
  1132. 47:13in here, there is 2-bit address
  1133. 47:16and each address keeps a 3-bit value.
  1134. 47:19So, in here there is a 2 to 2 * 3-bit
  1135. 47:22data. So, total in here there is 12-bit
  1136. 47:26data. You you can count it.
  1137. 47:29These are the memories uh and we will
  1138. 47:31see how to define the memory arrays in
  1139. 47:34SystemVerilog. Uh of course, in memory,
  1140. 47:36we are using two-dimensional memories
  1141. 47:39and each bit cell stores 1 bit.
  1142. 47:42Uh I mentioned about the com-
  1143. 47:44yeah, the array size. Uh depth means the
  1144. 47:47number of rows and width means the
  1145. 47:49number of columns. So,
  1146. 47:51this is the width.
  1147. 47:53This is the depth.
  1148. 47:55And if you want, for example, if you
  1149. 47:57want to access 32-bit data, your width
  1150. 47:59can be 32. For example, if you want to
  1151. 48:02keep 124
  1152. 48:05uh
  1153. 48:06words, then your depth is 124, for
  1154. 48:09example.
  1155. 48:11So,
  1156. 48:12uh
  1157. 48:13this is, for example, in here, if you
  1158. 48:16have a such a memory, then your address
  1159. 48:18is 10 bits, and your
  1160. 48:21data in here, you are storing 4 byte.
  1161. 48:26So, uh this this one corresponds to
  1162. 48:28here, yes.
  1163. 48:30So, how can we define a single port RAM
  1164. 48:32in SystemVerilog?
  1165. 48:34In here, I have clock and write enable
  1166. 48:37input.
  1167. 48:38Uh this is my clock. This is write
  1168. 48:40enable. If I want to write, I am just
  1169. 48:43triggering this input.
  1170. 48:44I have a A input, 8-bit, and uh
  1171. 48:48data
  1172. 48:50write destination and read destination
  1173. 48:52inputs.
  1174. 48:54And whenever I want to write, I need to
  1175. 48:57make the write enable one.
  1176. 48:59And this is the description.
  1177. 49:01First, I need to create the memory
  1178. 49:03itself. So, what is memory? Memory is a
  1179. 49:05two two-dimensional signal.
  1180. 49:08Normally, I was defining here, for
  1181. 49:09example, logic
  1182. 49:117 to 0, for example,
  1183. 49:14and it was creating a vector, right?
  1184. 49:16One-dimensional vector. But memory is
  1185. 49:18two-dimensional vector. So, in order to
  1186. 49:20define two-dimensional vector, I am
  1187. 49:22using two-dimensional logic structures.
  1188. 49:24And this says that
  1189. 49:26I am using
  1190. 49:28in each row, there are three bits, but
  1191. 49:30there are 256
  1192. 49:33rows.
  1193. 49:35And this is my RAM.
  1194. 49:38This is memory, memory itself.
  1195. 49:41And
  1196. 49:42this is the address input. By the way,
  1197. 49:44this is not data. This is address input,
  1198. 49:47and this is the data inputs. I I I told
  1199. 49:50it wrongly.
  1200. 49:51Address is
  1201. 49:528 bits because 256
  1202. 49:55is addressed by 8-bits. 256 location
  1203. 49:59addressed by 8-bits.
  1204. 50:01So, whenever
  1205. 50:04for the output
  1206. 50:06if
  1207. 50:07whatever A addresses, I am giving the
  1208. 50:11corresponding 3-bit 3-bit to RD. I am
  1209. 50:14assigning it to RD. So, for example, if
  1210. 50:16A is zero
  1211. 50:18this first element of RAM RAM 3-bit
  1212. 50:22of it assigned to RD. Okay? So, this is
  1213. 50:25like combinational read because I'm
  1214. 50:27doing combinational read in here, not
  1215. 50:29doing sequential read.
  1216. 50:31Read is combinational
  1217. 50:33but raw write is always must be
  1218. 50:35sequential. So, in write, whenever clock
  1219. 50:38comes, if write enable signal is one, I
  1220. 50:42am just assigning this VD to
  1221. 50:44corresponding RAM
  1222. 50:46uh row. So, this VD signal is 3-bit
  1223. 50:49signal. I'm assigning to the RAM.
  1224. 50:52That's all.
  1225. 50:54Is it clear?
  1226. 50:58So, you can also define multi-port
  1227. 50:59memory. Uh for example, in here, I
  1228. 51:02define two read ports and one write
  1229. 51:04ports. Two read ports has two address,
  1230. 51:06A1 and A2, and two data outputs, RD1 and
  1231. 51:09RD2, and one write port, A3, write data
  1232. 51:13three, and write enable three.
  1233. 51:15Because
  1234. 51:16I am not writing always. In each cycle,
  1235. 51:18you can read it because read is not
  1236. 51:20destructive. You can read the memory, no
  1237. 51:23problem. But, if you want to write it,
  1238. 51:25you want you need to write it only if
  1239. 51:27you want to write. Otherwise, you
  1240. 51:29shouldn't write.
  1241. 51:30Uh so, for this design, write is depends
  1242. 51:32on enable signal also. Write has enable
  1243. 51:34signal. And this is the corresponding,
  1244. 51:36for example, 32 * 32 register file with
  1245. 51:39two read and write one write port. By
  1246. 51:41the way, while designing a RISC-V
  1247. 51:43you will exactly use this register file,
  1248. 51:46for example.
  1249. 51:47In here, I have two read ports,
  1250. 51:49uh one write port,
  1251. 51:51and read is combinational.
  1252. 51:54In here, I am doing combinational read.
  1253. 51:56Uh so,
  1254. 51:58for example, in here, there is a special
  1255. 52:00case. If read address is zero, I am
  1256. 52:03giving zero to output. This is a special
  1257. 52:05case. You will see it after 4 weeks why
  1258. 52:08I
  1259. 52:09this this example coded in a such way.
  1260. 52:12Uh but, otherwise, you are giving the
  1261. 52:14corresponding data to output. RD1 and
  1262. 52:17RD2 output. What about write section? In
  1263. 52:20write section, whenever clock comes, if
  1264. 52:23write enable enabled,
  1265. 52:25then you are writing this VD3 to this
  1266. 52:27flip-flop, but corresponding row of the
  1267. 52:29flip-flop. Okay?
  1268. 52:34Is this example clear?
  1269. 52:37You can also inspect them in ROM.
  1270. 52:39Uh
  1271. 52:40what about ROM? ROM has no write input.
  1272. 52:44So, I have an address input and getting
  1273. 52:47the output.
  1274. 52:48So, whenever I provide an address, I'm
  1275. 52:50getting the corresponding output in this
  1276. 52:52row, in the row that corresponds this
  1277. 52:54address.
  1278. 52:55And ROM, if you want to build a ROM in
  1279. 52:58your uh for your chip, uh you need to
  1280. 53:02just
  1281. 53:03create a read port,
  1282. 53:05and at the beginning, you need to give
  1283. 53:07data to this ROM.
  1284. 53:10And you can give this data from a file.
  1285. 53:12This is a file, memfile.dat file.
  1286. 53:15And this .dat file has values actually
  1287. 53:18in here.
  1288. 53:20Uh
  1289. 53:20has some data.
  1290. 53:22Uh this ROM actually has 128 rows, and
  1291. 53:26each row has 32-bit data.
  1292. 53:31And
  1293. 53:33at the beginning,
  1294. 53:34by using this read mem
  1295. 53:36H,
  1296. 53:38I am reading a hexadecimal
  1297. 53:41data from this file, and this file in
  1298. 53:44this file there are 128 entries for
  1299. 53:46example and these entries are loaded to
  1300. 53:49the ROM.
  1301. 53:50So, instead of writing actually assign
  1302. 53:53for example assign
  1303. 53:55ROM
  1304. 53:570 is
  1305. 53:59uh 0 1 2 3 4 5 6 for example in this way
  1306. 54:03and if you if instead of writing 128
  1307. 54:07assign statements to define the initial
  1308. 54:09values of the ROM we are just
  1309. 54:12putting a file data we are putting the
  1310. 54:15data in a file and then reading this
  1311. 54:17file and then
  1312. 54:18loading this
  1313. 54:20data to ROM this ROM signal.
  1314. 54:23And after that this is by the way
  1315. 54:24initial statement initial statement runs
  1316. 54:26once while seeing the simulation I will
  1317. 54:29show this statements in detail. Uh
  1318. 54:32this
  1319. 54:34I will show in detail this statement but
  1320. 54:36while running the simulation this
  1321. 54:38statement runs only once at the
  1322. 54:40beginning and never runs again.
  1323. 54:43And this is the read corresponding read
  1324. 54:45port. Read port always assigns the
  1325. 54:48corresponding address to the output.
  1326. 54:52System Verilog has a concept of delay.
  1327. 54:54Uh delay
  1328. 54:56is described by dash and
  1329. 54:59delay amount.
  1330. 55:00For example in here I have a module
  1331. 55:02example module it has some inputs and
  1332. 55:05doing some operations.
  1333. 55:07And these are the structural description
  1334. 55:09of these operations and these delays
  1335. 55:12says that
  1336. 55:15for example this statement is evaluated
  1337. 55:18but assigned to these values after one
  1338. 55:21delay
  1339. 55:22after one unit time.
  1340. 55:24In here
  1341. 55:26this statement is evaluated but assigned
  1342. 55:28to N1 after two unit delay time.
  1343. 55:31And two unit delay time two unit delay
  1344. 55:33time four unit delay time.
  1345. 55:37It's just delaying the assignment. So,
  1346. 55:39if there was no
  1347. 55:42one here, this would be assigned
  1348. 55:45immediately. This statement would be
  1349. 55:47assigned immediately. But, since there
  1350. 55:49is a delay statement here, the
  1351. 55:51assignment is delayed one unit time.
  1352. 55:53This unit depends nanosecond,
  1353. 55:55picosecond, uh microsecond. You are
  1354. 55:58defining it.
  1355. 55:59Uh but, this is unit time.
  1356. 56:02Uh but, this is only for simulation.
  1357. 56:05For example, if you write such a
  1358. 56:06statement and say that while
  1359. 56:09uh
  1360. 56:10synthesizing this system Verilog code
  1361. 56:13and build a actual hardware, it will not
  1362. 56:16put any delay. This is only for
  1363. 56:18simulation, not for actual hardware.
  1364. 56:21Because, we don't know how to control
  1365. 56:22the delay value in actual hardware. So,
  1366. 56:25this is not realistic thing. This is
  1367. 56:27only for simulation. And, you will see
  1368. 56:29it is very useful in simulation,
  1369. 56:32especially in order to generate a clock.
  1370. 56:36So, they are not corresponding to the
  1371. 56:37delay of actual hardware. And, here here
  1372. 56:40you can in here you can see the
  1373. 56:43uh
  1374. 56:43simulation result. And, according to the
  1375. 56:46simulation results, these for example,
  1376. 56:48ABC changes its values.
  1377. 56:50But, these statements, for example, N1,
  1378. 56:53N2, and N3, when you look at it here,
  1379. 56:57it is actually changed after this
  1380. 57:00specified amount of delay time.
  1381. 57:07Okay?
  1382. 57:14So, in here there is an example, for
  1383. 57:16example. In here you need to be careful.
  1384. 57:19For example, this is not sequential.
  1385. 57:22So, for example, you cannot say that,
  1386. 57:24for example,
  1387. 57:26this assignment is will be done after
  1388. 57:28one delay time, and this assignment will
  1389. 57:31be done after
  1390. 57:33two delay time, but they they are
  1391. 57:34running at the same time. For this
  1392. 57:36reason, uh this is not after three unit
  1393. 57:39time. This is after two unit time.
  1394. 57:41Because every line works as parallel in
  1395. 57:44SystemVerilog.
  1396. 57:46So, this is the corresponding
  1397. 57:49waveform diagrams.
  1398. 57:53I will mention about test benches. This
  1399. 57:55delay is useful for test benches.
  1400. 57:57Uh test benches are the SystemVerilog
  1401. 58:00structures. Still, they are
  1402. 58:02SystemVerilog
  1403. 58:03uh
  1404. 58:04they are
  1405. 58:06SystemVerilog modules, but they we are
  1406. 58:08using these test benches to test, not
  1407. 58:10not for synthesizers. You know, we are
  1408. 58:12not using it to create actual hardware.
  1409. 58:15So, its purpose is to test another
  1410. 58:18module.
  1411. 58:19And the module
  1412. 58:22tested is named as device under test,
  1413. 58:24and they are not synthesizable.
  1414. 58:27Uh there are three types of it: simple,
  1415. 58:29self-checking, and self-checking with
  1416. 58:31test vectors. There are more complex
  1417. 58:32ones, but you can see them maybe later
  1418. 58:36in the different uh in the professional
  1419. 58:38work.
  1420. 58:40Uh so, in here, for example, I am in a
  1421. 58:44DUT example.
  1422. 58:45I am doing a
  1423. 58:48I have BC ABAB C signals, and I am doing
  1424. 58:51AND operation and then adding them.
  1425. 58:54This is a basic function.
  1426. 58:57Uh this is named as silly function. It
  1427. 58:59has a AB C input and output Y, and I am
  1428. 59:01doing this operation.
  1429. 59:03In here, at means OR.
  1430. 59:05The same thing, actually.
  1431. 59:08Uh so,
  1432. 59:10and
  1433. 59:11assume that I described that it in you
  1434. 59:14by writing a hardware description
  1435. 59:16language, SystemVerilog, and I would
  1436. 59:19like to test it. How can do it?
  1437. 59:22I am writing a
  1438. 59:24another module, and this module is named
  1439. 59:26as test bench. And this test bench
  1440. 59:29module
  1441. 59:30calls this
  1442. 59:32silly function, my function to be
  1443. 59:33tested.
  1444. 59:35And in this test bench
  1445. 59:37I am
  1446. 59:39applying some inputs to this function
  1447. 59:41and
  1448. 59:42probing its output.
  1449. 59:44And in this test bench
  1450. 59:46I have a initial block. This is another
  1451. 59:49block, by the way. We Until now we saw
  1452. 59:51always always FF
  1453. 59:54always latch, always comp. And this is
  1454. 59:56initial is another block. It initial,
  1455. 59:58but this is initial is only used for in
  1456. 1:00:01test bench.
  1457. 1:00:03And in this test bench we are saying
  1458. 1:00:05that we begin
  1459. 1:00:07and at the beginning A is 0, B is 0, C
  1460. 1:00:10is 0. And after 10 unit time, -10 means
  1461. 1:00:1310 unit time. After 10 unit time
  1462. 1:00:16Okay, at the beginning we are assigning
  1463. 1:00:18ABC as 0 and waiting for 10 unit time.
  1464. 1:00:22And after that we continue.
  1465. 1:00:25We are assigning C to 1
  1466. 1:00:27and waiting 10 unit time more.
  1467. 1:00:30We are going in this way.
  1468. 1:00:31We are assigning B to 1. At that in here
  1469. 1:00:35B to 1, C to 0. And then waiting another
  1470. 1:00:3710 unit time and applying these test
  1471. 1:00:39vectors. So you see, I am applying
  1472. 1:00:44inputs
  1473. 1:00:45to this to this function
  1474. 1:00:48to the another module that I want to
  1475. 1:00:50test.
  1476. 1:00:51And at every time I am changing the
  1477. 1:00:53inputs.
  1478. 1:00:56And after running this test bench,
  1479. 1:00:58actually I will see the test bench. For
  1480. 1:01:00example, at every time I will check the
  1481. 1:01:02Y, for example. You will see a waveform.
  1482. 1:01:05Uh I will upload a video uh
  1483. 1:01:08that shows how to run Verilator. So you
  1484. 1:01:11will see it
  1485. 1:01:12uh in action to you.
  1486. 1:01:14Uh but now I am using Windows. It is
  1487. 1:01:16very hard to use uh Verilator in
  1488. 1:01:18Windows. Uh By the way, you can install
  1489. 1:01:19Verilator in Windows, but it is a little
  1490. 1:01:22bit cumbersome, so for this reason I am
  1491. 1:01:24not showing it. Uh but when you use
  1492. 1:01:28these two
  1493. 1:01:30modules and then run it on simulator,
  1494. 1:01:33for example, you can see the waveforms
  1495. 1:01:35and you can check the waveforms whether
  1496. 1:01:37Y is
  1497. 1:01:38correct or not. Because in here I'm
  1498. 1:01:41applying the inputs and in here I need
  1499. 1:01:43to check the Y visually by looking to
  1500. 1:01:46the waveform and check that whether it
  1501. 1:01:48is correct or not.
  1502. 1:01:52This is the simple test bench, but in
  1503. 1:01:54simple test bench we need to check it by
  1504. 1:01:56eye. We need to check it by looking to
  1505. 1:01:59the waveform.
  1506. 1:02:01In here there is also another version of
  1507. 1:02:02test bench. This is the self-checking
  1508. 1:02:04test bench.
  1509. 1:02:05The same logic. I have a test bench
  1510. 1:02:08here, but this is self-checking test
  1511. 1:02:10bench.
  1512. 1:02:11And
  1513. 1:02:12I initially in initiate my
  1514. 1:02:15design under test in here. This is silly
  1515. 1:02:17function that I defined.
  1516. 1:02:20And in here I am applying the test
  1517. 1:02:22inputs. At the beginning I am applying 0
  1518. 1:02:240 and 0.
  1519. 1:02:26And after 10 unit time, I am checking
  1520. 1:02:30whether Y is 1 or not.
  1521. 1:02:32I am doing the test in this way.
  1522. 1:02:35This works as sequential because in here
  1523. 1:02:37there are time unit weights.
  1524. 1:02:40So if
  1525. 1:02:41I don't get 0 0 0, yeah, sorry, if I
  1526. 1:02:45don't get 1, then I am saying that the
  1527. 1:02:47test is failed.
  1528. 1:02:49So and after, for example,
  1529. 1:02:52checking the first input, I am changing
  1530. 1:02:55the C as 1 and waiting 10 unit time and
  1531. 1:02:58checking whether Y is 0 or not. If it is
  1532. 1:03:00not, then we are failed.
  1533. 1:03:02And this goes in this way and
  1534. 1:03:05in the with different inputs I am
  1535. 1:03:07checking every time whether Y is set the
  1536. 1:03:10correct value.
  1537. 1:03:16Another one is that there are three
  1538. 1:03:18methods. One of them simple, second one
  1539. 1:03:20is self-checking, and other one is
  1540. 1:03:21self-checking with test vectors. Test
  1541. 1:03:23vectors is similar, but in here you are
  1542. 1:03:26defining a example file.
  1543. 1:03:30And this example file has the input
  1544. 1:03:34combinations, ABC values, and expected Y
  1545. 1:03:37value this file.
  1546. 1:03:40And
  1547. 1:03:43of course in here
  1548. 1:03:45for the for the timing you are
  1549. 1:03:47generating a clock. I will show. You are
  1550. 1:03:49generating a clock.
  1551. 1:03:50And
  1552. 1:03:51at each time
  1553. 1:03:53when clock comes
  1554. 1:03:55you are for example reading you are
  1555. 1:03:57giving the ABC a line
  1556. 1:04:00and then checking whether Y is the
  1557. 1:04:03expected value or not. But you are doing
  1558. 1:04:05it with a clock with clock edge for
  1559. 1:04:07example because you need to synchronize
  1560. 1:04:09it while testing. You have a you need to
  1561. 1:04:12have a concept of time.
  1562. 1:04:14So you are generating a clock for
  1563. 1:04:16assigning inputs and reading outputs
  1564. 1:04:18because at each clock you need to switch
  1565. 1:04:20to next line.
  1566. 1:04:22You don't have to write clock, but it's
  1567. 1:04:25better.
  1568. 1:04:26Uh you can just for example in a for
  1569. 1:04:27loop you can just write a dash 10.
  1570. 1:04:31For example, 10 unit delay and then do
  1571. 1:04:33it
  1572. 1:04:34in a same way, but no no problem. We
  1573. 1:04:37will see how to generate the clocks
  1574. 1:04:38also.
  1575. 1:04:40And in this stage way test bench you are
  1576. 1:04:41generating clock for assigning the
  1577. 1:04:43inputs and reading outputs. Uh you are
  1578. 1:04:46reading the test work test vectors file
  1579. 1:04:48into an array and at each time at each
  1580. 1:04:52clock input you are assigning inputs and
  1581. 1:04:54checking the expected outputs and
  1582. 1:04:56compare it. This is the method for
  1583. 1:04:59self-checking test bench.
  1584. 1:05:01Uh so [clears throat] in here for
  1585. 1:05:03example
  1586. 1:05:04if you want to do it with a clock
  1587. 1:05:07uh assign inputs for example. We will
  1588. 1:05:09generate a clock. We will see it.
  1589. 1:05:11And
  1590. 1:05:12in the rising edge of the clock, we need
  1591. 1:05:14to assign the inputs and in the falling
  1592. 1:05:16edge of the clock, we will compare the
  1593. 1:05:18outputs
  1594. 1:05:19whether it is expected or not. And in
  1595. 1:05:21the next rising edge, we will assign the
  1596. 1:05:23new inputs and in the next falling edge,
  1597. 1:05:26we will compare it and it will go so
  1598. 1:05:28until we reach to the end of the test
  1599. 1:05:30vectors.
  1600. 1:05:33So, this is the code.
  1601. 1:05:36In here, I have a clock and reset
  1602. 1:05:39inputs, A, B, C inputs and Y expected
  1603. 1:05:43uh value, [clears throat]
  1604. 1:05:45uh
  1605. 1:05:45logic Y output.
  1606. 1:05:48Vector num
  1607. 1:05:50corresponds to the number of the vectors
  1608. 1:05:52and errors is number of errors we
  1609. 1:05:55encountered.
  1610. 1:05:56And
  1611. 1:05:57uh test vectors is the For example, we
  1612. 1:06:00will apply
  1613. 1:06:01for example, in here 10,000 10,001 by
  1614. 1:06:04the way, 0 to 10,000 means 10,001
  1615. 1:06:07different test vectors.
  1616. 1:06:09So, this is the array of test vectors.
  1617. 1:06:11So, at each time
  1618. 1:06:14for example, I will apply test vector 0
  1619. 1:06:16and check the result is correct or not.
  1620. 1:06:18And after that, in the next block, I
  1621. 1:06:20will apply test vector 1, 2, 3 at every
  1622. 1:06:23time and I will check the output.
  1623. 1:06:25This is my model instantiation, uh the
  1624. 1:06:28the function that I want to test.
  1625. 1:06:31I instantiate it and connect A, B, C uh
  1626. 1:06:34to here.
  1627. 1:06:36Uh by the way, note that in test bench,
  1628. 1:06:39there is no input and output.
  1629. 1:06:41There is no input and output. Everything
  1630. 1:06:43is signal in test bench because test
  1631. 1:06:45bench is not a real model. It is just to
  1632. 1:06:47check the whether my function is
  1633. 1:06:50my model is correct or not. For this
  1634. 1:06:52reason, it has no input and output
  1635. 1:06:54concept because it is just We are using
  1636. 1:06:56it just to test.
  1637. 1:06:58So, these are the
  1638. 1:07:00signals inside the test bench.
  1639. 1:07:04>> [clears throat]
  1640. 1:07:05>> So,
  1641. 1:07:06in this block, we are generating a
  1642. 1:07:08clock.
  1643. 1:07:10So, we are generating clock in an always
  1644. 1:07:12block. Always means that always run.
  1645. 1:07:15It is not initial. Initial means that
  1646. 1:07:17run only once,
  1647. 1:07:19but always says that always run.
  1648. 1:07:21How this generates clock? In this
  1649. 1:07:24always, by the way, no sensitivity, so
  1650. 1:07:27it always executes.
  1651. 1:07:29So, this always block, for example,
  1652. 1:07:31first this is a for example clock
  1653. 1:07:33signal. This is a one bit signal.
  1654. 1:07:36First, it assigns one to clock,
  1655. 1:07:39and then waits five unit time.
  1656. 1:07:42At five after five unit time, clock
  1657. 1:07:44becomes Sorry, it was one at the
  1658. 1:07:46beginning.
  1659. 1:07:47At the beginning, it was one, and after
  1660. 1:07:49five unit time, clock becoming zero, and
  1661. 1:07:51after another five units of time, at 10,
  1662. 1:07:55it becomes one again.
  1663. 1:07:57And at 15, it becomes zero. So, it runs
  1664. 1:08:00forever, so it generates a clock signal
  1665. 1:08:03for sequential logic. This is how we are
  1666. 1:08:05generating the clock.
  1667. 1:08:07And we will continue We are continuing
  1668. 1:08:09on the this module, test bench module.
  1669. 1:08:13>> [clears throat]
  1670. 1:08:13>> At the start of the test, we are loading
  1671. 1:08:15the vectors and pass to apply the reset.
  1672. 1:08:19So, how we are
  1673. 1:08:20applying the test vectors? It is written
  1674. 1:08:23in a file, as I told before. For
  1675. 1:08:25example, in this
  1676. 1:08:27file,
  1677. 1:08:29in a such way,
  1678. 1:08:30the file This is the test vectors file.
  1679. 1:08:33It has a ABC inputs and expected Y
  1680. 1:08:36output. We are applying this example
  1681. 1:08:39test file to test vectors.
  1682. 1:08:45And assume that in here, there are
  1683. 1:08:4710,001
  1684. 1:08:48tests.
  1685. 1:08:50And vector num and errors are
  1686. 1:08:52initialized as zero at the beginning,
  1687. 1:08:54and I applied reset. If reset is one,
  1688. 1:08:58uh I am starting from the beginning.
  1689. 1:09:00There is a reset in here. And after 22
  1690. 1:09:04unit time, I am releasing the reset.
  1691. 1:09:06Reset is becoming zero. This is initial
  1692. 1:09:09block. This is runs once only.
  1693. 1:09:12If it comes here, then nothing change.
  1694. 1:09:15This this block will not change run
  1695. 1:09:16again.
  1696. 1:09:20And in here, in always FF block, just
  1697. 1:09:23write always FF. You can say always
  1698. 1:09:25also, it is
  1699. 1:09:26fine, but it's better to use always FF.
  1700. 1:09:30At every clock, you are applying the
  1701. 1:09:32test vectors on the rising edge of the
  1702. 1:09:34clock.
  1703. 1:09:36And
  1704. 1:09:36>> [clears throat]
  1705. 1:09:39>> for example, this is the test vectors we
  1706. 1:09:41loaded from the file. And
  1707. 1:09:43vector num is at each time, vector num
  1708. 1:09:46will be increased by one. At the
  1709. 1:09:48beginning, it was zero.
  1710. 1:09:49And I'm getting the first test vector
  1711. 1:09:51and applying it to ABCY expected.
  1712. 1:09:56And after that, I am here in the negedge
  1713. 1:09:59of the clock.
  1714. 1:10:01In here, in the negedge of the clock, if
  1715. 1:10:04there is no reset, I am checking whether
  1716. 1:10:06Y is Y expected.
  1717. 1:10:08And if there is an error, if not
  1718. 1:10:10expected, I am giving an error.
  1719. 1:10:13And increasing the error count one, but
  1720. 1:10:15still continue.
  1721. 1:10:18And this is the
  1722. 1:10:20this is still always statement. It
  1723. 1:10:22continues at each test, I am increasing
  1724. 1:10:26the vector
  1725. 1:10:27number one.
  1726. 1:10:29And if I reach the end of the test
  1727. 1:10:31vector, I am saying that I finished the
  1728. 1:10:34test.
  1729. 1:10:35And in here, there is a stop statement.
  1730. 1:10:37Stop says that simulation needs to stop.
  1731. 1:10:39This is a special also keyword. It says
  1732. 1:10:42the simulation to stop.
  1733. 1:10:45Uh
  1734. 1:10:46by the way, as I told, we will release a
  1735. 1:10:48video recordings to show how to use the
  1736. 1:10:50Verilator.
  1737. 1:10:51You will use a Verilator and do basic
  1738. 1:10:54simulation. We will show it to you.
  1739. 1:10:59In here, there is a
  1740. 1:11:01comparison. Previously, we saw
  1741. 1:11:03comparison as equal equal or not equal.
  1742. 1:11:06Uh
  1743. 1:11:07if you are using three equal
  1744. 1:11:09or not
  1745. 1:11:11uh equal equal, then this one also
  1746. 1:11:14compares values
  1747. 1:11:161 0 X and Z also. Normally,
  1748. 1:11:19this one compares the value 1 or 0, but
  1749. 1:11:22if you use three of them, three equal
  1750. 1:11:25uh then you can compare the values
  1751. 1:11:28whether it is X or Z also. It's more
  1752. 1:11:30detailed comparison.
  1753. 1:11:33So, that that's the end of the lecture.
  1754. 1:11:36Uh do you have any any questions?
  1755. 1:11:43So, if no question, in the next week,
  1756. 1:11:45inshallah, we will start the RISC-V
  1757. 1:11:47instruction set architecture.
  1758. 1:11:51No question?
  1759. 1:11:52Okay, then. See you.

About this transcript

This page contains the full transcript of W2 SystemVerilog Part2 EN by Hasan Erdem Yantır, generated from the public captions YouTube serves with the video. The transcript has 10,122 words across 1,759 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.