YouTube2Text

EECS 373 - Fall 2026 - Lecture 7: “Midterm 1 Review" — Transcript

by Interactive Sensing and Computing Lab · 13,221 words · 1,976 segments · language en · Watch on YouTube

Full transcript

  1. 0:00All
  2. 0:04right, we can get get started. Let's see
  3. 0:09and push this there. Okay,
  4. 0:14so as we discussed the exam uh sheet was
  5. 0:17uh data sheet was released on Monday. I
  6. 0:20only saw one question I haven't had a
  7. 0:22chance to respond to, but this is your
  8. 0:24chance. If you have confusions about the
  9. 0:26data sheet, you can ask. Uh solutions
  10. 0:28for homework 3 were posted last night.
  11. 0:31There was a little uh confusion about
  12. 0:34the very last section uh of the design
  13. 0:36part about what to actually put on that
  14. 0:38APB di timing diagram because the
  15. 0:41question there's multiple ways to solve
  16. 0:43part three. So as long as you put down
  17. 0:46something that was plausible, you'll get
  18. 0:48points. I don't you know I'm not going
  19. 0:49to penalize you for my error. Um, and I
  20. 0:53told I'll make sure the graders know
  21. 0:54that as well. And then uh exam will be
  22. 0:57on Friday. All this lecture is about
  23. 0:59going over the exams. Are there any
  24. 1:01questions to start with? Yes.
  25. 1:07>> Oh, yeah. Sorry. Well, yes, it's in DAO.
  26. 1:10In fact, we'll go over that in just a
  27. 1:12second, but thank you for pointing that
  28. 1:13out. Say that right now.
  29. 1:16And
  30. 1:19DAO.
  31. 1:21Nope, not Dowax.
  32. 1:24What other questions you got?
  33. 1:28All right, we'll get started. So,
  34. 1:30logistics, we'll do a course overview
  35. 1:32and if there's time, uh, we can walk
  36. 1:35through some of the design problems if
  37. 1:36you would like. All right, so Oh man,
  38. 1:39you're right. These slides did not get
  39. 1:40open, get updated. Um, but that's not
  40. 1:44the exam location. We'll talk about that
  41. 1:45in a second. So closed books, closed
  42. 1:47notes, don't bring
  43. 1:52the reference sheet. So basically the
  44. 1:54packet that you have now, you'll get a
  45. 1:55fresh copy of it for the exam. Uh you
  46. 1:58can bring like a four function
  47. 1:59calculator, scientific calculator. Uh
  48. 2:01don't bring like a TI89, you know, you
  49. 2:04can just put any amount of information
  50. 2:05on that. So just bring a normal
  51. 2:07calculator if you would like. There's
  52. 2:09not a lot that we need calculations for.
  53. 2:11And if you felt like, oh my gosh, like I
  54. 2:13don't have a calculator and I need to do
  55. 2:15some math. You could just write on this
  56. 2:17exam. This is the calculation I want to
  57. 2:19do. The answer would be at this right.
  58. 2:21I'll figure it out. So I'm not going to
  59. 2:24it's not like trying to nitpick like did
  60. 2:25you get every single thing exactly
  61. 2:27correct. A lot of strategy exam is just
  62. 2:29saying this is what I intend this is
  63. 2:31what I think and then making the
  64. 2:32attempt. So we'll get to that, but give
  65. 2:34us as many opportunities to give you
  66. 2:37points as possible.
  67. 2:39Uh yeah, phones must stay in your
  68. 2:40pockets and we'll make a timer or a
  69. 2:42clock available
  70. 2:44and uh we'll figure out how to do that.
  71. 2:47Okay, [snorts] we actually have three
  72. 2:49rooms. Uh kind of painful. Uh
  73. 2:52approximately these are your uh it's
  74. 2:54just by make it easy. I just assign
  75. 2:56people. I don't really care where you
  76. 2:58go. Just can't all be in one room. And
  77. 2:59so you can look on the class assignment
  78. 3:02page all the way at the bottom and you
  79. 3:03can find your name and that's the room
  80. 3:05you've been assigned to.
  81. 3:08just alphabetical and it's they're not
  82. 3:10all the rooms are the same size. So,
  83. 3:11we're trying to do some load balancing.
  84. 3:14Any questions on that logistics?
  85. 3:23Okay.
  86. 3:25All right. So, your goal is you are here
  87. 3:28to maximize points. That's all you're
  88. 3:30trying to do. You don't even have to
  89. 3:31know embedded systems. You just get
  90. 3:33points on exam. I understand the game.
  91. 3:35It's totally fine. Let me tell you how
  92. 3:36to do that. So don't spend too much time
  93. 3:38on any one problem. Of course, leave
  94. 3:41yourself for design problems. Uh time
  95. 3:43for the design problem. State your
  96. 3:45assumptions. If we made some weird
  97. 3:48thing, it's like ah it was ambiguous. Is
  98. 3:51this bit supposed to be high or low? And
  99. 3:53we just didn't say. I don't know. We're
  100. 3:54insane people. Just say I assume this.
  101. 3:56If it's a reasonable assumption like you
  102. 3:58didn't have that information, we'll take
  103. 4:00it. If it was like I assume register uh
  104. 4:03the GPL register is malfunctioning.
  105. 4:05Yeah, that doesn't we're not going to
  106. 4:07that's not a valid assumption. But you
  107. 4:09know there are some times when there's
  108. 4:10ambiguity just say what you assume. Uh
  109. 4:13show your work explain what you've done.
  110. 4:15Uh you get lots of partial credit
  111. 4:17especially on the on the uh design
  112. 4:19problem. Um but without showing anything
  113. 4:22else without giving us any information.
  114. 4:23It's rare right? So give us all the
  115. 4:25reasons to give you partial credit. A
  116. 4:27sentence that says this is what I think
  117. 4:28the the APB should do for instance.
  118. 4:31Great.
  119. 4:33Um, yeah, data sheets. Uh, [snorts] we
  120. 4:35talked about this before, but you know,
  121. 4:37go on look over the data sheet
  122. 4:39beforehand. You should be able to figure
  123. 4:42out what the design problem is by
  124. 4:44reading the data sheet.
  125. 4:47Does anybody think that's true? Has
  126. 4:48anybody read the data sheet? Do you
  127. 4:50think you can uh figure out what the
  128. 4:52design problem is?
  129. 4:54Not we're not trying to hide it from
  130. 4:56you. we're there's going to be certain
  131. 4:58things that you have to figure out, but
  132. 5:00you know, it's not we're not trying to
  133. 5:01make it a mystery. It's also once you've
  134. 5:03done embedded assistance enough times,
  135. 5:05like you're like, "Oh, yeah, this really
  136. 5:07is these little connecting pieces, which
  137. 5:08is the problem, not the actual modules
  138. 5:10themselves."
  139. 5:12And so, a lot of what you're going to do
  140. 5:13on the exam is just um do the connecting
  141. 5:16pieces. Uh and if we find any major
  142. 5:19errors or issues with the data sheet,
  143. 5:21we'll update them. Well, um, it's a live
  144. 5:23document, but we'll update it on Slack
  145. 5:25so you know, so you're not caught off
  146. 5:26guard. Um, yeah.
  147. 5:30Okay. So, what to study? Homeworks,
  148. 5:32labs, [clears throat]
  149. 5:33old midterms are on the website.
  150. 5:36Uh, you know, the homeworks and the
  151. 5:38midterm, the midterms can be like the
  152. 5:40homeworks and the past midterms. There's
  153. 5:41no real surprises. Um, yeah. So, any
  154. 5:46questions so far?
  155. 5:49All right. Any questions about the data
  156. 5:51sheet?
  157. 5:54Do you want me to go over it?
  158. 5:57Yes. You say I see see people say yes.
  159. 5:58Please do that. Okay. Let's see.
  160. 6:04Some people lots of people maybe I
  161. 6:06misunderstood something. A lot of people
  162. 6:07are asking for access to this particular
  163. 6:10the sheet that caused that that is
  164. 6:12embedded here. I don't think you need
  165. 6:13access to the sheet. So if I declined
  166. 6:14you and you felt like I shouldn't have
  167. 6:16uh your request, just go on the website.
  168. 6:18It's right there.
  169. 6:20Um,
  170. 6:22all right. So, you have your fictional,
  171. 6:24you know, uh, M, uh, Cortex M4
  172. 6:27microcontroller. It's just supposed to
  173. 6:29be the exact same thing you've been
  174. 6:31using in the lab, except we're going to
  175. 6:33remove all the superolous information.
  176. 6:35We could just give you the data sheet.
  177. 6:36It's 1,000 pages. Like, you don't want
  178. 6:39to look through that in the exam. So,
  179. 6:41we're going to make it easier for you.
  180. 6:44um you know like there's there are pin
  181. 6:48outs you can this is a same thing kind
  182. 6:50of table you'd see in any
  183. 6:51microcontroller any data sheet tells you
  184. 6:54what the pin assignments are what it
  185. 6:55does and then you have peripherals and
  186. 6:57so remember this is a contract that the
  187. 7:00software people and the hardware people
  188. 7:02are making that [clears throat] if you
  189. 7:04interact with this thing the hardware
  190. 7:06will do that task and the game of
  191. 7:08drawing peripherals is like this you
  192. 7:11have to match your contract so If your
  193. 7:13peripheral says it's uh read write, then
  194. 7:16you probably have to read write to that
  195. 7:18uh register that's in that module,
  196. 7:20right? That would be the requirement of
  197. 7:21what has to happen. Uh because when
  198. 7:23you're drawing the APB um
  199. 7:25[clears throat] or peripherals, you are
  200. 7:27the hardware engineer at that point.
  201. 7:30Um we talked about this a little bit,
  202. 7:32but there's alternate functions and
  203. 7:34you'll find that you will probably need
  204. 7:36an alternate function. And there's just
  205. 7:37a map that shows you, hey, I have to put
  206. 7:39bits in those registers to make sure
  207. 7:41that alternate function appears on that
  208. 7:43GPL pin. [sighs]
  209. 7:47[snorts]
  210. 7:48No questions about that. Everybody's
  211. 7:49like, "Yes, I believe that."
  212. 7:55[clears throat]
  213. 7:56Okay.
  214. 7:57Um,
  215. 7:59there is a peripheral on there. This
  216. 8:01magical audio peripheral. It's based on
  217. 8:03real things. Like you if you really
  218. 8:05wanted to you could go look up what is a
  219. 8:06PDM microphone and read about it. You do
  220. 8:09not need to do that. It may be helpful
  221. 8:11just if you're like totally confused but
  222. 8:13how to convert from PDM to PCM. PDM
  223. 8:17stands for pulse sensing modulation. PCM
  224. 8:19stands for
  225. 8:21something I learned as undergrad.
  226. 8:25I don't know audio on device. And so you
  227. 8:27don't know how to do how to do that
  228. 8:28conversion is you just have to know that
  229. 8:30data comes in and data comes out the
  230. 8:31other end. Yeah.
  231. 8:33question.
  232. 8:36>> All right, that's it. I'm done.
  233. 8:38[laughter]
  234. 8:42>> Um, so my question was for the alternate
  235. 8:44>> Wait, is it on?
  236. 8:49>> I'll
  237. 8:51be
  238. 8:53>> No, you guys are all
  239. 8:57>> Can you Oh, okay.
  240. 8:59[laughter]
  241. 8:59Okay. Wait for the alternate function
  242. 9:01register. Do we assume that it's GPIO
  243. 9:05like defaulted or do we have to like set
  244. 9:08it to the GPIO? Like there was like a
  245. 9:10column like that says like all of them
  246. 9:12as GPIOs. Like do we assume that it's
  247. 9:14defaulted?
  248. 9:15>> Now what
  249. 9:18does reset value mean?
  250. 9:21>> Oh,
  251. 9:22>> so your manufacturers don't just let
  252. 9:24your microcontrollers come up with any
  253. 9:26bit state. I mean, it could happen like
  254. 9:28there's thermals and there's like
  255. 9:30variations in process design. So,
  256. 9:32they'll come up in some unknown state,
  257. 9:34but you certainly don't want your
  258. 9:35microcontroller to turn on and then
  259. 9:37start doing weird things. So, part of
  260. 9:39the power on reset cycle is that they're
  261. 9:42all set to some known value. And so,
  262. 9:45here we're [clears throat] telling you
  263. 9:47that on reset, and when I mean reset,
  264. 9:49that's also power on reset. The default
  265. 9:51value is 0000 for this register.
  266. 9:56[clears throat]
  267. 9:59Who else has
  268. 10:04>> all these values like SPAC, SEO, do we
  269. 10:07need to know those or are they like
  270. 10:08reference?
  271. 10:12You only need to know
  272. 10:14uh yes we gave you some obiscation
  273. 10:17information here but uh you knowcl is a
  274. 10:20protocol for um
  275. 10:23SBI and or no it's for I squared C a
  276. 10:26protocol that you will hear about later
  277. 10:28on
  278. 10:30you don't have to worry about that
  279. 10:31that's not referenced anywhere else in
  280. 10:32the data sheet you have
  281. 10:39Okay,
  282. 10:41[snorts]
  283. 10:42you got a PCM to PCVM converter. So this
  284. 10:45is the the peripheral just like a GPO
  285. 10:48peripheral. It has some functionality.
  286. 10:50It has some registers associated with
  287. 10:51it. You know, we're telling you what
  288. 10:53these bits do. We're telling you the
  289. 10:55reset values. And so here this is laying
  290. 10:58out what the programming interface this
  291. 11:00is. The programmer should expect the
  292. 11:02peripheral to act this way.
  293. 11:06Uh there's an external microphone.
  294. 11:09Not nothing you really have to know
  295. 11:10about this. This exists. It's going to
  296. 11:12have a task. So when you're asked, hey,
  297. 11:14this thing is in your embedded system.
  298. 11:16You should at least know conceptually
  299. 11:17what it is. But again, you do not not
  300. 11:19have to know what PDM data format is or
  301. 11:22PCM data format inherently. Maybe PCM is
  302. 11:25good just to understand.
  303. 11:28Um
  304. 11:29there's a you know a screen that has a
  305. 11:32parallel interface. It talks about how
  306. 11:34this parallel interface is the pin out.
  307. 11:37Talks about how to interact with the
  308. 11:39parallel interface, what pins have to go
  309. 11:42high, what pins have to go low.
  310. 11:45And then you have the rest of the um the
  311. 11:48data sheet which is us the appendix,
  312. 11:50right? which is this is all just to tell
  313. 11:52you remind you hey if you want to
  314. 11:55remember the kind of conventions that we
  315. 11:57developed this you can do this and then
  316. 11:59uh you can look through here if you find
  317. 12:00a weird instruction that you want to see
  318. 12:02uh how it operates
  319. 12:05all right
  320. 12:07yeah
  321. 12:11the address for the data register
  322. 12:13threshold register why
  323. 12:18>> the data register in
  324. 12:20status here.
  325. 12:22>> Let me see. So,
  326. 12:25which you're talking about? Oh, here.
  327. 12:28>> Yeah,
  328. 12:28>> this is 4,000 and this is 48.
  329. 12:31>> Uh, I mean, wait, I don't
  330. 12:36like it seems like they're like I don't
  331. 12:37know far apart if that makes sense.
  332. 12:41>> They are. Oh, cuz this is a one.
  333. 12:43>> Yeah.
  334. 12:45>> Okay, here we go. I have edit access.
  335. 12:48Here we go.
  336. 12:51Let make sure this doesn't collide with
  337. 12:52other things. This is Yeah.
  338. 12:57Uh oh. Yeah, those should be
  339. 13:01should be this. I think I was just off
  340. 13:03by one. There's one. That's a th00and
  341. 13:071,000 there, 104
  342. 13:10[clears throat] and 108. Okay, that
  343. 13:12feels good. And then these are
  344. 13:16okay.
  345. 13:18I'll double check all these registers,
  346. 13:20but they seem to be about right. So, the
  347. 13:23two peripherals are off by about a
  348. 13:24thousand.
  349. 13:26>> Okay.
  350. 13:30These are normal questions. Yeah.
  351. 13:32>> Going back to the alternate function.
  352. 13:34>> Yeah.
  353. 13:34>> Does the GPI
  354. 13:37have to be configured to the alternate
  355. 13:39function and the alternate function
  356. 13:41register be configured for the
  357. 13:44>> Y.
  358. 13:45>> Okay. Just like your data sheet, just
  359. 13:46like your vice using lab.
  360. 13:49>> So then if we have a GPIO as alternate
  361. 13:53function, but the alternate function is
  362. 13:55just GPIO
  363. 13:58GPI. We're trying to make it a little
  364. 13:59bit simple for you. We could have made
  365. 14:00it way more complicated.
  366. 14:03>> GPIO meaning.
  367. 14:08>> Well, you have registers that say the
  368. 14:10mode of your GP, right? All right. So if
  369. 14:13you're in DPM mode then um you can say
  370. 14:17is it output is it input?
  371. 14:21>> But isn't that computed in the same
  372. 14:23place as not it's doing its function?
  373. 14:28>> Uh let's see. So
  374. 14:31maybe we have an error here. No. Okay.
  375. 14:33So we have a register. So here's a mode
  376. 14:35register, right? And here my mode can be
  377. 14:38input output alternate function or
  378. 14:40interrupt. You don't have interrupts
  379. 14:42yet. And then you have a whole another
  380. 14:44register where you're defining what it's
  381. 14:45going to be. So you're saying that, hey,
  382. 14:47I made it too confusing. This shouldn't
  383. 14:48exist. This is not a valid alternate
  384. 14:51function. I like that. Okay, I'll put a
  385. 14:56note here that I have to go and modify
  386. 14:58update.
  387. 15:00All right, so that's fair. So here what
  388. 15:04we're saying is uh normally it's one of
  389. 15:07these four you use these two bits for
  390. 15:10any one uh GPIO and I can make an input
  391. 15:13output interrupt or alternate function.
  392. 15:15This should not be valid. Okay. And then
  393. 15:18I'll replace that with something and put
  394. 15:20a note on PCS.
  395. 15:22All right. See would it be so easier if
  396. 15:24you could just call Infinion and just be
  397. 15:26like what what is this thing? I don't
  398. 15:28understand. And then they just edit it
  399. 15:29live for you. That would be great. I
  400. 15:31don't have that power.
  401. 15:33>> [clears throat]
  402. 15:35>> Yeah.
  403. 15:36>> Um, so
  404. 15:39register.
  405. 15:53>> Hold on. I couldn't hear all that. So,
  406. 15:54you're saying the Oh, it's only four.
  407. 15:57Okay, fine. Okay, we got a little
  408. 15:59register check.
  409. 16:01Okay, you guys
  410. 16:04like so if I went on the exam, I
  411. 16:07wouldn't really if I make that error and
  412. 16:08you guys just faithfully put in whatever
  413. 16:10the address is, I'll be like, "Okay,
  414. 16:12fine." Like, I screwed up. But we're
  415. 16:13catching it now. Check all
  416. 16:18addresses. Okay, that's kind of spelled
  417. 16:21correctly.
  418. 16:23Okay, what else you got?
  419. 16:30See this is great. You guys are helping
  420. 16:31make the exam better. Now you could
  421. 16:34write the exam problems too. That would
  422. 16:36be nice.
  423. 16:38>> All right. If there any other if there
  424. 16:39aren't any other question of the day she
  425. 16:40we should probably move on to other
  426. 16:42parts talk about. [sighs]
  427. 16:45All right.
  428. 16:48So where where were we?
  429. 16:50All right. So what are we going to talk
  430. 16:51about? Talk to be covered on the exam.
  431. 16:53So ARM of course instruction set the ISA
  432. 16:58um you should at least know how if given
  433. 17:00part of the data sheet you should know
  434. 17:01like okay how are instructions encoded
  435. 17:05how would you use them you also have the
  436. 17:07appendix as well uh how to use
  437. 17:09[clears throat] load and stores and
  438. 17:10addressing mode we talk a lot about
  439. 17:12caller poly safe and the AI and the
  440. 17:15alternate name for the AI and stacks and
  441. 17:17pointers and link registers and all the
  442. 17:19intricacies there and then that really
  443. 17:21the new concept for the course is memory
  444. 17:22map IO
  445. 17:24I talked about having these synthetic
  446. 17:26addresses versus real addresses and that
  447. 17:28you know there's memory versus uh
  448. 17:30physical memory versus registers and
  449. 17:32then there's a lot of like the ABA or
  450. 17:35the APB light version. Uh we did talk
  451. 17:37about uh interrupts but we didn't go
  452. 17:39into deep dive into interrupts and you
  453. 17:42didn't have a lab on interrupts yet. So,
  454. 17:44I might there might be like a conceptual
  455. 17:46question about interrupts, but probably
  456. 17:47not to the depth of the uh I didn't
  457. 17:51remember looking through all the W25
  458. 17:54exam, but I think they just were ahead
  459. 17:55of us in class. That's why they asked
  460. 17:58more questions about that.
  461. 18:01All right, I'll just start going through
  462. 18:03slide review and stuff. Do you have any
  463. 18:05exam other questions?
  464. 18:09Okay, so major elements, right? You got
  465. 18:12to know we have the pro in the core
  466. 18:14right we have registers we have memory
  467. 18:18and a lot of this is these are all
  468. 18:1932-bit wide the program uh status
  469. 18:22register which has these extra bits in
  470. 18:25them right so these are your alu flags
  471. 18:27and remembering how to use those uh to
  472. 18:30do if statements and branch conditions
  473. 18:33and then to connecting all this is you
  474. 18:36have some assembly so you have [snorts]
  475. 18:39instructions that only operate on the
  476. 18:42register. So these are predominant like
  477. 18:45moves, ads, all those sort of things.
  478. 18:46And then there's a second class of two
  479. 18:48instructions and they're variations that
  480. 18:50allow you to interact with memory. So
  481. 18:52you have loads and stores and then uh
  482. 18:55and those exist in code, right? And then
  483. 18:58you have um like we talked about you
  484. 19:00have branch conditions and sub
  485. 19:02[clears throat] conditions that allow
  486. 19:03you to set these flags.
  487. 19:06Uh what else do I want to say? And then
  488. 19:10yeah
  489. 19:12and then the I don't forget if there's
  490. 19:13actually a slide on this but just
  491. 19:15remembering the intricacies of uh the
  492. 19:17fact that uh you can uh the address
  493. 19:21space is for a bite but typically we
  494. 19:24think about it as words where addresses
  495. 19:26increment by four. So just being
  496. 19:28familiar and capable of inter going in
  497. 19:30between those two kind of conceptual
  498. 19:32notations.
  499. 19:35[clears throat]
  500. 19:35>> Yeah.
  501. 19:37uh what we're having this is you haven't
  502. 19:40used like
  503. 19:42>> this is just more of a this is not
  504. 19:43supposed to be a complete code just like
  505. 19:45this is where [clears throat] things
  506. 19:45exist out of curiosity
  507. 19:49>> you if if you did this then you have to
  508. 19:51go those flags are then set somewhere
  509. 19:53else further in code or they're all zero
  510. 19:55so they're going to default to zero
  511. 19:57something's going to happen I guess for
  512. 19:58the sake of this example I can switch
  513. 20:00those
  514. 20:05right So, uh, I mean, just for clarity,
  515. 20:08the alien flags are not updated every
  516. 20:10single time. They're only updated when
  517. 20:13there's an S condition or a comparison
  518. 20:14or a test. And so, if you did this, you
  519. 20:17might be running on the old decision
  520. 20:18from a long time ago.
  521. 20:22Um, yeah, we talked about different
  522. 20:25registers. They're all 32 bits. you
  523. 20:27don't really care that much about um the
  524. 20:30control register and the fault mask and
  525. 20:33the fire mask and those other things.
  526. 20:36Some of those we'll talk about later,
  527. 20:37but the program status register you care
  528. 20:39about. We don't really care about uh the
  529. 20:42main Zach pointer and then the process
  530. 20:44pointer, it's not that big a deal for
  531. 20:45this file. You can just think about it
  532. 20:46as pointer, but uh highlighted in green
  533. 20:50there is what you mostly have to think
  534. 20:52about.
  535. 20:53All right.
  536. 20:57Oh, here we go. So, memory,
  537. 21:00uh, remember here we're in this zone of
  538. 21:05ARM has allocated 4 GB of space, but
  539. 21:09it's also I think when I try and think
  540. 21:10through this, it's really good to think
  541. 21:12about the business model of ARM. ARM is
  542. 21:14not here to tell uh the manufacturers
  543. 21:18where to put their peripherals or like
  544. 21:20what their peripheral should do or how
  545. 21:22much RAM they have. they just allocate.
  546. 21:24Here's where you could put it if you
  547. 21:25wanted to.
  548. 21:27And so in this particular case, right,
  549. 21:30you're going to see that there's lots of
  550. 21:31this is examples for the STM32 cuz it
  551. 21:34has a little bit nicer documentation,
  552. 21:36but just to show off uh that I mean that
  553. 21:38your your particular device does the
  554. 21:40same thing that there's lots of reserved
  555. 21:41spaces here. So here even though they
  556. 21:44say SRAMM goes from here to here you get
  557. 21:47see lots of little blank areas and that
  558. 21:49just means that you are not able there's
  559. 21:51nothing there to write to the address uh
  560. 21:55maybe it could exist but there's no
  561. 21:57stakeholding device there and they've
  562. 22:00just chosen that from architectural
  563. 22:01point of view we don't need to fill this
  564. 22:02in there's no value for us and so I had
  565. 22:05some people in office hours asking
  566. 22:07questions about this so one way to think
  567. 22:08about this is uh you have a development
  568. 22:10here and you the town has allocated that
  569. 22:13all these houses could live there or
  570. 22:15they've done the planning and allocated
  571. 22:17the the land lots and the builder only
  572. 22:21put in houses at certain locations. So
  573. 22:23the address is there but there's no
  574. 22:24place for the people to live and that's
  575. 22:27equivalent to um how this is the
  576. 22:30addresses are implemented or allocated
  577. 22:32but just not implemented.
  578. 22:40>> Yeah. know like split. [clears throat]
  579. 22:44>> Do you do you need to memorize where
  580. 22:46those splits occur? No. That would be
  581. 22:49horrible. Can you imagine how to know
  582. 22:50that? That's why we give you a data
  583. 22:51sheet, right? This says engineers don't
  584. 22:54memorize anything. Just all you have to
  585. 22:56know is the reason why things exist and
  586. 22:58then go look up the details later
  587. 23:00because I can't I guess I'm going to
  588. 23:01give you off because I can't remember
  589. 23:03anything. So, I'm not going to expect
  590. 23:04you guys to remember any of that.
  591. 23:06Okay. Oh, good. We did have a slide on
  592. 23:09this. So we're just talking about the
  593. 23:10memory organization. The slide obviously
  594. 23:12came earlier in the lectures as well.
  595. 23:14But just the differentiation here
  596. 23:17addresses are indexed by four or by one,
  597. 23:20right? For one bite for each uh data
  598. 23:22place, right? So here we're incrementing
  599. 23:25by one value for each address. But the
  600. 23:27way we think about that and the way most
  601. 23:29operations occur is that we're we're
  602. 23:31going to rewrite this to increment by
  603. 23:33four. So each address in current bites
  604. 23:34by four and then we have a word just
  605. 23:36because most most operations are going
  606. 23:39to occur on a 32-bit word but ARM gives
  607. 23:42you this opportunity to go through and
  608. 23:45um do bite operations or halfword 16 bit
  609. 23:49operations and there are some times when
  610. 23:51just you want to really compact as much
  611. 23:52data into the space as possible and
  612. 23:54that's a useful tool. Um, also good to
  613. 23:57be backwards compatible with some uh
  614. 23:59earlier probably tool chains and devices
  615. 24:02they built. Um, and then of course you
  616. 24:05have to know your ending and be able to
  617. 24:07reason away your way through these
  618. 24:09tools. I think your idees show them
  619. 24:12usually going down. Sometimes some IDs
  620. 24:14show them going uh increasing up. So
  621. 24:16just remember to look at the addresses
  622. 24:19here and figure out if the stack is on
  623. 24:21the top or the stack is on the bottom.
  624. 24:25Okay.
  625. 24:28And then the big conceptual thing is
  626. 24:29like this is just talking about memory
  627. 24:32[clears throat] allocation,
  628. 24:34but it has no idea here where the memory
  629. 24:36is allocated. ARM in the core's point of
  630. 24:38view is everything is memory [snorts]
  631. 24:40and we're just going to use loads and
  632. 24:41stores to talk talk to it. And that's
  633. 24:43that's about it. And now um we get to
  634. 24:47the vendor side of things.
  635. 24:50[clears throat]
  636. 24:50And the vendor is going to go and
  637. 24:52distribute that map. Right? So this is
  638. 24:54that little memory allocation symbol of
  639. 24:56a map. And now that is really allocated
  640. 24:59all throughout your chip. So some of it
  641. 25:02is going to be an SRAM, right? And SRAM
  642. 25:04is very fast. It's small. It's compact.
  643. 25:07Um but the problem is when you power off
  644. 25:08the device, it loses state. So we call
  645. 25:10it volatile being a different term than
  646. 25:13the volatile for say C instruction. And
  647. 25:17then uh flash which is underneath the
  648. 25:20word code there. Flash is a data
  649. 25:22structure or memory structure that is
  650. 25:24nonvolatile. So you can power it off and
  651. 25:26power it back on. Same data is in there,
  652. 25:28but it's much larger and slower. So now
  653. 25:31we have a trade-off. If a flash was just
  654. 25:33as fast and small as SRAM, then you
  655. 25:35wouldn't need SRAM. But it's not. It's
  656. 25:37larger um slower. And so often times
  657. 25:41what happens is that your program is in
  658. 25:44uh flash and then on boot up uh it gets
  659. 25:46pushed into SRAM so that you can have
  660. 25:48faster interactions. Um and so that's
  661. 25:51there's just this definition
  662. 25:52[clears throat] of like where where is
  663. 25:53that memory and then the other
  664. 25:55conceptual break here is that um over
  665. 25:58here in the peripherals it's not flash
  666. 26:00or SRAMM it's a different type of memory
  667. 26:03it's registers and the registers are
  668. 26:05sure state holding uh storage devices
  669. 26:08but really it has this alternate
  670. 26:10functionality in the sense that
  671. 26:12especially for a GPO pin register you
  672. 26:14can put data into the output register
  673. 26:16but then something else happens right
  674. 26:17the GPO pin goes high or you can read
  675. 26:20data out of it. And the idea here is
  676. 26:23that you as the programmer are now
  677. 26:25responsible for knowing how to interpret
  678. 26:27the outputs or what that memory does. Uh
  679. 26:30the core has no idea that sending data
  680. 26:33to a certain address creates the GPO in
  681. 26:35go high or low but you as a programmer
  682. 26:37have to reinterpret what that data would
  683. 26:39mean. And that's why we have the data
  684. 26:40sheet and I talk about the registers all
  685. 26:42the time.
  686. 26:44Any conceptual questions?
  687. 26:54Okay. Uh we did talk we went through you
  688. 26:57know lecture there's a bunch of uh quick
  689. 27:00discussions about different
  690. 27:02instructions. I don't want you guys to
  691. 27:04remember instructions like memorizing
  692. 27:06instructions is horrible. That's
  693. 27:07[snorts] why we give you the data sheet.
  694. 27:08But there's probably some in general
  695. 27:10that are going to be useful. You should
  696. 27:11probably know how to use loads and
  697. 27:13stores off in all the indexing off the
  698. 27:15top of your head. uh adds, moves,
  699. 27:18branches are probably important, but
  700. 27:20that's why there's a data sheet. Um, so
  701. 27:22again, don't don't try to memorize uh a
  702. 27:25bunch of instructions.
  703. 27:28Uh you don't even have to memorize this
  704. 27:29sheet. All you have to memorize about
  705. 27:31this is that uh many instructions have
  706. 27:33the opportunity to have a ss suffix. And
  707. 27:37the suffix says that they're going to
  708. 27:39update the um program status register
  709. 27:42flags. And so this is how you would, you
  710. 27:45know, assign or set them up. Otherwise,
  711. 27:47that's all they do. There's no
  712. 27:49difference between them. And then you'd
  713. 27:50have to look into the actual uh
  714. 27:52instruction on the ARM B7M
  715. 27:56ISA. Just figure out, okay, like how do
  716. 27:58I encode the S? Sometimes you have to
  717. 28:00encode the S because there's a field.
  718. 28:01Sometimes [snorts] it's implicit in the
  719. 28:03instruction, but uh most instructions
  720. 28:06have this option where it makes sense.
  721. 28:08And those are, you know, updated here in
  722. 28:10the ALOU uh flags here.
  723. 28:17Okay.
  724. 28:18Yep. And then once you have those set,
  725. 28:21then you get to do well, you're doing
  726. 28:23branches in general, [clears throat]
  727. 28:24right? So you have branches to a label
  728. 28:27um branches to a label and then updating
  729. 28:30a link register uh and different
  730. 28:32variations of that. It's important to
  731. 28:34remember like how labels work. Those are
  732. 28:38um when you look at your disassembled
  733. 28:40code uh or you're writing code that is
  734. 28:44going to uh point to a particular memory
  735. 28:47location. But when the assembler comes
  736. 28:49through and does its job with a link
  737. 28:50linker, it resolves where those labels
  738. 28:54point to what the actual memory [snorts]
  739. 28:55address is. That's the part of the core
  740. 28:58planning process. Okay. So once you have
  741. 29:01your labels and you have your you can
  742. 29:03add and your branches you can use your
  743. 29:05branches and put conditionals on top of
  744. 29:07them. And so here's just the um a table
  745. 29:10that shows okay you could do a b equals.
  746. 29:12So what does that end mean? That means
  747. 29:14that the z flag from your alou is one.
  748. 29:17And under that condition you would uh do
  749. 29:19the branch otherwise you wouldn't.
  750. 29:23Um and then you can just work your way
  751. 29:24through to figure out what all those
  752. 29:26logical combinations are. And again this
  753. 29:27is in the uh appendix. So you don't have
  754. 29:30to memorize this stuff, but you should
  755. 29:31probably know how to use the appendix
  756. 29:32pretty uh quickly. Yes.
  757. 29:37>> Is that sign?
  758. 29:40[clears throat]
  759. 29:44>> I think it's for a constant. There's no
  760. 29:47idea of sign, right?
  761. 29:52Oh. Oh, sorry. You mean you're creating
  762. 29:54a constant, not when you are um not when
  763. 29:57you're getting data in and out of
  764. 29:58memory. Is that right?
  765. 29:59>> Yeah.
  766. 30:00>> Uh you just have to look at the the
  767. 30:02instruction of making that thing. I
  768. 30:04think you could probably it probably
  769. 30:05might be a sign extended uh instruction
  770. 30:09for making it a negative value. I'm not
  771. 30:10sure though.
  772. 30:17Okay.
  773. 30:20Uh talked a lot about loads and stores
  774. 30:22and the different variations. So you
  775. 30:24guys got the normal load in store and
  776. 30:26then the pre-indexing. So uh where you
  777. 30:30go and you're augmenting the register or
  778. 30:34the value that's stored in the register
  779. 30:35but the uh actual value stays unchanged.
  780. 30:38And the reason they have this is uh if I
  781. 30:40had set up those tables uh on the data
  782. 30:44sheet correctly with the correct
  783. 30:45incrementing addresses the trick is that
  784. 30:48you would just store the base register
  785. 30:49address of a um of that you know that
  786. 30:54peripheral and then you would just be
  787. 30:55augmenting the offset register. So
  788. 30:57that's like kind of how the assembler,
  789. 30:59the program or the compiler works. It's
  790. 31:01really storing the base address and then
  791. 31:04um
  792. 31:05uh augmenting it. Now I don't care what
  793. 31:07you guys do on the exam. You want to do
  794. 31:08the full address is fine. You don't have
  795. 31:11to use that trick of uh offsetting to uh
  796. 31:14get into uh the actual registers off of
  797. 31:17the base register.
  798. 31:20Uh and then there's a post indexing and
  799. 31:23uh pre-index or post xinding with uh
  800. 31:26updates.
  801. 31:27All right. So just an example here. Here
  802. 31:29we're going to load the value that's
  803. 31:33stored uh so the address is stored in
  804. 31:35R1. We're going to put that value or
  805. 31:37sorry the address is stored in R0 and
  806. 31:39we're going to put that value in R1. And
  807. 31:42so here again we just look here to
  808. 31:45figure out what world are we in, right?
  809. 31:46Did I did I make something crazy where x
  810. 31:50hex here and I only put the two digits
  811. 31:52instead of all digits? Well, you can go
  812. 31:54look uh here to see what the increment
  813. 31:57of memory is. So, this is actually bite
  814. 31:59uh memory layout. And now I'm going to
  815. 32:01take those four values because it's a
  816. 32:03load and not a load [snorts] bite. And
  817. 32:05I'm going to place that in the
  818. 32:06destination of R1.
  819. 32:09Uh offset addressing is where you on the
  820. 32:13fly as the um uh load is occurring for
  821. 32:19or whatever this value is is added to it
  822. 32:21and then that is placed into R1. So
  823. 32:23there's not this extra calculation that
  824. 32:25has to happen. It's not the ALOU is
  825. 32:27actually taking another cycle to add
  826. 32:29that value in there. It happens in one
  827. 32:31cycle. Although I will say that the load
  828. 32:34obviously can take multiple cycles,
  829. 32:36especially if you're going all the way
  830. 32:37out to a peripheral which is on a
  831. 32:39different clock domain, but there's no
  832. 32:41inherent penalty for doing this uh uh
  833. 32:44offset in addressing.
  834. 32:46Okay, so anyways, you've added four, you
  835. 32:48can put that back into R1.
  836. 32:51uh pre-indexing uh addressing is where
  837. 32:55here you increment this by four and then
  838. 32:58you place that value in here and here
  839. 33:00that increment has stayed there the
  840. 33:03entire time and so this is good if
  841. 33:05you're trying to like iterate through a
  842. 33:06loop or something [clears throat] that
  843. 33:07is a good way to keep track of things
  844. 33:10and then post indexing here you've
  845. 33:12offset you you uh before you do the
  846. 33:15offset you're going to take this value
  847. 33:16you're going to store into R1 and then
  848. 33:18in post you go and add four to Any
  849. 33:24questions?
  850. 33:28[snorts]
  851. 33:30Okay.
  852. 33:32Uh so we'll talk a little bit about AI
  853. 33:34stuff. Uh so the basic rules here uh
  854. 33:39yeah so R4 through R11 uh must be uh
  855. 33:44preserved. uh R12 is I threw I say be
  856. 33:48careful with it is it's the inner
  857. 33:49procedural uh register uh so it can be
  858. 33:53used in in function calls I just be
  859. 33:55careful about it when you're writing
  860. 33:56handcrafted assembly on on a real device
  861. 33:59but this is available for
  862. 34:01interprocedural calls as well as as
  863. 34:03scratch space uh R0 through R3 have to
  864. 34:06be [laughter] uh preserved um or no the
  865. 34:10the function that's or the main that's
  866. 34:12calling the function can't assume that
  867. 34:14anything's happening happening in there.
  868. 34:15Uh that's scratch space for a function
  869. 34:18uh to use. And conversely, function
  870. 34:21cannot use R 4 uh through R11. It can't
  871. 34:26uh I mean it can use them. It has to put
  872. 34:27that value to the stack and pull it
  873. 34:29back, but it has to preserve those.
  874. 34:32Maybe this a little outdated. Number
  875. 34:33three is values can be passed through R0
  876. 34:37and R1, but they can also be passed
  877. 34:39through R 0 through R3. It's just that
  878. 34:42uh ARM has this idea that that is a
  879. 34:44vectorzed
  880. 34:45uh variable for all of R0 through R3 are
  881. 34:50uh a block a unit that passes uh data
  882. 34:53back. Conceptually, you can use all four
  883. 34:56of those registers to send variables
  884. 34:58back if you want. Yeah.
  885. 35:00>> The register SP again.
  886. 35:02>> SP sack pointer.
  887. 35:04>> You can't mess that up.
  888. 35:06>> So I have to push it at the beginning.
  889. 35:10>> No, no, no. uh and maybe there's a you
  890. 35:13can't go and the sub routine should not
  891. 35:16go and overtly modify the sack stack uh
  892. 35:20pointer right so if the subruine goes
  893. 35:23and uses the sack pointer it can't then
  894. 35:26use like a load or a load value to get
  895. 35:29the data back off that it has to use
  896. 35:31sack pointer again so sack pointer
  897. 35:32should be returned to where it was
  898. 35:34before the sub routine ended [snorts]
  899. 35:39up Yeah. So, you shouldn't pop a bunch
  900. 35:42of stuff and never uh or push a bunch of
  901. 35:44stuff and not pop it, right? Cuz then
  902. 35:46the stack pointer is not left where it
  903. 35:48should be.
  904. 35:53Okay,
  905. 35:55let's see. This is kind of repeat of
  906. 35:58that. Um there is special functions
  907. 36:01where R9 can be used for other
  908. 36:04functionalities in thread mode uh as a
  909. 36:07static base register. We don't really
  910. 36:08cover them in this class in for 373. You
  911. 36:11can just assume it's a general uh
  912. 36:13variable register
  913. 36:16and R12 [clears throat] again is the uh
  914. 36:18sub routine or interprocedural uh stack
  915. 36:20scratch space
  916. 36:24any questions? Okay.
  917. 36:27Uh so let's go through a sub routine
  918. 36:29call. So here the the trick often times
  919. 36:33is that when a subruine calls a subruine
  920. 36:36so when [clears throat] you just do a
  921. 36:36normal sub routine call the link
  922. 36:38registers there it's helping you right
  923. 36:39it's your way back but the trick is when
  924. 36:41a function calls a function you need to
  925. 36:43keep track of your path back to main and
  926. 36:46so now the quad was going to have to go
  927. 36:49and pop uh and push and pop the link
  928. 36:52register so it's available uh that
  929. 36:54information is not lost so that's a the
  930. 36:56trick of doing uh nested functions
  931. 37:04Um yeah,
  932. 37:07one thing that often gets students
  933. 37:08tripped up is that uh you know the the
  934. 37:13uh when you use push or pop the order
  935. 37:16actually gets reordered. And why does
  936. 37:18that happen? Well, the order is you have
  937. 37:20to think about how is that instruction
  938. 37:22encoded, right? It's not in it's not
  939. 37:24that there is actually the compiler goes
  940. 37:27and takes that and puts it into three
  941. 37:28different pushes. It's actually that
  942. 37:30instruction can take um you know depends
  943. 37:33on the actual encoding but could take
  944. 37:35say up to eight variables. Um and so if
  945. 37:38you're going to do that like um the
  946. 37:40instruction doesn't know when it's
  947. 37:42encoded and put into binary doesn't know
  948. 37:44what order those things you as a
  949. 37:46programmer put in. Instead, it's just
  950. 37:48rule. It says this register should be
  951. 37:50done. That register should not be done.
  952. 37:53And then it just goes through them
  953. 37:54sequentially. So that's why push gets
  954. 37:57reordered. And that is different than if
  955. 37:59you made three separate push
  956. 38:01instructions then uh then that
  957. 38:04[cough and clears throat] exact order.
  958. 38:05It's just if you did three separate push
  959. 38:07instructions and then did a pop with
  960. 38:09three variables in it. Uh those would
  961. 38:11have to be in order otherwise it won't
  962. 38:13pop in correct order.
  963. 38:15So only only for the registers in one in
  964. 38:19[clears throat] one push instance or one
  965. 38:22push instruction are they reordered but
  966. 38:24not for individual push instructions.
  967. 38:26They're not reordered. The compiler
  968. 38:28doesn't know about that.
  969. 38:32>> Yes. Um, so if there's like a push
  970. 38:36instruction and then another instruction
  971. 38:38and then another push instruction, are
  972. 38:40the two registered push instructions
  973. 38:43like in order?
  974. 38:44>> No. Okay.
  975. 38:45>> Any individual instruction like these
  976. 38:47are not in order, right? You can do
  977. 38:49individual instructions could push
  978. 38:51things to the stack out of order.
  979. 38:55>> No, no. I mean like um if there's like
  980. 38:58um push like instructions, they're like
  981. 39:00separated, right? like would all
  982. 39:03register into push to be automatically
  983. 39:06sorted.
  984. 39:07>> Yeah, I mean everything everything you
  985. 39:09push will go to the stack. It's just
  986. 39:11that orders uh is reordered if the
  987. 39:16registers are put into one push
  988. 39:18instruction. But if they're individual
  989. 39:19instructions and they're done at
  990. 39:20individual times.
  991. 39:25>> Yeah.
  992. 39:27>> Should you push it out of order? Should
  993. 39:29he push out of order? I don't care what
  994. 39:30you do. I mean, what's the
  995. 39:34care?
  996. 39:36You just got to make sense, right? If
  997. 39:37you go and push them out of order and
  998. 39:39then you bring them back in in a
  999. 39:41different order and that didn't work,
  1000. 39:44>> then you lose points. I don't know. But
  1001. 39:46it's not like I don't it's not a
  1002. 39:48stylistic choice. It's whatever kind of
  1003. 39:50works.
  1004. 39:52>> PC.
  1005. 39:57You can do it either way. It doesn't
  1006. 39:58really matter. I I don't care if the if
  1007. 40:01the thing works logically, that's fine.
  1008. 40:04We rarely take off points. Like I know
  1009. 40:07in like some of your programming
  1010. 40:08classes, they're like, "You add one
  1011. 40:10extra instruction and now you're a bad
  1012. 40:12student. We're going to take points
  1013. 40:12off." I don't care that much. If it's
  1014. 40:14insane logic, then I'm like, "I don't
  1015. 40:16know what you're doing." Right? But
  1016. 40:17like, did you optimize every possible
  1017. 40:19instruction? I That's why we have some
  1018. 40:21highlights. What is it that sometimes
  1019. 40:25like if you push the like register and
  1020. 40:29then you pop the PC? It's just stylistic
  1021. 40:33choice. You could do it point by point.
  1022. 40:36You could um you could uh because
  1023. 40:39essentially the link register is going
  1024. 40:40to go into the PC anyways, right? So you
  1025. 40:43could just go so instead of uh you could
  1026. 40:46say take the P the link register put it
  1027. 40:48back in link register off the stack and
  1028. 40:50then branch link register right that
  1029. 40:52would be the same thing if you just took
  1030. 40:53two instructions.
  1031. 40:56uh we are rarely counting instructions
  1032. 40:59unless it unless it says the prompt is
  1033. 41:01like in the most efficient way possible
  1034. 41:03or within these number of instructions
  1035. 41:06you know this is a point
  1036. 41:11okay
  1037. 41:16let's see and the same is true for pop
  1038. 41:19uh just some of the pain I don't have a
  1039. 41:22diagram here uh it's just you have to
  1040. 41:24remember that Wherever the sack pointer
  1041. 41:27is pointing, that is the last relevant
  1042. 41:30data. So in this particular example, I
  1043. 41:31don't know what was there. I could have
  1044. 41:32put some big value in there, but it
  1045. 41:34doesn't really matter at least for this
  1046. 41:36example. So the first thing when you go
  1047. 41:39push something to the stack, it
  1048. 41:40increments and it's going to put the
  1049. 41:41data in the next location. So it's
  1050. 41:44remembering is this is kind of like this
  1051. 41:46off by one case. You just have to there
  1052. 41:48you do have to remember something. Uh so
  1053. 41:50now you just have to remember the stack
  1054. 41:51pointer, how that works, how push and uh
  1055. 41:53pop work.
  1056. 41:55Okay. So, I'll work through this
  1057. 41:57example. Uh let's see what are we doing.
  1058. 42:00We have a uh assembly code. It's going
  1059. 42:03to call uh square and then or quad. It's
  1060. 42:06going to call square and we have stack
  1061. 42:08pointer that points somewhere. And then
  1062. 42:09we're going to walk through this code.
  1063. 42:10So, this is supposed to be instruction
  1064. 42:12space. Uh this is your stack pointer or
  1065. 42:15this is your stack. Of course, it's all
  1066. 42:16unified memory. There's no real
  1067. 42:18difference. Um but we're just starting
  1068. 42:20off here. And here's some registers.
  1069. 42:22Okay. So, let's Where are we going to
  1070. 42:24start? Okay, so we're going to start
  1071. 42:25here. It's highlighted here the the uh
  1072. 42:28disassembled code and uh decoded what's
  1073. 42:31in memory. And so the program counter is
  1074. 42:33pointing up here. We're going to move
  1075. 42:35two into R1 that was just done or R R0.
  1076. 42:38Then we're going to branch link
  1077. 42:40register. So we're going to branch the
  1078. 42:42link register for the next instruction
  1079. 42:44here has been updated uh with this
  1080. 42:47value. And then we're going to branch
  1081. 42:50and we had to branch to uh quad which
  1082. 42:54has been resolved. Uh here is where we
  1083. 42:56see the label for quad and it's to this
  1084. 42:59location.
  1085. 43:01And uh let's see what do we do? Oh and
  1086. 43:03in this instruction we're going to push
  1087. 43:05the link register to the stack. So we
  1088. 43:07have it. So quad has its path back to uh
  1089. 43:11end here.
  1090. 43:14Then in this trivial uh example, we're
  1091. 43:17going to again branch update a link
  1092. 43:20register to square.
  1093. 43:23Uh link register gets updated. We go
  1094. 43:25into square and multiply two things
  1095. 43:26together. We branch out. Uh well, we're
  1096. 43:30going to take so it's branch register.
  1097. 43:31What are we going to put in the
  1098. 43:32register? Transfer the link register.
  1099. 43:35And now we're just going to copy that
  1100. 43:36over. So that's BLR.
  1101. 43:39And we're going to do quad again or
  1102. 43:41we're going to go to the square again.
  1103. 43:42do the same thing.
  1104. 43:45Um, do that all over again. Branch back
  1105. 43:47to the link register. And then the trick
  1106. 43:49is this link register is the old link
  1107. 43:52register, right? That was way back to uh
  1108. 43:55quad. But if you're trying to quad wants
  1109. 43:57to get back to its main, it needs the
  1110. 43:59correct link register. Well, and this is
  1111. 44:01the wrong one. So now it has to go back
  1112. 44:03up to the stack to grab it, pushes it in
  1113. 44:06there, and then branches back to the
  1114. 44:08link register. So you could have done
  1115. 44:10pop pc would have been the same thing.
  1116. 44:11Doesn't really matter.
  1117. 44:15Okay. What questions do you have?
  1118. 44:20Okay.
  1119. 44:23Okay. Memory map.io.
  1120. 44:26So almost all this class is just like
  1121. 44:30this and most of what we've already
  1122. 44:32reviewed is, you know, extension or
  1123. 44:35refinement of 373. And now we're getting
  1124. 44:38to the point of like what's beyond 373?
  1125. 44:41Well, that is this whole bus structure
  1126. 44:42and how we interact on this little
  1127. 44:45device with the external world. So,
  1128. 44:47we're setting you up for that by
  1129. 44:48learning how the bus system works and
  1130. 44:51how buses in general work, how data is
  1131. 44:54pushed around and what the goal and role
  1132. 44:56of the peripherals are. We'll set you up
  1133. 44:59for uh the next part of the class after
  1134. 45:02exam basically what's interrupts and
  1135. 45:04then how do we use all these
  1136. 45:06peripherals, right? Like what are the
  1137. 45:07core peripherals that are common to all
  1138. 45:09embedded systems? Uh and by that point
  1139. 45:11you should know like how to pass data
  1140. 45:14through these bus structures. Um
  1141. 45:18right so here this is just your loads or
  1142. 45:20stores are going to go into your GPO.
  1143. 45:22How is GPO organized? Uh there are
  1144. 45:26multiple registries of course but uh for
  1145. 45:29any one uh GPO slice which is actually a
  1146. 45:32nice term that Infinine uses. You have a
  1147. 45:36register that would represent the input
  1148. 45:38register that [snorts and clears throat]
  1149. 45:39represents the output and then a control
  1150. 45:41register. Now of course you have six or
  1151. 45:43seven other registers as well but just
  1152. 45:46conceptually what do you need to think
  1153. 45:47about? There is some input, some output
  1154. 45:49and then some methodology for switching
  1155. 45:51between them or changing your
  1156. 45:52functionality that is on a slice and
  1157. 45:55then you have this GPO pin here and
  1158. 45:58that's this pad uh would exist well
  1159. 46:01maybe it exists here but is on your
  1160. 46:03piece of silicon and that is what leads
  1161. 46:05to the outside world
  1162. 46:07and then we're just going to concatenate
  1163. 46:09those all together such that all of
  1164. 46:12these slices add up to a register and so
  1165. 46:16each one of these uh you know locations
  1166. 46:19here registers represent the state of uh
  1167. 46:22[snorts] multiple different pins on your
  1168. 46:24device. So you have inputs and outputs
  1169. 46:26and control registers.
  1170. 46:30Assume you guys have become experts in
  1171. 46:32labs but [clears throat] there's always
  1172. 46:34some conceptual difference between the
  1173. 46:36buttons you press in lab and like the
  1174. 46:38questions that we ask here or the way we
  1175. 46:40ask you to think about it in lecture. So
  1176. 46:43what questions is there any like this
  1177. 46:45architecture of registers and connecting
  1178. 46:48that to what's actually uh the go is
  1179. 46:51there any questions?
  1180. 46:52>> Yeah the GPIO mode register does it all
  1181. 46:57three.
  1182. 46:58>> Yeah.
  1183. 47:00So here I have four and so in this case
  1184. 47:02it's control. So we're just saying that
  1185. 47:04there's going to be a mapping. So say
  1186. 47:06the lowest bit of this thing corresponds
  1187. 47:09to this slice. The next bit is P 0 uh
  1188. 47:120.2 two, right? So there's some mapping
  1189. 47:15between those.
  1190. 47:17And so if we go to the data sheet here,
  1191. 47:21right? So we have the same idea here. So
  1192. 47:23this is the input register and we're
  1193. 47:25saying that uh it's 15 bits, right? Um
  1194. 47:29and there's individual bits. These are
  1195. 47:31all writes and those correspond to these
  1196. 47:33GPL pins here. So um guess I don't know
  1197. 47:37if we actually made it super specific.
  1198. 47:39No, no, we did represent the individual
  1199. 47:42input pins. So there's a mapping. It's
  1200. 47:43zero here goes to GPIO zero here. Okay.
  1201. 47:48And that's convenient rather than having
  1202. 47:50like one D flip-flop that I have to go
  1203. 47:53write one bit into this D flip-flop. I
  1204. 47:55can just take the whole thing as this
  1205. 47:56idea of a port and now I can update all
  1206. 47:59the pins on the port with this one
  1207. 48:00memory location or one reader right. Do
  1208. 48:04you have a question? But when you said
  1209. 48:07all the meant like depending on the
  1210. 48:11binary depending on the number right
  1211. 48:15[clears throat]
  1212. 48:23>> yeah yeah I mean the counter example
  1213. 48:26could if there's all ones and you put
  1214. 48:27zeros in there it's going to change it
  1215. 48:29right so if it's the output port uh yeah
  1216. 48:32I mean whatever bite you put in here
  1217. 48:34will update [snorts] all of these
  1218. 48:36>> [clears throat]
  1219. 48:36>> Right? It could just be the same thing,
  1220. 48:38but it will technically put another zero
  1221. 48:40in there if there's already zero and
  1222. 48:43you've updated it in a sense. Now, there
  1223. 48:46is a um on your particular devices in
  1224. 48:49lab, there is a register that allows you
  1225. 48:51to only update specific bits.
  1226. 48:55>> What's that?
  1227. 48:58>> Yeah. Yeah. Yeah. I think that's what
  1228. 48:59it's called.
  1229. 49:02That just helps you. So there is these
  1230. 49:03edge conditions where by updating you
  1231. 49:06can get little glitches or little pulses
  1232. 49:08on your pins. Even if you put a zero and
  1233. 49:10you replace it with an R0, sometimes
  1234. 49:11there's a glitch on some mic controller.
  1235. 49:13So that uh register helps avoid those
  1236. 49:15issues. But this is a that's a small
  1237. 49:17thing in the point of this lecture or
  1238. 49:19what we're trying to test for in the
  1239. 49:21exam.
  1240. 49:23Any other GPO related questions?
  1241. 49:28Okay. Where were we? All right. All
  1242. 49:30right. So, we're going to concatenate
  1243. 49:32all that stuff together. And the real
  1244. 49:34conceptual piece here, I wish I had
  1245. 49:36better diagrams.
  1246. 49:38I don't know. I've been teaching this
  1247. 49:40like for a number of years on uh I hope
  1248. 49:43I'm getting better at explaining how all
  1249. 49:44this stuff works, right? So, the big
  1250. 49:46thing is the processor has store thing.
  1251. 49:49It has a store instruction and then the
  1252. 49:51requester is connected to that. If the
  1253. 49:53requester has a little state machine
  1254. 49:55that's trying to figure out is the store
  1255. 49:57function is that address something that
  1256. 50:00the requester is responsible for you
  1257. 50:02know and so because there's certainly
  1258. 50:04going to be memory locations like SRAMM
  1259. 50:06where this requesttor is not it's not
  1260. 50:08part of the advanced peripheral bus he
  1261. 50:10doesn't care so then it's trying to
  1262. 50:12figure out okay if the store is going to
  1263. 50:14one of the memory addresses I'm
  1264. 50:16responsible for then it has to generate
  1265. 50:18bus traffic with the correct data
  1266. 50:21address clock and logic control bits to
  1267. 50:23send that data out in the bus. There's
  1268. 50:27not just one completer or one
  1269. 50:29peripheral. There's many of them. And
  1270. 50:31then they're all listening for [snorts]
  1271. 50:34the right control signals to respond.
  1272. 50:36And then when they respond, the task is
  1273. 50:39to go and put some data into these
  1274. 50:41memory locations or these registers
  1275. 50:43which will then connect to the GPL pins
  1276. 50:46and cause it something on the external
  1277. 50:48world to happen. Do I have animations
  1278. 50:50for that? There we go. So those CPO pins
  1279. 50:53there just represent those here which
  1280. 50:55update that and pass a pin high or low.
  1281. 50:58So here you're storing this the guy's
  1282. 51:00point over here. You put a one in the
  1283. 51:02lowest bit. You collect the correct uh
  1284. 51:05memory location and that will cause a
  1285. 51:07pin to go high. And so you should more
  1286. 51:08or less be able to trace that signal
  1287. 51:10through the whole path and be able to
  1288. 51:12figure out how is logically is P 01
  1289. 51:16going high.
  1290. 51:19Either
  1291. 51:24you guys are doing great or you're or
  1292. 51:27somebody needs to ask me a question.
  1293. 51:29[snorts]
  1294. 51:30I shouldn't have said it that way. I'm
  1295. 51:31sure there are valid questions because I
  1296. 51:33cannot be this good at teaching.
  1297. 51:40Oh, way up there. Fantastic. You have to
  1298. 51:42be super loud though.
  1299. 51:43>> Yeah.
  1300. 51:44um for right there's multiple registers
  1301. 51:48going in. So there's a lot of different
  1302. 51:50settings that have that different
  1303. 51:54registers.
  1304. 51:55>> Yep.
  1305. 51:57>> So sorry. So the question is this is
  1306. 51:59more of a statement that for each PPL
  1307. 52:02pin there are multiple registers,
  1308. 52:03multiple things to configure, right? Is
  1309. 52:05that
  1310. 52:07>> Yeah, absolutely. Right. Like it's
  1311. 52:10painful because you're like I just want
  1312. 52:11it to output a one. why can't I do that?
  1313. 52:14And you're like, I had to spend 20
  1314. 52:15minutes with this data sheet figuring
  1315. 52:16out that I had to like set the output
  1316. 52:18type for something. That that is just
  1317. 52:21the reality of embedded systems. But
  1318. 52:24once you get good and comfortable with
  1319. 52:26data sheet, you kind of understand what
  1320. 52:27it's trying to accomplish and you're
  1321. 52:28like, "Oh, reading through the the data
  1322. 52:30sheets and okay, I've got this control
  1323. 52:32method. I have input output." You'll
  1324. 52:35learn the patterns that most of the
  1325. 52:36companies use. Uh you should be pretty
  1326. 52:39quick at it by the end of the class.
  1327. 52:43Does each like
  1328. 52:47>> each port? Uh we'll say each peripheral
  1329. 52:51um
  1330. 52:56>> uh you have to look in your data sheet I
  1331. 52:58guess. So and then and Infinia nor STM
  1332. 53:04makes it explicitly clear what that
  1333. 53:06[clears throat] mountain is. They just
  1334. 53:08say here's a register and you put data
  1335. 53:10into it, it will do a thing. But you can
  1336. 53:12kind of conceptually see that they'll
  1337. 53:14talk about different uh maybe not this
  1338. 53:16device but for timers for instance
  1339. 53:19there's different types of timers.
  1340. 53:20You're like well why are they making a
  1341. 53:22difference between this set and this set
  1342. 53:23like oh they have slight different
  1343. 53:24functions that can actually different
  1344. 53:26peripherals or different modules on here
  1345. 53:29with different functions. Um does that
  1346. 53:31answer your question? So each peripheral
  1347. 53:34will have one set of
  1348. 53:37>> each. So say port zero will probably be
  1349. 53:41one per
  1350. 53:43uh it could be that port 0 and port one
  1351. 53:45are also in the peripheral. We don't
  1352. 53:47actually see the details of that but
  1353. 53:49it's more likely that port one and port
  1354. 53:51two are in different peripherals. And
  1355. 53:53then from like an IP block, I'm thinking
  1356. 53:55about like in production, you would have
  1357. 53:56your RTL code that represents what's
  1358. 53:58supposed to be and you're just
  1359. 53:59instantiating different modules that get
  1360. 54:01turned into hardware and then get sent
  1361. 54:03out as it should. So we don't really
  1362. 54:06know, but that's a good way to think
  1363. 54:07about it.
  1364. 54:11Okay.
  1365. 54:13Uh let's see what else we got here.
  1366. 54:17Um right. And then a lot of what we're
  1367. 54:19talking about is just the interaction
  1368. 54:21between the advanced peripheral uh
  1369. 54:24bridge and the peripherals. We are not
  1370. 54:27talking about the high performance bus
  1371. 54:29or the bus matrix. We'll talk a little
  1372. 54:31bit about that later but for now you can
  1373. 54:33just assume that this thing is connected
  1374. 54:34directly to the core. It's it'll make it
  1375. 54:36uh simple simpler to understand and you
  1376. 54:39you learn all the basics that you need
  1377. 54:40to understand. So that's the requester
  1378. 54:42and those are the completers. Uh we
  1379. 54:44talked about all the ah what happened
  1380. 54:46here? Okay, we talked about all the
  1381. 54:48different nets that are between them. So
  1382. 54:49you have P write, P address, and we
  1383. 54:52simplify this just to say that P address
  1384. 54:54is going to be the same as the address
  1385. 54:56memory. In reality, it's not going to
  1386. 54:58be, but conceptually, it makes things a
  1387. 55:00lot simpler. And it's also important to
  1388. 55:02think about what lines uh come out of
  1389. 55:05your completer. So you have P ready.
  1390. 55:07This is a control line, and then you
  1391. 55:09have a data line. And each device
  1392. 55:11according to the spec has its own each
  1393. 55:14peripheral or completer has its own data
  1394. 55:17path backwards uh to the bridge. So
  1395. 55:20there's no bus negotiation. Uh the AP
  1396. 55:24bridge or the requester sends the same
  1397. 55:26data sends the same address to
  1398. 55:29everything. Uh but then the control
  1399. 55:31lines tell which completer should
  1400. 55:33respond. Then when the completer is
  1401. 55:35ready, it can send uh put data back out
  1402. 55:38on his particular go. uh or as
  1403. 55:40particular bus line. Uh here's the
  1404. 55:44diagram I was expecting and here's just
  1405. 55:46showing when you have multiple here you
  1406. 55:48have multiple uh P data lines PR data
  1407. 55:51lines and then P ready lines. So each
  1408. 55:54one each peripheral or completer will
  1409. 55:56have its own set of buses back. Yeah.
  1410. 55:59There's no there was setting like a
  1411. 56:02regular
  1412. 56:09uh there's no inherent reason why it
  1413. 56:11couldn't but you don't it doesn't know
  1414. 56:13how long it's going to take and so how
  1415. 56:15the uh spec is written it just waits the
  1416. 56:19bus is not allowed to do something else.
  1417. 56:21uh the high performance bus gets around
  1418. 56:23that by having these uh pipeline
  1419. 56:25transactions and having different
  1420. 56:27channels but the peripheral bus generate
  1421. 56:30it does not inspect does not allow that.
  1422. 56:34[clears throat] Okay. And then we go
  1423. 56:36through the the the signals again. So we
  1424. 56:39have setup and access. So here we have
  1425. 56:42this is the address of the peripheral
  1426. 56:45and the peripheral address um yeah is is
  1427. 56:49sent to everything we have a bit that
  1428. 56:51defines read or write and remember I got
  1429. 56:54this question a couple times there's
  1430. 56:55nothing special about T0 or T1 really
  1431. 56:59you could just start the whole problem
  1432. 57:01could just start at T1 you don't even
  1433. 57:02need this space here there's nothing
  1434. 57:03special about it we're only really care
  1435. 57:05about the setup phase and then the
  1436. 57:07access phase setup phase is you're going
  1437. 57:08to instantiate these signals The
  1438. 57:11requester is going to instantiate these
  1439. 57:12signals and then it's going to tell uh
  1440. 57:15the completer hey those things are valid
  1441. 57:18by raising P enable I
  1442. 57:21[snorts] and P select is peripheral
  1443. 57:24specific uh there's one P select for
  1444. 57:26each peripheral I send data a data bus
  1445. 57:29has to be established and then this is
  1446. 57:31the P write data which is comes from the
  1447. 57:34peripheral and we just here this is
  1448. 57:36saying we don't know what it is or maybe
  1449. 57:38it doesn't matter and here we don't know
  1450. 57:39what it
  1451. 57:41We're just in this nomenclature we're
  1452. 57:42showing it's defined here
  1453. 57:45and then when P ready is only valid when
  1454. 57:49the device is enabled. So in this
  1455. 57:51particular nomenclature here they're
  1456. 57:52showing it does not matter what it is
  1457. 57:54but it does matter here and it just
  1458. 57:56happens to be that P ready the
  1459. 57:58peripheral can respond immediately. So P
  1460. 58:00ready is pulled high and then on the
  1461. 58:02next clock cycle the uh completer knows
  1462. 58:06that it can clock in the data or clock
  1463. 58:08out the data whichever is the
  1464. 58:09appropriate thing to do. Uh yep
  1465. 58:14questions yeah
  1466. 58:23>> no I don't care
  1467. 58:25um
  1468. 58:27like that [snorts] you're talking about
  1469. 58:28this little line.
  1470. 58:29>> Yeah. Yeah, it doesn't matter.
  1471. 58:32That's just we're just using what the
  1472. 58:34spec is. So you guys, if you read the
  1473. 58:36spec, it's not completely different.
  1474. 58:38[snorts]
  1475. 58:41Yeah.
  1476. 58:42>> Um for this example,
  1477. 58:45right data. Okay.
  1478. 58:49[snorts] I'm kind of confused
  1479. 58:52and you have right on what is P right?
  1480. 58:57[snorts]
  1481. 58:58do anything at once.
  1482. 59:02>> Uh so you're saying this is a write
  1483. 59:04function. This right is high, right? And
  1484. 59:06so the requesttor is pushing data in
  1485. 59:08there.
  1486. 59:09>> And you're saying like shouldn't P write
  1487. 59:11data? This doesn't even part of this
  1488. 59:14transaction. Why is it doing anything,
  1489. 59:15right? [snorts] P read data, PR data,
  1490. 59:18right? Yeah. So um it's could still be
  1491. 59:21valid that that thing changes. It's just
  1492. 59:24in this thing uh the requesttor will not
  1493. 59:27pay attention to it
  1494. 59:30like there's it's own bus so it could
  1495. 59:32you can imagine that what do you you
  1496. 59:34could just imagine that something is
  1497. 59:36happening it's not a requirement that is
  1498. 59:37data one
  1499. 59:39>> so you could
  1500. 59:41>> yeah you could have gr [snorts]
  1501. 59:53So P enable goes high but then P ready
  1502. 59:56does not go high.
  1503. 59:59P Ready is going to stay low. Do I have
  1504. 1:00:01a slide on that? No. Um so if P So who
  1505. 1:00:07decides if there's a weight phase?
  1506. 1:00:11>> Well, what does it the requester or the
  1507. 1:00:13completer?
  1508. 1:00:15>> It's the completer. The completer
  1509. 1:00:17decides if there's a wait phase. the
  1510. 1:00:19requester doesn't know if there's a
  1511. 1:00:22white face. Um, so the completer how it
  1512. 1:00:25indicates that I'm not ready to do the
  1513. 1:00:27pass and usually it's a slash interact
  1514. 1:00:29data is that it's going to hold load. So
  1515. 1:00:33we can assume on an exam for instance
  1516. 1:00:35[clears throat] or homework that if it's
  1517. 1:00:36just a deep flip-flop that's the only
  1518. 1:00:38thing you're waiting for, it's going to
  1519. 1:00:39be done in one cycle. But if there's a
  1520. 1:00:41special module that says, "Oh, it takes
  1521. 1:00:43a bunch of time. There's some hint that
  1522. 1:00:45goes high or something." Well, then
  1523. 1:00:46you're going to have to say, "Well, it's
  1524. 1:00:48not going to be ready immediately,
  1525. 1:00:50right?" So somehow P is going to have to
  1526. 1:00:52be held low until the circle is ready
  1527. 1:00:55and then it'll be raised.
  1528. 1:01:03Uh, okay.
  1529. 1:01:05And we'll go through this example again.
  1530. 1:01:06We got a couple minutes. Um
  1531. 1:01:10so here this is example was we have the
  1532. 1:01:12requester talking to two completers and
  1533. 1:01:14then we have different address spaces
  1534. 1:01:16right and then we're going to do this
  1535. 1:01:18task of we have uh some variables put
  1536. 1:01:22into registers uh in the core and then
  1537. 1:01:25we're going to store some values. So
  1538. 1:01:27what's going to happen from a the course
  1539. 1:01:29perspective is that it's going to point
  1540. 1:01:32to uh the value in R1 represents the
  1541. 1:01:35memory address and then it's going to
  1542. 1:01:37increment by four and store a value in
  1543. 1:01:40there. So in this case it's coffee.
  1544. 1:01:44But so that's the core's perspective.
  1545. 1:01:46What's really happening is the core is
  1546. 1:01:47going through all of here. And now we'll
  1547. 1:01:49look at the bridge interaction here. And
  1548. 1:01:51before I made it too confusing for you
  1549. 1:01:53guys. I made the question and I I was,
  1550. 1:01:55"Oh, look how smart professor sample is.
  1551. 1:01:57It's going to be really good. It's going
  1552. 1:01:58to they're all going to understand it."
  1553. 1:01:59And then I didn't appreciate the fact
  1554. 1:02:02that I didn't well this is supposed to
  1555. 1:02:06be from the perspective of each
  1556. 1:02:07individual peripheral. There are not two
  1557. 1:02:09buses, right? Um so here we can let's
  1558. 1:02:13redo that experiment. Okay, we'll redo
  1559. 1:02:15it just just looking at just the bus
  1560. 1:02:17signals, not what is input into the
  1561. 1:02:20individual peripherals. Let's look at
  1562. 1:02:21from just the bus signals. And so here
  1563. 1:02:24we have a clock going through and
  1564. 1:02:26there's an address. Well, what's the
  1565. 1:02:27address? Uh, come on builds. Uh, oh no,
  1566. 1:02:32you bad thing.
  1567. 1:02:35That's supposed to be four cuz we're
  1568. 1:02:38supposed to increment by four. Oh, bad
  1569. 1:02:40professor. Okay, so this is supposed to
  1570. 1:02:42be four.
  1571. 1:02:44Um, and then it's a write instruction.
  1572. 1:02:46So write goes high.
  1573. 1:02:49And then oh [snorts] and I think the
  1574. 1:02:50clock the clock cycle is right and then
  1575. 1:02:52P select. So P1 is selected. So because
  1576. 1:02:54we're in this address range here we're
  1577. 1:02:56not in this address range and this is
  1578. 1:02:58the this is what denotes right if you're
  1579. 1:03:01in a valid address range which um
  1580. 1:03:04peripheral gets selected and then after
  1581. 1:03:08here's the setup phase after data has
  1582. 1:03:10been all this data has been set up then
  1583. 1:03:13uh you're going to go to enable. Oh I
  1584. 1:03:15guess right should have come up here but
  1585. 1:03:17then we have coffee. So this is the
  1586. 1:03:18data. Now remember this is going to all
  1587. 1:03:20devices and we're going to denote here
  1588. 1:03:22that P select has its own path uh P
  1589. 1:03:25select for peripheral one P select for
  1590. 1:03:27peripheral 2. There's a different data
  1591. 1:03:28path back for peripheral one and
  1592. 1:03:30different peripheral 2 for P ready. And
  1593. 1:03:33then P ready responds that it is ready
  1594. 1:03:36to latch in that data. There's only
  1595. 1:03:37registers in there and P ready P select
  1596. 1:03:40is I don't it's don't care but in this
  1597. 1:03:42particular case we held it low. Okay. Is
  1598. 1:03:46this Yeah. No.
  1599. 1:03:48>> Does the um setup please have to start
  1600. 1:03:50at the beginning of the class?
  1601. 1:03:53>> The beginning of a what cycle?
  1602. 1:03:56>> Yeah.
  1603. 1:03:59[clears throat]
  1604. 1:04:00>> I don't know where else it would start.
  1605. 1:04:01Yeah. I mean the whole thing is is
  1606. 1:04:03written on a clock. So yes, it has to
  1607. 1:04:05start at a beginning of a clock cycle.
  1608. 1:04:07Doesn't matter which it was. And
  1609. 1:04:08[clears throat] the requesttor can have
  1610. 1:04:09take his time. It doesn't have to be at
  1611. 1:04:11any particular point in time.
  1612. 1:04:12>> Okay. It's like if I was drawing this
  1613. 1:04:14like if I like started up in the middle
  1614. 1:04:16of a clock,
  1615. 1:04:18>> oh, I don't care that much. Like, okay,
  1616. 1:04:20so what what has to be? So, you could
  1617. 1:04:22just be like, you are a lousy um uh
  1618. 1:04:25completer, right? And even though the
  1619. 1:04:27spec says to go high, you're just slow.
  1620. 1:04:28You got a lot of propagation delay. I
  1621. 1:04:30don't care as long as from the point of
  1622. 1:04:33view of this protocol that when P&
  1623. 1:04:34enable goes high that all those data
  1624. 1:04:37lines have been set up, right? Cuz if if
  1625. 1:04:40not, then you're breaking the spec. So I
  1626. 1:04:42don't care as you as a student exactly
  1627. 1:04:44get it just at the beginning. It could
  1628. 1:04:46be a little bit late. I'm not going to
  1629. 1:04:47be that latigious.
  1630. 1:04:50>> Yeah.
  1631. 1:04:50>> Um it says that B1 is from like some
  1632. 1:04:55address to 16 bytes,
  1633. 1:05:00right?
  1634. 1:05:00>> Yeah. So
  1635. 1:05:03like [clears throat]
  1636. 1:05:04you reason about how many there are
  1637. 1:05:10>> you should not reason about how many
  1638. 1:05:12there are you should accept that there
  1639. 1:05:15yeah you don't have to worry about
  1640. 1:05:17>> okay so if let's say
  1641. 1:05:22>> I mean you could envision that there
  1642. 1:05:24aren't that there right but remember us
  1643. 1:05:27uh assistance people we reserve things
  1644. 1:05:30We say that there's memory addresses,
  1645. 1:05:32but then there may not be no memory
  1646. 1:05:34addresses. So just because I gave you a
  1647. 1:05:37range doesn't mean well, okay, there's
  1648. 1:05:40probably four there, but you don't know
  1649. 1:05:41unless you look at the data sheet.
  1650. 1:05:44>> Um,
  1651. 1:05:45can you explain why?
  1652. 1:05:50>> The P enable goes high when you're
  1653. 1:05:52transitioning when the requester wants
  1654. 1:05:54to transition from the access ph or from
  1655. 1:05:57the setup phase to the access phase. And
  1656. 1:05:59so the all of the requesters signals
  1657. 1:06:03must be instantiated and stable. Then on
  1658. 1:06:06the next clock cycle enable can go high.
  1659. 1:06:09Now
  1660. 1:06:11I guess may have misspoken earlier. You
  1661. 1:06:13go into the access phase if there are no
  1662. 1:06:16weight stages available. So to go into
  1663. 1:06:18access phase both P ready has to be high
  1664. 1:06:20and P enable have to be high. It can
  1665. 1:06:22definitely be in a case where P enable
  1666. 1:06:25is high, Prem is not high and then
  1667. 1:06:27you're in a weight state.
  1668. 1:06:30>> Yep.
  1669. 1:06:31>> So we just care about if the address
  1670. 1:06:35value
  1671. 1:06:38>> for this example. Yes. Well, no. Uh for
  1672. 1:06:41this example, can I screw it up? I4.
  1673. 1:06:44[clears throat]
  1674. 1:06:44So it the goal was to uh get something
  1675. 1:06:49into you know zero 1004.
  1676. 1:06:53I screwed that up. But because that's in
  1677. 1:06:55that range then we know that P ready
  1678. 1:06:57will go high and respond right because
  1679. 1:07:00this circle will respond to that.
  1680. 1:07:03Yeah.
  1681. 1:07:04>> So for the
  1682. 1:07:07skip, why does it rise and fall in the
  1683. 1:07:11window? It does. Does it just fall
  1684. 1:07:15essentially? Yes. But would be valid
  1685. 1:07:18because you know this is just a
  1686. 1:07:19register. You don't know that.
  1687. 1:07:22We'll assume it's just register. We we
  1688. 1:07:24never talked about the hardware. And so
  1689. 1:07:26in this particular case, P ready was it
  1690. 1:07:29available immediate? So this is this
  1691. 1:07:32would be a valid thing. It could also
  1692. 1:07:33just be high the entire time. That would
  1693. 1:07:35also be valid. And it doesn't matter
  1694. 1:07:38what that signal is outside of when when
  1695. 1:07:41kable is low. It does not matter what
  1696. 1:07:44the signal is. It only matters when
  1697. 1:07:47enable is high.
  1698. 1:07:52[snorts]
  1699. 1:07:57[clears throat] All right. So that's all
  1700. 1:07:58the review slides I have. I mean, we can
  1701. 1:08:00go a little recap, but what other
  1702. 1:08:03questions do you have?
  1703. 1:08:05>> Any questions?
  1704. 1:08:11[snorts]
  1705. 1:08:11>> Yeah.
  1706. 1:08:18>> Sure. We do that. We have time for that.
  1707. 1:08:20What would I want to tell you here? My
  1708. 1:08:22last slide is this is what you got to
  1709. 1:08:23review and
  1710. 1:08:27oh, the starting off point. Yes, that's
  1711. 1:08:29fine. Uh, we already established that.
  1712. 1:08:31So, let's see. What do you want to look
  1713. 1:08:32at? How about
  1714. 1:08:35uh the ones I probably know?
  1715. 1:08:39>> You want this one? Okay.
  1716. 1:08:43Now, remember, I don't remember this.
  1717. 1:08:47Okay. So, what's your question? Just how
  1718. 1:08:49>> yeah I guess like how would you
  1719. 1:08:59start?
  1720. 1:09:02>> All right,
  1721. 1:09:04good question. [clears throat] So uh we
  1722. 1:09:07try to keep this little filler text
  1723. 1:09:08brief because we know it actually takes
  1724. 1:09:10time to read things. Uh but try to
  1725. 1:09:13extract the actual useful information
  1726. 1:09:15out of this. And here first is you got
  1727. 1:09:18to figure out like you're going to be
  1728. 1:09:19given some wiring diagram. What is this
  1729. 1:09:22thing trying to teach you, right? What
  1730. 1:09:24is it trying to do? It's trying to say I
  1731. 1:09:26have this push button thing and it's
  1732. 1:09:28connected at some locations and then I
  1733. 1:09:31have and then you're it's trying to tell
  1734. 1:09:32you hey look it's at GP0 it's at GP1.
  1735. 1:09:36This is where that interface is going to
  1736. 1:09:37happen and then we have some other
  1737. 1:09:39connection over here. Okay. Uh then I
  1738. 1:09:43don't know to furnace. Sure. Now there
  1739. 1:09:45you'll see some things like crystals and
  1740. 1:09:47resistors. Unless it's asking you about
  1741. 1:09:49that, you don't really have to know.
  1742. 1:09:52Then it says, okay, here uh you have a
  1743. 1:09:55display peripheral. Now this was not
  1744. 1:09:58going to be in your data sheet, right?
  1745. 1:09:59This is the part that you've been asked
  1746. 1:10:01to integrate into this uh diagram here.
  1747. 1:10:06And so it tells you how to interface it.
  1748. 1:10:08What is the logic that has to occur? And
  1749. 1:10:11what are you trying to do? You want to
  1750. 1:10:13give your core access to this
  1751. 1:10:16functionality. That's what the key is. I
  1752. 1:10:18saw a lot of people, not a lot of
  1753. 1:10:20people, but some people seem to be like
  1754. 1:10:22thinking like in the homework problem uh
  1755. 1:10:25that like the timer was already
  1756. 1:10:27connected to the core and like you
  1757. 1:10:29didn't have to even connect you have to
  1758. 1:10:31wire it up at all. And it's like no, no,
  1759. 1:10:32no. The core cannot talk to the timer
  1760. 1:10:35from the homework or to the LCD screen
  1761. 1:10:37uh sequencer unless you explicitly hook
  1762. 1:10:40it up to the advanced peripheral bus and
  1763. 1:10:42then you can talk to it through C right
  1764. 1:10:46because it will do loads and stores
  1765. 1:10:48which will store data into this
  1766. 1:10:50peripheral. So you are hooking this
  1767. 1:10:52thing up making it available as a
  1768. 1:10:55resource when you're writing your C
  1769. 1:10:57function.
  1770. 1:11:00Any what other questions you have or
  1771. 1:11:02anybody else have questions?
  1772. 1:11:08All right. [clears throat] So now you
  1773. 1:11:10have some functionality. Your goal is to
  1774. 1:11:11get this thing connected to your
  1775. 1:11:13microcontroller so that you can use this
  1776. 1:11:16resource cuz otherwise there's no this
  1777. 1:11:18thing diagram gives you no other
  1778. 1:11:20methodology for interacting with this
  1779. 1:11:22thing. It's true. You could well I don't
  1780. 1:11:25think gives you any other methodology
  1781. 1:11:26but um you could try like bit bang it or
  1782. 1:11:29something horrible but use use the
  1783. 1:11:31sequencer it's there to help you.
  1784. 1:11:33[snorts]
  1785. 1:11:35Um yeah and then the data sheet tells
  1786. 1:11:37you hey look you have these registers uh
  1787. 1:11:43do a certain function. So let me see if
  1788. 1:11:45I can pull up the data sheet.
  1789. 1:11:51No, that's the solution.
  1790. 1:11:56All right. So, what did we what was I my
  1791. 1:11:58point? What was I going to say?
  1792. 1:12:06So, do you need to write anything? Let's
  1793. 1:12:08look at the data sheet for
  1794. 1:12:11car. So, these are right and right,
  1795. 1:12:16right? You do not have to be able to
  1796. 1:12:18read anything. Why does this uh device
  1797. 1:12:22not have to be connected up? Why like
  1798. 1:12:24why aren't you connecting this up to P
  1799. 1:12:27uh R data?
  1800. 1:12:30The data sheet is telling you what the
  1801. 1:12:32hardware does,
  1802. 1:12:35right? This is you as the programmer
  1803. 1:12:37have this option. You as a programmer
  1804. 1:12:39cannot read
  1805. 1:12:41uh or now yeah cannot read anything out
  1806. 1:12:43of this character display out of this
  1807. 1:12:45peripheral. It is not possible because
  1808. 1:12:47the data sheet has not given you that
  1809. 1:12:49capability. Therefore, when you go over
  1810. 1:12:51here, you do not have to provide that
  1811. 1:12:54capability.
  1812. 1:12:55Right? The this is not in part of the
  1813. 1:12:57programming interface. So, why would you
  1814. 1:12:59implement hardware that's not part of
  1815. 1:13:00the programming interface? If you wanted
  1816. 1:13:02to, you could put it over there. Uh
  1817. 1:13:07I don't suppose we would take points
  1818. 1:13:08off. Maybe we would. I don't know. We
  1819. 1:13:09have to think about the problem.
  1820. 1:13:12>> Yeah.
  1821. 1:13:14And you can have like any kind of
  1822. 1:13:18>> what's that?
  1823. 1:13:18>> Like you can have dispos.
  1824. 1:13:20>> Oh yeah, do whatever you want.
  1825. 1:13:22>> Uh sometimes if it's like blank, you can
  1826. 1:13:24just write in what you want. If you want
  1827. 1:13:26to make up uh registers, that is your
  1828. 1:13:29prerogative. Um typically we put some
  1829. 1:13:32things down to help you um for a reason.
  1830. 1:13:36But if you guys want to go rogue and
  1831. 1:13:38make wild circuits, you can do it. At
  1832. 1:13:40some point we're just going to be like
  1833. 1:13:41this is too insane and take points off.
  1834. 1:13:43But as long as this is also like you can
  1835. 1:13:45just write on the top of this problem,
  1836. 1:13:47this is what I'm trying to accomplish,
  1837. 1:13:49right? That will help out a lot if
  1838. 1:13:50you're doing things that seem odd.
  1839. 1:13:57I recogn
  1840. 1:14:14right so like here P write data is
  1841. 1:14:16already 32 right [clears throat] so okay
  1842. 1:14:19we defined 32 and unless it changes we
  1843. 1:14:22don't know
  1844. 1:14:24[clears throat]
  1845. 1:14:26Okay, how else would I what else would I
  1846. 1:14:27do on this problem? All right, so then
  1847. 1:14:30we figured out we we've made this
  1848. 1:14:32resource now available to the core
  1849. 1:14:34through the advanced peripheral bus. It
  1850. 1:14:36can do these tasks.
  1851. 1:14:38Then what do we ask you to do? Oh, write
  1852. 1:14:40the keypad. Right. So now we're going to
  1853. 1:14:42write as what are we going to do? Write
  1854. 1:14:44an assembly function. Oh, they gave you
  1855. 1:14:47a bunch of stuff. So now the problem is
  1856. 1:14:49you have to figure out what insane
  1857. 1:14:51methodology did we use when we wrote
  1858. 1:14:54this uh C or assembly code. Like you
  1859. 1:14:56could have chosen a different way to do
  1860. 1:14:58the assembly and now you're like oh no
  1861. 1:15:00it doesn't match. But you go read
  1862. 1:15:02through here and kind of figure out what
  1863. 1:15:04the modality is for interfacing with
  1864. 1:15:07those assembly. And if we went to the
  1865. 1:15:10data sheet, like you know, I think one
  1866. 1:15:13of the the errors would be if you just
  1867. 1:15:15saw this thing, where is it? The keypad.
  1868. 1:15:18And you're like, "Oh, yeah, it's a
  1869. 1:15:19keypad. Cool. No worries." But you
  1870. 1:15:22didn't know how it worked and you didn't
  1871. 1:15:24realize that you actually had to send uh
  1872. 1:15:27a bit high to order to scan through the
  1873. 1:15:30rows. Now you're in trouble on the exam.
  1874. 1:15:33So if there's something you just don't
  1875. 1:15:35really understand, I would just take a
  1876. 1:15:37time to Google it a little bit. That's
  1877. 1:15:38why we're giving you the data sheet
  1878. 1:15:39beforehand so you can get your head
  1879. 1:15:41around what it is. And if it seems like,
  1880. 1:15:42oh my gosh, in our case, I would have to
  1881. 1:15:45learn how PDM works. You're like, that
  1882. 1:15:48might take me a couple hours to learn.
  1883. 1:15:50You probably probably off on the wrong
  1884. 1:15:51foot. That's the time to come and ask on
  1885. 1:15:54is that where we really have to know.
  1886. 1:15:56But in this particular case, we even put
  1887. 1:15:58like a little false ad symbol here. And
  1888. 1:16:00then the goal was for students can go in
  1889. 1:16:01here and like play with it and be like,
  1890. 1:16:03oh, okay, I can read out, you know, oh
  1891. 1:16:06wait, here I push this little button.
  1892. 1:16:07How does it work there? You know, the
  1893. 1:16:10goal was for people to have an intuitive
  1894. 1:16:11understanding of how this circuit should
  1895. 1:16:13have worked. I kind of used it wrong and
  1896. 1:16:16so there you go. So, understand enough
  1897. 1:16:18about how to use it. Uh, whatever
  1898. 1:16:20peripheral we're giving you.
  1899. 1:16:24All right. And we got a couple minutes
  1900. 1:16:26left. What else would I want to teach
  1901. 1:16:27you? Uh, so then you go through this.
  1902. 1:16:29It's a little macro.
  1903. 1:16:33Been asked to make a little couple C
  1904. 1:16:34functions. Typically, these are all
  1905. 1:16:36about knowing what address to do and
  1906. 1:16:38like how to interact from a data sheet
  1907. 1:16:40point of view with that peripheral.
  1908. 1:16:42[snorts]
  1909. 1:16:43And then you have to group it all
  1910. 1:16:44together. Oh, they made you write lots
  1911. 1:16:46of C that time. Okay.
  1912. 1:16:50What other questions do you have?
  1913. 1:16:53This is a great time cuz right now
  1914. 1:16:54you're at the end of the exam and you're
  1915. 1:16:56like, "Oh my god, I need to get points.
  1916. 1:16:58Need as many points as possible." So,
  1917. 1:17:00what do you do? You just write down,
  1918. 1:17:01"This is what I'm trying to do." And if
  1919. 1:17:03we're like, "Aha, they're doing the
  1920. 1:17:04right thing. They just didn't like at
  1921. 1:17:05least we can give you some points. Yeah.
  1922. 1:17:08[snorts]
  1923. 1:17:20are we always track
  1924. 1:17:23[clears throat]
  1925. 1:17:24[snorts]
  1926. 1:17:24>> sorry keep track of what
  1927. 1:17:26>> track of states like what happened like
  1928. 1:17:33>> the homework problem
  1929. 1:17:42>> okay that's a good question I don't
  1930. 1:17:44exactly remember that exam but I would
  1931. 1:17:46say, "Make a plan here." Like, "What do
  1932. 1:17:50you think you're going to have to do?"
  1933. 1:17:52Right? So, you should be able to
  1934. 1:17:53architect. You could guess what the code
  1935. 1:17:55is by looking at the design problem.
  1936. 1:17:58Just the little the little blurb here.
  1937. 1:18:00You can figure out what the code is
  1938. 1:18:02you're going to have to write in the
  1939. 1:18:04last part. And so, you could scan, it's
  1940. 1:18:06probably a good idea just to scan
  1941. 1:18:07through the design question, but you
  1942. 1:18:09could just push out like this is my
  1943. 1:18:11strategy and write it in the note of
  1944. 1:18:13like how I'm going to solve this
  1945. 1:18:14problem. And that might help you reason
  1946. 1:18:15through like uh you know what is it
  1947. 1:18:18you're trying to oh I'm going to have to
  1948. 1:18:19use this thing right use this peripheral
  1949. 1:18:21I made I'm going to have uh some I don't
  1950. 1:18:23know whatever this go oh because this is
  1951. 1:18:24using the other peripheral right and
  1952. 1:18:26like so hopefully early on you can
  1953. 1:18:28reason about if you have to keep track
  1954. 1:18:30of state
  1955. 1:18:34all right yeah
  1956. 1:18:38>> like
  1957. 1:18:42you can
  1958. 1:18:46No, we can provide extra scratch paper.
  1959. 1:18:49Does people want extra scratch paper?
  1960. 1:18:52>> Okay, we will add some extra pages to
  1961. 1:18:54the D sheet cuz the scratch paper, but
  1962. 1:18:57you can write all over the D sheet. We
  1963. 1:18:58don't want them back. I mean, we'll take
  1964. 1:18:59them back and recycle them, but um yeah,
  1965. 1:19:02you guys can write down them if you
  1966. 1:19:04want.
  1967. 1:19:05>> All right, any last questions? One last
  1968. 1:19:08question. Yes.
  1969. 1:19:14No, you don't need a cheat sheet. I give
  1970. 1:19:16you the data sheet as it's all the
  1971. 1:19:17cheating you need.
  1972. 1:19:20>> Okay. Thank you.
  1973. 1:19:45Thank you very much.
  1974. 1:19:51What are the like one for
  1975. 1:19:55one performer?
  1976. 1:19:58Okay. It's like one for like

About this transcript

This page contains the full transcript of EECS 373 - Fall 2026 - Lecture 7: “Midterm 1 Review" by Interactive Sensing and Computing Lab , generated from the public captions YouTube serves with the video. The transcript has 13,221 words across 1,976 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.