YouTube2Text

EECS 373 - Fall 2026 - Lecture 2: “Instruction Set Architecture (ISA)” — Transcript

by Interactive Sensing and Computing Lab · 10,981 words · 1,664 segments · language en · Watch on YouTube

Full transcript

  1. 0:00can begin.
  2. 0:02So, let's see. So, announcements,
  3. 0:05class websites,
  4. 0:07um, yeah, Piaza is the best place to ask
  5. 0:09questions, of course, Grade Scope. So,
  6. 0:12make sure you're all on Grade Scope and
  7. 0:14specifically in the correct lab section.
  8. 0:16I know some people move, some people
  9. 0:18move outside of whatever Wolverine
  10. 0:21access. Uh, talk with James about that.
  11. 0:23Um, but make sure you're in the correct
  12. 0:25lab section. Your due dates are based on
  13. 0:26that. And then uh we have no canvas
  14. 0:28because canvas is lame. Uh homework.
  15. 0:31Homework one was assigned last night. Um
  16. 0:34the first bit of it is a bunch of analog
  17. 0:36review. That is intended to be all the
  18. 0:38analog you actually have to understand
  19. 0:40in this course. There's almost nothing
  20. 0:42to calculate. There's a little bit of
  21. 0:44like how do you buy a or how would you
  22. 0:46calculate a resistor? We give you a
  23. 0:47tutorial. So if you finished that
  24. 0:50homework assignment, you feel
  25. 0:51comfortable with analog, you're great.
  26. 0:52That's that's most the rest of the
  27. 0:53class. Maybe a few other examples. If
  28. 0:55you're having trouble with it, come to
  29. 0:56office hours. Uh my office hours, we'll
  30. 0:58have uh because we have a holiday on
  31. 1:00Monday, I'll have extra office hours. Do
  32. 1:02I have it on here? Yeah. Uh Tuesday at
  33. 1:0711 if you want, but you can also go to
  34. 1:09open lab hours. They can answer those
  35. 1:10same questions there. Um yeah. And then
  36. 1:14you still guys still have lab this week
  37. 1:16and prelabs are normally due before the
  38. 1:18lab, but this week labs will be due,
  39. 1:21prelabs will be due in lab. Are there
  40. 1:23any logistics questions before we get
  41. 1:25started?
  42. 1:29Somebody's got a question. Can't be that
  43. 1:32clear.
  44. 1:36No questions. All right. Um, get
  45. 1:40started. I often want to talk about I
  46. 1:41give it like a component of the day,
  47. 1:43right? And so these are connectors. And
  48. 1:45the goal here is to make sure that
  49. 1:46everybody has a general idea of certain
  50. 1:48embedded systems topics. It's not really
  51. 1:50lecture material, but if you don't know
  52. 1:51it, you don't know what you don't know.
  53. 1:53And so, uh, connectors are super
  54. 1:55important. And almost anything that you
  55. 1:57want to connect, two boards together,
  56. 1:58two wires together, a wire to a board, a
  57. 2:01battery to something, somebody's already
  58. 2:02solved that problem for you. And if you
  59. 2:05know the right connector, you're golden.
  60. 2:07And connectors come in lots of different
  61. 2:09shapes and sizes for all sorts of
  62. 2:10different reasons. There's probably two
  63. 2:11aspects you should know about, and those
  64. 2:13are uh connectors that are keyed. And
  65. 2:16that's in the sense that they can only
  66. 2:17go in one direction. and connectors that
  67. 2:19are locking. They have a little latch
  68. 2:21and you can't pull them off. And why
  69. 2:22this is important? So, when I was at
  70. 2:24Disney, I was mentoring a PhD student at
  71. 2:27ETHZurk. We had a sister lab there and
  72. 2:29those uh PhD students were basically
  73. 2:32almost full-time employees at Disney and
  74. 2:34doing their PhD studies and I was
  75. 2:36mentoring this person and they got a
  76. 2:38reputation for lighting the lab on fire.
  77. 2:41Okay. And we had an executive from parks
  78. 2:43and resorts come and they were doing
  79. 2:45this really cool work on body channel
  80. 2:46communication. say a little embedded
  81. 2:48system here, embedded system on the
  82. 2:49floor and all these objects and it would
  83. 2:51send electromagnetic waves along the
  84. 2:53body. So when you touched objects or
  85. 2:54stood on objects, the that
  86. 2:56infrastructure would know and you could
  87. 2:57send messages back and forth, but it
  88. 2:59wasn't like radiating everywhere. So it
  89. 3:00was being able to control data basically
  90. 3:02by touch. And so as Disney people, we're
  91. 3:04like, "Oh, we can build some cool
  92. 3:06interactions that way." Well, the big
  93. 3:08executive comes doing the lab tour,
  94. 3:10right? This student's a little bit
  95. 3:12nervous. They plug in their stuff.
  96. 3:14Literally, the floor catches on fire.
  97. 3:16They had all these tiles, floor tiles
  98. 3:18that would light up when you talked with
  99. 3:19them or when you walked over them. Why?
  100. 3:22Well, they were a computer science
  101. 3:23person, right? They had never seen the
  102. 3:25idea of keyed and locking connectors.
  103. 3:26They were just using 0.1 headers, like
  104. 3:28the most basic thing you could have in
  105. 3:30the world, this sort of thing. And it's
  106. 3:32really easy to make a mistake. So, if
  107. 3:34you didn't know that there was keyed and
  108. 3:36locking headers, you you just would
  109. 3:38never know to use it. So, here you guys
  110. 3:39here you guys know, uh there are
  111. 3:41different types of headers. Figure out
  112. 3:43what they're used for. And when you're
  113. 3:44facing a problem in the lab, especially
  114. 3:46project time, come and ask James or one
  115. 3:48of the IAS if they have the specific
  116. 3:49type of headers rather than trying to
  117. 3:51roll roll your own. And if uh this is in
  118. 3:54your uh note or your slides, but if you
  119. 3:56want more information about all the
  120. 3:58variations on headers, there you go.
  121. 4:01Any questions about headers
  122. 4:04pins?
  123. 4:06Guys don't have many questions today.
  124. 4:08All right. So from last week, uh what
  125. 4:10did we talk? We talked about embedded
  126. 4:12systems where it's going a little bit of
  127. 4:13class overview and a high level
  128. 4:15architecture of um your devkit and how
  129. 4:20the ARM core that thing basically the
  130. 4:22core what you learned in 370 and how you
  131. 4:24would actually get data out to the GPIO
  132. 4:26pin. And so today we're going to talk
  133. 4:29about the ISA for ARM and that's really
  134. 4:31the instructions you know the assembly
  135. 4:33code the register structure and the
  136. 4:35memory and we're going to try and talk
  137. 4:36about how all these work together. Some
  138. 4:38of this is definitely a review from 370,
  139. 4:40but we're going to try and highlight the
  140. 4:42differences for this particular
  141. 4:44architecture. Like what are the nuances
  142. 4:45and the catches that you'll have that
  143. 4:47will trip you up if you don't know.
  144. 4:49Okay, but it is more or less conceptual
  145. 4:52review. All right, so a little
  146. 4:54background on ARM. Oh, sorry. We'll
  147. 4:57start out with a background on ARM
  148. 4:58instruction set architecture, some
  149. 5:00specific instructions, and then we'll go
  150. 5:02through uh an in-class problem. So ARM
  151. 5:05is a company and they they claim that
  152. 5:08you know what is this 250 billion
  153. 5:10devices have been shipped. That's pretty
  154. 5:12good market penetration, right? That's a
  155. 5:14lot of devices.
  156. 5:16But they are a fabulous
  157. 5:19semiconductor manufacturer. What is a
  158. 5:21fab? How can a fabulous semiconductor
  159. 5:23manufacturer ship 250 billion devices?
  160. 5:32physically themselves.
  161. 5:35>> Yep, that's exactly it. Why? But why why
  162. 5:38would they do that? Why why wouldn't
  163. 5:41somebody else this why would somebody
  164. 5:42else take that design? What would be the
  165. 5:44value?
  166. 5:46>> I mean,
  167. 5:52you don't just simplify design. You
  168. 5:54know, you don't want to redesign a core
  169. 5:57instruction set. Makes things easier. It
  170. 5:59makes it easier to implement. like
  171. 6:01connecting stuff.
  172. 6:02>> You're getting the right ideas. There's
  173. 6:04a slight twist, but you've got the right
  174. 6:06ideas. So, uh they do as a company, they
  175. 6:09make the instruction set architecture.
  176. 6:10They make intellectual property which
  177. 6:12other people buy, right? So, who buys
  178. 6:14that stuff and they license that to chip
  179. 6:16manufacturers. So, who buys it? So, STM,
  180. 6:18Infinion, which is used in the dev kit,
  181. 6:20you have NXP and Texas Instruments,
  182. 6:22those are all kind of like the
  183. 6:23microcontroller. Then big companies
  184. 6:25right the application side like Apple
  185. 6:27and Samsung they all make uh they use
  186. 6:30those ISAs and then modify it they they
  187. 6:32add something to it or they add
  188. 6:34something to the chip. So Apple clearly
  189. 6:36is modifying maybe the instruction set
  190. 6:38architecture a lot itself but the other
  191. 6:40companies are going and adding something
  192. 6:42extra and that's the peripherals. So
  193. 6:44when we looked at that black diagram,
  194. 6:46it's those all those extra pieces
  195. 6:47they're adding. And so now to
  196. 6:50differentiate Infinion in the
  197. 6:51marketplace from STM, STM's maybe a
  198. 6:53little bit more consumer electronics
  199. 6:55grade. Uh Infinion is a little bit more
  200. 6:57on the control architecture like
  201. 6:59robotics and and automobile. So the
  202. 7:01peripherals have to do a different job.
  203. 7:03Infinion adds their intellectual
  204. 7:05property there. Uh but they still get to
  205. 7:08use uh all this other stuff here. So
  206. 7:10back to this question, why would Texas
  207. 7:13Instruments and NXP want to use the same
  208. 7:16architecture as everybody else? What is
  209. 7:18their business advantage? Why are they
  210. 7:20doing this?
  211. 7:24>> Yeah,
  212. 7:25>> there are tool chains that already exist
  213. 7:27for architecture like GCC has their own
  214. 7:30AR and stuff like that, right? So it's
  215. 7:32easier to write software and use
  216. 7:34software that's already been written.
  217. 7:37>> Yeah. Any other good reasons?
  218. 7:41Yeah.
  219. 7:44>> Sorry.
  220. 7:48>> They don't have to cover the cost of
  221. 7:49making chips. Is that what you said?
  222. 7:51Well, they still they still on the hook,
  223. 7:53right? Uh so STM has to fabricate the
  224. 7:56chip, sell the chip, and then they just
  225. 7:58kick back money as licensing fee to ARM.
  226. 8:02So they take on all the risk.
  227. 8:05Why not have why not just spin your own
  228. 8:07architecture?
  229. 8:09What's the disadvantage in that?
  230. 8:18>> Yeah. So, making processor designs is
  231. 8:21hard and complicated and you could spend
  232. 8:23years, you know, making a chipset and
  233. 8:26then, oh, you found out all these little
  234. 8:27edge conditions. You forgot that now you
  235. 8:29have to recall devices. Like, it would
  236. 8:30take a long time to mature a chipset
  237. 8:33architecture to the point where it would
  238. 8:35match ARM. So if you're going to enter
  239. 8:36the market now, boy, it's a lot easier
  240. 8:38just to pay ARM and get something that's
  241. 8:40solid, right? Something that's really
  242. 8:42well battle tested. Plus, there's a
  243. 8:44hidden value. So that's like the that's
  244. 8:46like the first draft value of for a
  245. 8:48company is saying, well, I can buy this
  246. 8:50thing. Sure, it's costly, but I I don't
  247. 8:53have to roll my own. Also, you can go to
  248. 8:55the other companies and get those
  249. 8:56engineers. Those engineers already know
  250. 8:58ARM, right? So when they come, it makes
  251. 9:00that the workforce is a little bit more
  252. 9:01fluid. So maybe that's good for the
  253. 9:02worker. Maybe that's good for the
  254. 9:04company.
  255. 9:07Um so ARM generally makes three
  256. 9:10families. So there's the cortex a which
  257. 9:12is the application uh class family.
  258. 9:14Those are like the smartphones and smart
  259. 9:16watches and those sorts of things. You
  260. 9:18have the real time which is for um like
  261. 9:21high reliability systems where you need
  262. 9:23to have some guarantees of certain
  263. 9:25performance in a certain time. So like
  264. 9:26braking systems for instance have to
  265. 9:28work all the time and there's guarantees
  266. 9:29of when it has to work. It can't get
  267. 9:31stalled by some other process. And then
  268. 9:33there's the Cortex M family which we're
  269. 9:35studying here which is microcontroller
  270. 9:37class but this is general purpose uh
  271. 9:39embedded system devices. And then
  272. 9:42oftentimes you'll see this confusing
  273. 9:43diagram. It took me about you know
  274. 9:45teaching the class one or two times
  275. 9:46before I fully understood this diagram.
  276. 9:48But this is how ARM says this is our
  277. 9:50this is our product line. These are all
  278. 9:51our ISAs. Well what they're really
  279. 9:53saying here is they have chipset
  280. 9:55architectures on the top and then they
  281. 9:57have instruction sets on the bottom.
  282. 10:01And specifically we are going to learn
  283. 10:03the ARM V7M architecture
  284. 10:07and that is instantiated as embedded
  285. 10:11systems in Cortex M4, M3 and so on and
  286. 10:14specifically of the ISAs that are
  287. 10:17available. We're going to look at thumb
  288. 10:182.
  289. 10:20So what is an ISA? So this is an
  290. 10:22abstract model of the computer defines
  291. 10:25how the software is controlled by the
  292. 10:26CPU and this really is in this agreement
  293. 10:29between you as the programmer and the
  294. 10:31hardware engineers and saying like if I
  295. 10:33do this instruction the hardware will
  296. 10:35obey it. It will complete this task.
  297. 10:38Uh so the ISA defines instructions, data
  298. 10:41types, storage, you know memory regions,
  299. 10:44addressing scheme, data flow control and
  300. 10:47ARM has uh multiple ISAs as you saw
  301. 10:50before. The two biggest ones are 32bit.
  302. 10:53They call it thumb and arm. I'm not sure
  303. 10:55why it's actually thumb and arm. Maybe
  304. 10:57it's because ARM is bigger than thumb. I
  305. 10:59don't really know. Um, and then for
  306. 11:02reasons we'll discuss, they came up with
  307. 11:03a hybrid system which is oh, and thumb
  308. 11:06is supposed to be 16 bit. ARM is 32. And
  309. 11:09they came up with this hybrid system
  310. 11:10which is thumb 2 which has 16- bit and
  311. 11:1332-bit instructions. And that's uh what
  312. 11:16we'll be using in this class.
  313. 11:19And then the differences between the
  314. 11:21hardware architectures, how it's
  315. 11:22instantiated is we have like cortex m0
  316. 11:25which are these little tiny little
  317. 11:26microcontrollers uh M3s, M4s and those
  318. 11:30are all concatenations of different
  319. 11:31instruction sets. So the Cortex M0 only
  320. 11:35does a subset of what the Cortex M4
  321. 11:37does. And then the the Cortex M4F has a
  322. 11:40floatingoint module. So that adds on
  323. 11:42some extra functionality.
  324. 11:47Uh so the architecture defines how the
  325. 11:49instructions are to be processed on the
  326. 11:50hardware. Uh again for us we're doing uh
  327. 11:53ARMv7 and implementing the thumb
  328. 11:56instruction. Um now thumb two
  329. 11:59instruction set. Now if we consider like
  330. 12:01cortex m the application a processor
  331. 12:04also implements the uh uh ARM v7m
  332. 12:09instructions and so does the cortex m4.
  333. 12:12They both do the same thing. It's just
  334. 12:13that the hardware instantiation is
  335. 12:15different. So uh the uh A8 is a 13
  336. 12:19pipeline uh processor while the ARM uh
  337. 12:22Cortex M4s are usually three stage
  338. 12:24pipelines. So this is I want you to get
  339. 12:27your head around the difference between
  340. 12:28instruction sets and architecture and
  341. 12:30how um essentially there there is some
  342. 12:33fluidity between there and they're not
  343. 12:34100% there's not one instruction for one
  344. 12:36architecture. Yeah. And they both run
  345. 12:38ARM Cortex M2. Any high level questions
  346. 12:41so far?
  347. 12:45No questions today. Oh, good. Brave
  348. 12:47person. You have to be loud though.
  349. 12:49>> Is there like a specific reason?
  350. 12:57>> Um,
  351. 12:59so
  352. 13:00well you you take 370, right? You guys
  353. 13:03learned a five stage, right? And so that
  354. 13:05allows you to do like it's been like 10
  355. 13:07five years since I taught that class,
  356. 13:09but I think you guys learned about like
  357. 13:10pre-fetching and prediction and all
  358. 13:12those other things. So there's all these
  359. 13:14other optimizations you get with
  360. 13:16multiple stages, right? To get higher
  361. 13:18throughput and the that's really good
  362. 13:21for an application class processor
  363. 13:22because you want this performance and
  364. 13:24you're willing to give up a bunch of
  365. 13:25things. You're willing to give up power,
  366. 13:27right? Because now you have to support
  367. 13:29the architecture of 13 stages. the M4 or
  368. 13:33the Cortex M4, which only has three
  369. 13:35stages. They're like, "Well, we don't
  370. 13:36need to have a graphics card and all
  371. 13:38these other functionalities. So, we're
  372. 13:40going to reduce the capability, but
  373. 13:43we're going to gain simplicity. We're
  374. 13:44going to gain lower power." So, it's
  375. 13:46there's a hardware engineering trade-off
  376. 13:48that was made. It's a good question, but
  377. 13:52no, I don't actually actually know all
  378. 13:53the stages of the 13 p stage pipeline. I
  379. 13:56just know it has 13. Um, so one of my
  380. 14:00question might be like why are there 16
  381. 14:03bit and 32-bit? Why does thumb have a
  382. 14:05mix? And it's kind of helpful to think
  383. 14:07through some of the architectural
  384. 14:08changes that have happened. So here's
  385. 14:10this maybe a throwaway image, but this
  386. 14:13is shows the evolution of they had their
  387. 14:15proprietary stuff that was ARM one
  388. 14:17through three which I don't even know
  389. 14:18maybe this was 16 bit and then they
  390. 14:20started with 32 and 16 bit now they have
  391. 14:2264-bit architectures. So independent of
  392. 14:26microcontrollers, what was the big
  393. 14:28architectural shift? Why were we moving
  394. 14:30from 16 bits to 32-bits to 64-bits?
  395. 14:33Especially like I think it was like 2000
  396. 14:36early 2000s there was in the PC market,
  397. 14:39right? There was a big shift from 32bits
  398. 14:41to 64 bits. What? So my question to you
  399. 14:44and I'll have you discuss it. What was
  400. 14:46causing the shift? Why was the industry
  401. 14:48keep increasing the number of bits in
  402. 14:50their architecture? And then conversely
  403. 14:52um what was the impact on the on the PC
  404. 14:55or the microcontroller market and why
  405. 14:56would they want to go and have a hybrid
  406. 14:591632? What would be the advantage? So
  407. 15:01why don't you take 60 seconds try and
  408. 15:03figure out why the industry kept on
  409. 15:05increasing the bitwidth.
  410. 15:17Yes.
  411. 15:39This is
  412. 16:00What do we think? What was causing the
  413. 16:02shift for larger and larger bit sizes or
  414. 16:06bit
  415. 16:06>> widths?
  416. 16:17It's true. Say it slightly differently.
  417. 16:26>> That's true. Definitely true.
  418. 16:36>> Yeah. How about memory? You you had you
  419. 16:38had all the right ideas for the memory
  420. 16:40but maybe a little bit backwards.
  421. 16:44>> And then so they added all these
  422. 16:47instructions more information
  423. 16:49instruction
  424. 16:51like memory that is term.
  425. 16:55>> Okay,
  426. 16:56you're all circling the right answer,
  427. 16:58but I'll just say the memory part. um
  428. 17:00the size of your instruction dictates
  429. 17:03how much physical memory you can address
  430. 17:06without doing paging or some weird
  431. 17:08thing, right? So you'll see that with 32
  432. 17:11bits, you can only get to about four
  433. 17:12gigs of memory. That's it. And so the
  434. 17:15industry wanted they're like, "Oh, well,
  435. 17:17you know, we want to get to larger bits
  436. 17:19or memory sizes." The applications
  437. 17:21demand it. So they went to 64-bit
  438. 17:23architecture so they could were able to
  439. 17:25index larger physical memories. That was
  440. 17:28a big PC push. Okay.
  441. 17:31What has that meant for the um
  442. 17:33microcontroller market? Why why would
  443. 17:36the microcontroller market not just go
  444. 17:38to 64-bits too? Why what why are they
  445. 17:42trying to optimize for the 16 bit and
  446. 17:4432-bit architecture at the same time?
  447. 17:53>> 16 bits. So they just use that but they
  448. 17:56want allow indexing in larger memory
  449. 17:59regions in addition to operation of
  450. 18:03>> that's pretty good right so 32-bit gives
  451. 18:07you a lot of flexibility in what you can
  452. 18:10uh in memory reads and writes and what
  453. 18:12you can address and people said it
  454. 18:14before
  455. 18:16um
  456. 18:18uh with 32 bits you can cram more uh
  457. 18:20functionality in one instruction but you
  458. 18:23pay a penalty right your code size is
  459. 18:26larger
  460. 18:27So now they're trying to optimize
  461. 18:28because they know these are little
  462. 18:29constrained devices. They don't have
  463. 18:31gigabytes of memory or um really large
  464. 18:34hard drives, right? You might be in
  465. 18:36SRAMM or flash might be like 150 or 128k
  466. 18:41of flash or something. It might be
  467. 18:42small. So now you have to optimize for
  468. 18:44code size as well. So the 16- bit and
  469. 18:4632-bit hybrid gives you a flexibility of
  470. 18:48both.
  471. 18:51Okay, that's what these answers are. So
  472. 18:54we'll move on to the instruction set. So
  473. 18:56the reason I told you all that is so you
  474. 18:58have to understand why have they made
  475. 19:01the instruction and the architecture
  476. 19:03this way well if you understand that ARM
  477. 19:06is a fabulous chip company right and
  478. 19:09they sell architectures they can't
  479. 19:11specialize in architecture for every
  480. 19:13single manufacturer right imagine if
  481. 19:16they had to create special instructions
  482. 19:18so this these are the peripherals right
  483. 19:20this is what STM and Infinion they make
  484. 19:24their intellectual properties here So,
  485. 19:25Infinine's going to have a a different
  486. 19:27say USB peripheral or a better ADC than
  487. 19:30somebody else. Who knows? Now, ARM, who
  488. 19:33makes the core over here, they don't
  489. 19:35want to have to be responsible for
  490. 19:37keeping track of what every single
  491. 19:39vendor is doing. That would just be
  492. 19:40impossible. I have to make in a special
  493. 19:42instruction just so Infinion can talk to
  494. 19:45their ADC and then STM has to have a
  495. 19:47different instruction. That's insane,
  496. 19:49right? It's just too much to do. So the
  497. 19:51goal here is once you understand that
  498. 19:53they're selling architecture then you'll
  499. 19:55understand why we're going to use this
  500. 19:57load core load store structure and how
  501. 20:00uh that has impacted the architecture.
  502. 20:02So that's why I I kind of gave you that
  503. 20:04background.
  504. 20:06So here we're going to talk about the
  505. 20:07ISA. Um you know that there's these lots
  506. 20:10of these bus structures. There's all
  507. 20:12these different locations. We talked
  508. 20:14about uh flash and and SRAMM. And then
  509. 20:17uh inside the peripherals there's
  510. 20:19registers or basically memory
  511. 20:20stateholding devices that the core can
  512. 20:22talk to to configure the USB or send
  513. 20:25data over that. So there's all these
  514. 20:26different addresses. But from the core's
  515. 20:29point of view, everything is just
  516. 20:31unified. There's just one in uh memory
  517. 20:34space. It doesn't know the difference
  518. 20:36between um inherently it doesn't know
  519. 20:39the difference between say uh memory or
  520. 20:41SRAM and a and a peripheral. it just
  521. 20:44loads and stores and they abstract that
  522. 20:46to the IDE or the compiler to keep track
  523. 20:49of this vendor's specific um uh
  524. 20:53peripherals and making sure that uh the
  525. 20:56code that's executed would be uh or
  526. 20:58compiled would actually execute
  527. 20:59properly.
  528. 21:01So ARM goes through and it mandates a
  529. 21:03certain memory structure. So it says hey
  530. 21:05there's 40 there's four gigs of space
  531. 21:08okay and it says okay your code is going
  532. 21:10to take up half a gig your SRAM's going
  533. 21:12to take up a half a gig peripherals
  534. 21:14external memory external devices and
  535. 21:17then they have some system stuff right
  536. 21:19so they have the private uh so we saw
  537. 21:21those buses there's bus error handling
  538. 21:23uh infrastructure there and then some
  539. 21:25system infrastructure so ARM says this
  540. 21:27has to exist right
  541. 21:31uh it's all unified uh memory structure
  542. 21:34from ARM point of view.
  543. 21:37Uh, yep. And so the other part that's
  544. 21:39nice is there's lots of interoperability
  545. 21:41here. So if you always know that
  546. 21:44peripherals are on this area, then um or
  547. 21:47or code is in these specific spots, then
  548. 21:50when um you know ARMs, you're going to
  549. 21:52implement say your uh your instruction
  550. 21:55fetch versus your data fetch, you can
  551. 21:57optimize that hardware for those
  552. 22:00regions. uh rather than having to say
  553. 22:02okay well this vendor put code up there
  554. 22:04right so it makes their system
  555. 22:05interoperable with all these other
  556. 22:07vendors there see questions or this
  557. 22:09yawning stretching okay
  558. 22:14so this is your particular device
  559. 22:17um unfortunately uh one of the things
  560. 22:20this is actually uh uh Infinion's memory
  561. 22:24map description it's not very complete
  562. 22:26there's lots of missing information this
  563. 22:28is almost what ARM gave you so you have
  564. 22:30to kind of dig into the tables to see
  565. 22:31some more information. So, uh, for
  566. 22:33example, ARM says that there's a half a
  567. 22:35gig for SRAMM, but the STM, this
  568. 22:38particular variant that you're using
  569. 22:40only has, uh, 352K. So, you have to kind
  570. 22:42of dig into the documentation here, and
  571. 22:44you start seeing this, right? You start
  572. 22:46saying, oh, here's my SRAMM space, and
  573. 22:48they've said they have their PS RAM and
  574. 22:50two DS RAMs, and they've assigned memory
  575. 22:53locations for these things, and
  576. 22:55everything else is reserved. What does
  577. 22:56reserved mean? Anybody know?
  578. 23:00Take a guess.
  579. 23:04Reserve does not mean it's for somebody
  580. 23:07else. Reserve doesn't mean that it's
  581. 23:09there. Reserve means it is not there.
  582. 23:11They have not implemented the memory.
  583. 23:13Right? Because memory equates to chip
  584. 23:16size. Chip size is cost. So they're not
  585. 23:18going to go and allocate four gigs on
  586. 23:20your device but only allow you to have
  587. 23:22access to 352K.
  588. 23:25That doesn't make any sense. So what
  589. 23:26they do is say okay I'm going to put the
  590. 23:28memory at these locations ARM told me to
  591. 23:30do that I'm going to do it dutifully but
  592. 23:31I don't have to implement all of it and
  593. 23:33that's where you see reserve reserve
  594. 23:35means there is no structure there you
  595. 23:38compiler will not let you actually load
  596. 23:41data in and out of it does not exist yes
  597. 23:45>> you got to be loud because I'm oldicular
  598. 23:48method
  599. 23:53>> so it's all in the documentation this
  600. 23:55particular table is not great, but you
  601. 23:57would start reading through your
  602. 23:58documentation and it's much more of a
  603. 23:59positive case where it says this uh
  604. 24:02peripheral lives at this address space.
  605. 24:04It doesn't actually tell you where
  606. 24:05there's nothing, but it tells you where
  607. 24:07things are. So for you can just assume
  608. 24:09that unless it's already stated there is
  609. 24:11no state memory device at those
  610. 24:13locations.
  611. 24:15>> Yeah.
  612. 24:16>> If there's no like if there's nothing
  613. 24:18like implemented on memory, then what's
  614. 24:20the purpose of
  615. 24:22>> ah why why even do this? And so that
  616. 24:25goes back to this interoperability
  617. 24:27problem, right? So, uh, ARM has stated
  618. 24:33that your code and your SRAM must go in
  619. 24:35these locations. Okay? Uh, but they
  620. 24:39never said that it has to be a certain
  621. 24:40size. So, if STM even even Infinion will
  622. 24:45have different devices will have
  623. 24:47different amounts of RAM, right? But ARM
  624. 24:50doesn't know what they've implemented.
  625. 24:52So rather than say you could take this
  626. 24:53whole table and collapse it down and
  627. 24:55remove all the the um uh reserve point
  628. 24:59so it's only used memory but then all
  629. 25:02the addresses would be different for
  630. 25:04each chip and now all the infrastructure
  631. 25:07that the ISA is giving you such as like
  632. 25:10the instruction path and the data path
  633. 25:11and all these other things would be
  634. 25:13would change breaking this
  635. 25:15interoperability of the ARM
  636. 25:16architecture.
  637. 25:18What happens when you try to access
  638. 25:20those?
  639. 25:22>> Uh so you will get uh it will be
  640. 25:24undefined.
  641. 25:26A good uh microcontroller would probably
  642. 25:29at least give you all zeros or some
  643. 25:31known pattern and your uh IDE or your
  644. 25:35compiler should throw an error and say
  645. 25:36you should never get there. But this
  646. 25:37would be out of bounds would be a common
  647. 25:39error.
  648. 25:40>> Are there protection
  649. 25:42for that or is it freak out?
  650. 25:44>> It's going to probably freak out.
  651. 25:45There's there are not great protections.
  652. 25:48Let's say that.
  653. 25:50>> Y
  654. 25:55>> what's sorry SRAMM where where
  655. 26:04>> I don't know. We have to go look it up
  656. 26:05in the data sheet. Don't know. You guys
  657. 26:08are going to You guys are going to know
  658. 26:10more about the data sheet. So you just
  659. 26:11switch this thing. You'll probably have
  660. 26:12more eyeballs on the data sheet this
  661. 26:14semester than I will. So you guys can
  662. 26:16tell me afterwards. Um,
  663. 26:18but I if I had to remember, I don't
  664. 26:21know. Uh, I have no idea. I have no idea
  665. 26:23what it's for. I have to We really
  666. 26:24should go look it up. Any other
  667. 26:26questions? Yeah.
  668. 26:31>> There's no memory. Is that always logic
  669. 26:33behind me?
  670. 26:36>> There's is there logic behind what
  671. 26:38>> which of me or is it random or how do
  672. 26:40they choose?
  673. 26:41>> Uh, the vendor chooses. They choose
  674. 26:44where they want to put memory. Now, it's
  675. 26:46best if you have you kind of play an ARM
  676. 26:48schema, right? So, ARM says that code
  677. 26:51space should start at 0000, right? They
  678. 26:55say the SRAMM should start at 2000. So,
  679. 26:57it's unlikely they're going to start at
  680. 26:592000 something, right? They're always
  681. 27:01going to start at the base probably and
  682. 27:02move their way up.
  683. 27:05But, it's really the vendor that has to
  684. 27:06keep track of where they've put things.
  685. 27:15Uh yeah, and then you can go add this up
  686. 27:17and actually see that it does add up to
  687. 27:19the stated memory on the device. That's
  688. 27:22all it that's all the SRAMM there is.
  689. 27:26Okay.
  690. 27:28So again, ARM is going to treat this as
  691. 27:30a unified memory from the chorus point
  692. 27:32of view when you're writing assembly or
  693. 27:34even C. There's no inherent
  694. 27:38reason why you would know that one uh
  695. 27:40memory location has the functionality of
  696. 27:42storing bits while another memory
  697. 27:44location has the functionality of uh
  698. 27:47enabling your your USB controller,
  699. 27:49right? That's put on you to remember or
  700. 27:52uh your compiler and your IDE to
  701. 27:54remember that these other
  702. 27:55functionalities are there. That would be
  703. 27:57different than like say something like
  704. 27:59portmapped IO uh which you would think
  705. 28:02about with like an x86 architecture
  706. 28:04where it's like the north bridge and
  707. 28:05south brid bridge. Those um ports aren't
  708. 28:09general purpose. They're specifically
  709. 28:11optimized for memory or video and they
  710. 28:14have in individual instructions to
  711. 28:16optimize just for those things. So
  712. 28:18rather than having instructions just for
  713. 28:21USB or your ADC or your GPIO's, we're
  714. 28:24going to use a general purpose
  715. 28:25instruction that you have to as the
  716. 28:27programmer keep track of functionality.
  717. 28:32Okay. Uh so we can talk about the the
  718. 28:35organization of memory. So memory each
  719. 28:38memory location has a 32-bit address and
  720. 28:40each address uh holds a bite of
  721. 28:43information. So it's one way to
  722. 28:45visualize it. Here we have addresses and
  723. 28:47you have data in bytes.
  724. 28:50However, this is a 32-bit architecture
  725. 28:52and almost all the way we think about
  726. 28:54and use it is at the 32-bit uh level.
  727. 28:57Like we're going to store a 32-bit word,
  728. 28:58we're going to load a 32-bit word. So
  729. 29:01when I think about this, I think
  730. 29:03everything is 32-bit wides with a um
  731. 29:06memory that increments by four. So this
  732. 29:08is generally my mental model. We have
  733. 29:11addresses that increment by four. it
  734. 29:13just happens to be that you also have
  735. 29:16this extra functionality
  736. 29:18that you can um go in between right and
  737. 29:22just do bte reads and bite stores out of
  738. 29:24that memory. So this is this is maybe
  739. 29:27the most strictest interpretation of
  740. 29:29what uh the memory is allocated but this
  741. 29:32is probably how you should think about
  742. 29:33it with just having the ability to read
  743. 29:35out bytes and store bytes rather than
  744. 29:38just going after entire words.
  745. 29:42This does require you to know your
  746. 29:44endingness or endingness. Um and so it's
  747. 29:48good just to review the difference
  748. 29:49between little Indian and big Indian. So
  749. 29:52little little Indian is increasing
  750. 29:53numerical significance with increasing
  751. 29:55memory address. Um big Indian is the
  752. 29:58opposite. Thumb two architecture in ISA
  753. 30:01allows you to flip that on the fly.
  754. 30:03There's literally a flag you could flip
  755. 30:06to change to go to read data in big
  756. 30:08Indian or little Indian. And that is
  757. 30:10mostly about legacy code, right? So you
  758. 30:12have these other these C files, ancient
  759. 30:14C files, a part of GCC that were uh
  760. 30:18compiled for some reason and now you
  761. 30:20need to read those in. You don't want to
  762. 30:21reformat them. Uh then you can just go
  763. 30:23and flip the bit and have them read in
  764. 30:25big Indian if you wanted to. Uh for the
  765. 30:28purposes of 373, we're just going to
  766. 30:29assume everything's little Indian unless
  767. 30:30we tell you otherwise. This makes life a
  768. 30:32little bit easier.
  769. 30:35Any questions?
  770. 30:41You sure this is not confusing? This
  771. 30:43feels confusing.
  772. 30:47He This guy is so brave. I love it.
  773. 30:51>> Does memory exist?
  774. 30:53>> Nope.
  775. 30:56That's a good question.
  776. 30:58Okay.
  777. 31:02All right. Uh so that's your memory
  778. 31:04architecture. So there's uh and then
  779. 31:06we'll talk about your processor itself.
  780. 31:08that has registers 32-bit wide.
  781. 31:11Uh there's uh 16 of them. Uh we have
  782. 31:14their lower register, high registers.
  783. 31:15These are general purpose registers. We
  784. 31:17will talk about like R12 and R9 have
  785. 31:19special features when you talk about uh
  786. 31:21interrupts and some um uh other
  787. 31:25specialty edge cases, but we don't have
  788. 31:27to worry about that right now. You got a
  789. 31:28stack pointer, a link register, and a
  790. 31:31PC. There are two versions of your
  791. 31:33program uh or your um your sack pointer.
  792. 31:38They don't really come up in how we
  793. 31:40teach this class. You just might find
  794. 31:42that your compiler is doing weird things
  795. 31:44if you had to really dig into the code.
  796. 31:46At that point, just ask or read online
  797. 31:47what the difference is. It's basically
  798. 31:49the state of your um uh program whether
  799. 31:53it's the main stack pointer or the
  800. 31:54process stack pointer. Uh there's other
  801. 31:56registers like your um uh special
  802. 32:00purpose registers like the um I can't
  803. 32:02think of it. Oh, the program status
  804. 32:04register. Uh we don't really like the
  805. 32:06the prime the fault mask control mask
  806. 32:09and the base priority. We don't really
  807. 32:12worry about them right now, but there's
  808. 32:13a 32-bit um program status register that
  809. 32:16we'll have to keep track of. So those
  810. 32:18are the the main elements of your core.
  811. 32:22And then uh kind of an old diagram but
  812. 32:25you know as you start thinking about uh
  813. 32:27memory right you're gonna you have
  814. 32:29different memory locations and then it's
  815. 32:31good to think about how your code maps
  816. 32:32onto that. So in this world the stack is
  817. 32:35always at the top and grows down. The
  818. 32:37heap is at the bottom and grows up and
  819. 32:39heap is really only when you're doing
  820. 32:41like malo or calic for dynamic memory
  821. 32:43allocation. So here you could imagine
  822. 32:45those first two are dynamically
  823. 32:47generated and they grow up. um you have
  824. 32:51uh some things that go into the stack
  825. 32:54and then uh your code is usually in
  826. 32:56flash. Now the reality is it's not
  827. 32:59always flash. Often times what happens
  828. 33:00on boot is they take the code out of
  829. 33:02flash and put it into SRAM so you have
  830. 33:05faster uh uh code execution. Flash is
  831. 33:08permanent, right? It doesn't um doesn't
  832. 33:11lose state when you turn it off and turn
  833. 33:13it back on. Uh but it's pretty slow. So
  834. 33:15often times what happens is you're just
  835. 33:17not aware of it when you go to program
  836. 33:19your device for the first time. It will
  837. 33:21boot up and it will take all the
  838. 33:24instructions out of flash and put them
  839. 33:25into SRAMM and that's where it'll load
  840. 33:27out of but for the purpose of this slide
  841. 33:29your code lives in flash. Um yeah and
  842. 33:32then some you know some things might
  843. 33:33just be defined by the uh compiler and
  844. 33:36just instantiated in the registers.
  845. 33:41Um yeah, so we got registers uh we have
  846. 33:45uh locations for data right at the top
  847. 33:48which is this one big unified structure
  848. 33:50and then certain addresses have
  849. 33:51instructions in them. Okay.
  850. 33:59And so we'll talk about some
  851. 34:00instructions. So a little review 370 as
  852. 34:02you imagine uh there is an entire ARM 7
  853. 34:06architecture and you can go read up like
  854. 34:08for a move or a move s there is a
  855. 34:10certain instruction encoding. So this is
  856. 34:12an 16- bit example and you can go
  857. 34:15through and figure out how to do the
  858. 34:16encoding. So first you have these
  859. 34:18operands up front right those are
  860. 34:20defined by that indicates what the
  861. 34:22instruction is. you have a destination
  862. 34:25register. In this case, we're just going
  863. 34:27to say it's u zero. And then we're going
  864. 34:30to put some data into it, right? And
  865. 34:32here we have an immediate. So we're able
  866. 34:34to move an immediate into that register
  867. 34:36and we've decoded 10 into binary. So now
  868. 34:38you would take that and you put that in
  869. 34:40your code space in memory. And likewise,
  870. 34:43you can do the same thing for R1 or move
  871. 34:46s R1 u immediate zero. So here we have
  872. 34:49the same uh operand up in front and then
  873. 34:52the register is one and the data is
  874. 34:54zero. We're going to pack that into
  875. 34:55memory as well. And so ARM is nice in
  876. 34:58the sense that it allows you it's not
  877. 35:00just it it will pack the instructions as
  878. 35:02tight as possible. Yes.
  879. 35:06>> Not always zero.
  880. 35:07>> Register zero not always zero. What does
  881. 35:09that mean?
  882. 35:11>> Z.
  883. 35:12>> Oh
  884. 35:13your immediate. No, in some register.
  885. 35:23>> Yes.
  886. 35:25>> The the register name never changes. Are
  887. 35:28you saying it changes?
  888. 35:32>> Oh, no. No, it's not a constant. It's
  889. 35:34not a source of a constant. Um register,
  890. 35:37those are all dynamically changeable.
  891. 35:38All 16 of them. Um the last three are
  892. 35:41reserved for special purpose but there's
  893. 35:43no like source of a zero if that makes
  894. 35:45sense. Um the the primary way we get
  895. 35:48constants is is e is using moves. Use a
  896. 35:51move to move that thing in. So through
  897. 35:52an instruction
  898. 35:57uh what else? Yes. Okay. And then uh so
  899. 36:01you have your your program counter,
  900. 36:02right? So you're going through and
  901. 36:04you're going to go through your program
  902. 36:06space and your PC is going to point at
  903. 36:08something, right? It's got some address
  904. 36:09it's pointing at. It's going to pull
  905. 36:11that instruction out. We're always going
  906. 36:13to fetch uh instructions out of memory
  907. 36:16as 32-bit operations. So here we're
  908. 36:18going to pull out that 32-bit operate
  909. 36:20that 32-bit instruction. And if you're
  910. 36:22if it happens to be a 32-bit
  911. 36:24instruction, that's fine. You're just
  912. 36:25going to go through your pipeline as
  913. 36:26normal, right? Fetch, instruction,
  914. 36:27decode, and instruction execution. Fine.
  915. 36:30But if it happens to be two 16-bit
  916. 36:32instructions is it'll break it up. build
  917. 36:34say okay we'll do the first one and
  918. 36:36we're just going to save the second one
  919. 36:37and then start doing the execution there
  920. 36:39right so my question to you is uh when
  921. 36:42the core is fetching how does it know if
  922. 36:45it's fetching a 16 bit or 32-bit
  923. 36:47instruction so why don't you take 30
  924. 36:49seconds talks with your neighbor come up
  925. 36:50with some strategies
  926. 36:59I'm here.
  927. 37:31All right. How do we know? What would be
  928. 37:32a way for the core to know if it's 16
  929. 37:35bit or 32bit?
  930. 37:37>> Yeah.
  931. 37:41>> Yeah.
  932. 37:44>> Zes.
  933. 37:51instructions.
  934. 37:54>> Yep, that's a great way of doing it. So,
  935. 37:56here we have special codes, right, that
  936. 37:58only indicate whether this is a 32-bit
  937. 38:00or 16- bit instruction. So, what it
  938. 38:02does, it pulls it out, it looks at the
  939. 38:04first, it pulls out the 32-bit uh word
  940. 38:06out of memory, looks at the first five
  941. 38:09characters, decides if it's 16- bit or
  942. 38:1132-bit instruction, and then does the
  943. 38:13appropriate thing. So, the encoding
  944. 38:14space defines what it what it is.
  945. 38:18And then for you if you want to look
  946. 38:19through some of some more of the details
  947. 38:21they're here. All right. So let's think
  948. 38:24through a little bit how instructions
  949. 38:26impact uh registers. So uh you guys can
  950. 38:30tell me. So we have two different
  951. 38:31encodings. We have T1 and T2. You will
  952. 38:34look through if you look through the ISA
  953. 38:36there might be like for AD I think
  954. 38:38there's like 20 different versions or
  955. 38:40encoding just for AD, right? They're
  956. 38:42optimizing uh for something. So they
  957. 38:44have different uh codes or different
  958. 38:47encodings. And so here's a 16 bit and a
  959. 38:4932-bit encoding. So for instruction move
  960. 38:53s uh which is just a move and then
  961. 38:56you're going to set a status register
  962. 38:57flags R3 uh 15 which is put in immediate
  963. 39:01into R 15 into R3. Which encoding would
  964. 39:03you use?
  965. 39:13Can you talk to your friends? Yes. All
  966. 39:15right. Talk to your friends. Figure out
  967. 39:17what encoding you would use.
  968. 39:23[clears throat]
  969. 39:38>> All right. I heard reasoning. Somebody
  970. 39:40hazard a guess. Which one?
  971. 39:45First one. T1. Okay. You could use T2,
  972. 39:49but it would just be a waste of space.
  973. 39:51Right now, you're using up more program
  974. 39:52space. How about this? Uh, yep. T1. How
  975. 39:56about this? Which one would you use?
  976. 40:05>> Two. I saw two, right? Because 15 cannot
  977. 40:08be put into uh Oh, no. It's nine, right?
  978. 40:12R9 is not addressable. is not reachable
  979. 40:16uh from the uh destination register
  980. 40:18there. It would need four bits for that.
  981. 40:21All right. And then we can do this one,
  982. 40:24right? So move s uh 416 in decimal into
  983. 40:30R3 and we can just give away the hint.
  984. 40:32You can go look at the bit encoding and
  985. 40:34see that in fact that would have to be
  986. 40:37uh T2, right? because you cannot fit
  987. 40:40that value into
  988. 40:42uh that uh an 8bit immediate and they
  989. 40:45break up the immediates here. So you'll
  990. 40:47see there's an I here, there's a IM3
  991. 40:50here, and there's a IM8 here. And it
  992. 40:52shows you that the thumb expanded I am
  993. 40:56C. That shows you how these things are
  994. 40:58concatenated together. So they've spread
  995. 41:01the immediate across multiple bits in
  996. 41:03there.
  997. 41:04>> Yeah.
  998. 41:07>> What's that? advantage splitting the
  999. 41:11>> I I'm sure the fine engineers at ARM
  1000. 41:13know exactly what advantage that is. Um
  1001. 41:16I don't know. I I'm going to guess that
  1002. 41:19they they have some ones here reserved.
  1003. 41:21I'm going to guess that they need to
  1004. 41:23have some ones there so that they can
  1005. 41:24differentiate between maybe a 16 and
  1006. 41:2632-bit architecture. I'm not exactly
  1007. 41:28sure, but there's clearly some
  1008. 41:30advantage.
  1009. 41:34All right. So why does the ISA
  1010. 41:37distinguish between high and low
  1011. 41:38registers?
  1012. 41:40Why is it making a differentiation
  1013. 41:42between these? What? Yeah.
  1014. 41:52>> Yep. So it does you could make up a M.
  1015. 41:56So the argument here is that uh the most
  1016. 41:58common instructions uh you would like to
  1017. 42:01be small, right? So if you're going to
  1018. 42:03do a lot of operations, the lower
  1019. 42:05registers and we'll see later on that
  1020. 42:07the lower registers are used for uh
  1021. 42:09function calls and all sorts of things.
  1022. 42:11If if you're going to call them a lot,
  1023. 42:13you rather have those be small
  1024. 42:14instructions. There's nothing keeping
  1025. 42:15you from saying making a separate set of
  1026. 42:17instructions that happen to only be able
  1027. 42:19to get up to the highest registers in
  1028. 42:21some weird fashion, but there's just
  1029. 42:22less advantage of it. So the general
  1030. 42:25thing is uh 32-bit instructions can get
  1031. 42:27to almost all registers but 16- bit
  1032. 42:29instructions can almost always get to
  1033. 42:31the only get to the lower instructions.
  1034. 42:35Okay.
  1035. 42:37All right. So we'll go through some
  1036. 42:39instruction encodings or some
  1037. 42:40instruction types and we're going to
  1038. 42:42plast through this because you took 370
  1039. 42:44but this is more just to remind you
  1040. 42:45these things exist. Okay. Um so there's
  1041. 42:49you know there's aleric aleric and and
  1042. 42:52logic functions. There's data move,
  1043. 42:53there's branch and compare, and then
  1044. 42:55there's a a bunch of miscellaneous ones
  1045. 42:56as well. And so the question for you is,
  1046. 42:58do you as a student need to memorize
  1047. 43:00instruction codings? That would be
  1048. 43:02horrible, right? And so when you did
  1049. 43:04370, yeah, you had eight, right? For
  1050. 43:06this instruction set, you could memorize
  1051. 43:08them all. Uh ARM has 255. You don't want
  1052. 43:12to, this is not worthwhile to memorize
  1053. 43:14them all. It's not going to be valuable
  1054. 43:15for your time, right? But but
  1055. 43:19um you're going to want to be able to
  1056. 43:20get through exam and homework problems
  1057. 43:22fairly quickly. So uh on the website on
  1058. 43:24the assignment page probably at the
  1059. 43:26bottom there is a link to the reference
  1060. 43:28card that we've made for this thing.
  1061. 43:29You'll get this on the exam. If you get
  1062. 43:31real excited uh there's also the
  1063. 43:33official ARM two thumb to whatever um uh
  1064. 43:37instruction card. I would make sure that
  1065. 43:39you can read through this uh reference
  1066. 43:41card quickly to get the information you
  1067. 43:43need. It's rare that I'm going to give
  1068. 43:45you some exotic function and like just
  1069. 43:48hope that you can use it. But things
  1070. 43:50like moves and loads and stores and
  1071. 43:53branch conditions, you're going to use
  1072. 43:55those all the time. So you might as
  1073. 43:56there's some things that will be useful
  1074. 43:58if you memorize them, but will give you
  1075. 44:00everything on the exam.
  1076. 44:03All right.
  1077. 44:04I basically said the same thing that
  1078. 44:06there are certain set of subsections
  1079. 44:07that you want. Um and I'm just going to
  1080. 44:10these are not even you shouldn't
  1081. 44:11memorize these here. The the point here
  1082. 44:13is just there's a standard set of
  1083. 44:15instructions and then ARM does special
  1084. 44:17thing where they make a version with an
  1085. 44:20S on the end and S we saw that last we
  1086. 44:22saw move s and s is this the pneumonic
  1087. 44:25to update the program status register.
  1088. 44:28So the output of an ad here will go and
  1089. 44:31change the output of your SAT uh status
  1090. 44:34register basically your ALU flags so
  1091. 44:36that when you get to a branch condition
  1092. 44:38or some other condition you can uh make
  1093. 44:40a decision based on those uh program
  1094. 44:42status registers right
  1095. 44:47and so again you you probably seen this
  1096. 44:50before but there's you know negative is
  1097. 44:52it zero is there a carry right
  1098. 44:54especially if you want to do like two
  1099. 44:5532-bit instructions and add them
  1100. 44:56together for a 64-bit it you have to
  1101. 44:58know if you can carry there's overflow
  1102. 45:00and other quantization flags and the
  1103. 45:03program status register is actually a
  1104. 45:06concatenation of multiples so you have
  1105. 45:08your your ALU flags uh you have your
  1106. 45:11interrupts and then you have uh we don't
  1107. 45:13really talk about them but there's these
  1108. 45:15IT flow control basically if you want to
  1109. 45:17make fancy case statements there's
  1110. 45:18another set of registers for that and
  1111. 45:21those are all combined into the PSR so
  1112. 45:23this is the program status register this
  1113. 45:25is more or less holding the state of
  1114. 45:27your processor. Uh if you call a
  1115. 45:30function or need to uh do an interrupt,
  1116. 45:34you're going to have to uh preserve some
  1117. 45:36of the information in here. And we'll
  1118. 45:38talk about that later. Any questions?
  1119. 45:41>> Yeah.
  1120. 45:42>> Why would you not want to update the
  1121. 45:44programs as
  1122. 45:46>> Oh, um maybe you just want to defer that
  1123. 45:49decision later. So uh you could imagine
  1124. 45:52a a program where the branch condition
  1125. 45:55happens after some other computation and
  1126. 45:57so by not updating the program status
  1127. 46:00register you've saved that bit of
  1128. 46:01information. In fact I had embedded
  1129. 46:03systems project where uh that RFID tag I
  1130. 46:06showed you on the first day um we were
  1131. 46:08trying to read in this bit stream these
  1132. 46:10edges from the RFID uh reader very very
  1133. 46:14quickly and we just ran out of time. we
  1134. 46:16just could not process them quickly
  1135. 46:18enough. And so there was a little trick.
  1136. 46:20We had one bit extra we had to keep
  1137. 46:22track of. And all we did was we store
  1138. 46:24that bit illegally, not illegally, but
  1139. 46:25just nonsensically. We stored it in the
  1140. 46:27program status register just so we could
  1141. 46:30uh stay alive a little bit longer
  1142. 46:31without uh losing track of state. So you
  1143. 46:34could also just think about an emergency
  1144. 46:35is you can store one bit there if you
  1145. 46:37really had to. It may not make sense in
  1146. 46:40the rest of your program, but it's it's
  1147. 46:41a place you can update.
  1148. 46:43Um, all right. The car classic carry
  1149. 46:46example for time we'll just go through
  1150. 46:48it. But the trick here is that uh by
  1151. 46:51doing your ad. So you're going to add
  1152. 46:53these two numbers together. You can set
  1153. 46:54the flag with the s uh that will update
  1154. 46:57it and then you can use your carry add
  1155. 46:59functionality and then the it will look
  1156. 47:02for the carry bit as you do it. And now
  1157. 47:04you can do a 64-bit uh operation.
  1158. 47:08Okay.
  1159. 47:09There's bit w bitwise logic operations.
  1160. 47:12So, ands and ors. Um, why would that
  1161. 47:15matter for embedded systems? So, often
  1162. 47:18times you have a register like your
  1163. 47:20output port with a bunch of LEDs on it
  1164. 47:22and you don't know what the other
  1165. 47:23programs other parts of your programs
  1166. 47:25have done if one LED is high or low or
  1167. 47:27whatever. So, here you can just use this
  1168. 47:30logical operation. You can read in the
  1169. 47:32status of your register. Now, it's
  1170. 47:34probably not 32 bits. It's probably only
  1171. 47:35eight bits, but for this example, and
  1172. 47:37then you can logically ore in the data
  1173. 47:39you want. And now you're going to go and
  1174. 47:41set that one LED that you wanted high.
  1175. 47:43In this case, you wanted two LEDs high,
  1176. 47:45but they're already there. And so a bit
  1177. 47:46wise or operation is pretty useful. The
  1178. 47:50contrary to that is the bit clear. So
  1179. 47:52they give you a special function for
  1180. 47:53that. Here we have a bit clear. And then
  1181. 47:57you go through and you can say I only
  1182. 47:59want to clear say the last four bits in
  1183. 48:01this particular case. So now you have a
  1184. 48:03way to manipulate bitwise uh register
  1185. 48:07operations uh which just happens to be
  1186. 48:10useful.
  1187. 48:12All right.
  1188. 48:14So uh there are moves. We talked a
  1189. 48:16little bit about moves as a methodology
  1190. 48:18for creating immediates. That's a common
  1191. 48:20one. Obviously you can move things
  1192. 48:22around registers. Moves don't move
  1193. 48:23memory. That's what loads and store is
  1194. 48:25for. So you can move data around your uh
  1195. 48:28register. We have two special ones. So
  1196. 48:31we have the the normal move immediate.
  1197. 48:33So you move uh a number in and then we
  1198. 48:35have move wide and move top special
  1199. 48:38function. So move wide will go through
  1200. 48:41and it will move in. So you can't you
  1201. 48:44can't fit a 32-bit value in a 32-bit
  1202. 48:47instruction. So the um the the uh
  1203. 48:51architects have given you some
  1204. 48:52functionality to allow you in two
  1205. 48:54instructions to get a 32-bit value in a
  1206. 48:56register. So move wide. What it does is
  1207. 48:58it'll take the lowest uh 16 bits. It'll
  1208. 49:01put it in there and it will clear out
  1209. 49:03all the zeros. It'll clear out anything
  1210. 49:05that was in that register. So like say
  1211. 49:07R0, it'll make all that zero. And then
  1212. 49:10move top only affects the top uh the top
  1213. 49:1416 bits and then it will take 8765 and
  1214. 49:18put that in the highest bits without
  1215. 49:20perturbing the bottom. So in two
  1216. 49:23instructions you can go and put in
  1217. 49:25arbitrary values in your registers. But
  1218. 49:27there's a challenge and if you do it
  1219. 49:29backwards
  1220. 49:31right here move top uh goes and will
  1221. 49:35white and and there didn't know say it
  1222. 49:37was a aaa it won't affect the bottom
  1223. 49:38ones. Okay that's fine and you you've
  1224. 49:40put your 876 in the highest bits but if
  1225. 49:43you do move wide afterwards it has
  1226. 49:45erased those bits. This is more like the
  1227. 49:48logical ore here. This one is not. This
  1228. 49:51one is um going to erase the top. It
  1229. 49:54always instantiates that those must be
  1230. 49:56zero.
  1231. 49:58Any questions?
  1232. 50:01>> Yeah.
  1233. 50:01>> Is there another instruction that moves
  1234. 50:05the 16 bits lower part?
  1235. 50:10>> Well, moves it into lower while keeping
  1236. 50:12the top part. No. No. um probably the
  1237. 50:15closest thing you can do like logical
  1238. 50:16shift lefts and that sort of stuff and
  1239. 50:18then you could probably do a bit uh you
  1240. 50:21could do an or functionality. So you
  1241. 50:22still have to you're going to use
  1242. 50:24multiple commands to get there.
  1243. 50:30Uh yeah. All right. So then we have a
  1244. 50:34load function. So load and stores are
  1245. 50:36specific for memory for getting data in
  1246. 50:38and out. So here we're going to take the
  1247. 50:41the address that's stored in register R1
  1248. 50:44and that's the memory address. And then
  1249. 50:46we're going to uh take go to that
  1250. 50:50address that's stored in R1 and take the
  1251. 50:52value that's there in that memory
  1252. 50:54location and put it into R3.
  1253. 50:57And then there's just as 370 there's all
  1254. 50:59the variations you could imagine. Uh we
  1255. 51:01don't for us class we only really care
  1256. 51:03about the standard loads and stores. We
  1257. 51:05don't care about the unprivileged and
  1258. 51:06the exclusive uh exor or loads and
  1259. 51:10stores. Um I doubt you'll run into them.
  1260. 51:13But here we have 32-bit, 16bit and 8bit
  1261. 51:16operations. Okay.
  1262. 51:19And so now it comes back to our mental
  1263. 51:22model of what is the memory
  1264. 51:23organization. So the 8 bit makes sense.
  1265. 51:25At a particular address I can load and
  1266. 51:27store. As 16 bit I can do two at a time
  1267. 51:30in that case. And then a 32-bit I would
  1268. 51:33always kind of fall back to this mental
  1269. 51:35model of uh of memory where you're
  1270. 51:38putting in a 32-bit word in an in wide
  1271. 51:41at a time. Uh you have special
  1272. 51:44functionality for things like sign
  1273. 51:47extended. So say I have a a
  1274. 51:50word I have calculated it. I want it be
  1275. 51:53sound uh sign extended. It will put it
  1276. 51:55into a memory location and then add fff
  1277. 51:57at the top to indicate that it's uh sign
  1278. 52:00extended. Okay, so my question for you
  1279. 52:03is why is there not a store variant a
  1280. 52:07store sign extended? Why is it only
  1281. 52:10really valid and useful to have a load
  1282. 52:12sign extended in this architecture? What
  1283. 52:14do you think? So take 30 seconds.
  1284. 52:50I also
  1285. 53:05What do you think? Why why would we have
  1286. 53:08a sign extended load function but not a
  1287. 53:10store function?
  1288. 53:16I guess instruction
  1289. 53:24[clears throat] two instructions instead
  1290. 53:26of
  1291. 53:27>> so but why not uh have a so store I'm
  1292. 53:30going to store into the register
  1293. 53:32>> right out of memory so why don't we have
  1294. 53:35sign extend store
  1295. 53:37>> so the two reasons are one you can just
  1296. 53:39sign extend separately
  1297. 53:41>> sure
  1298. 53:42>> one is there's no point making number
  1299. 53:47Well, no, this is storing it into a
  1300. 53:48register, right? So, you could sign
  1301. 53:51extend a number in the register. So, why
  1302. 53:53would you do that? Maybe you would do
  1303. 53:55like I don't know why you would do it.
  1304. 53:57Uh
  1305. 53:59uh I can't well maybe you have an 8 bit
  1306. 54:01you take a 8 bit value you do and then
  1307. 54:03you put it into a register and you want
  1308. 54:05to sign extend it. Why is that not
  1309. 54:08useful or valuable? Why would it not be
  1310. 54:10implemented?
  1311. 54:16Yeah,
  1312. 54:16>> I have a question.
  1313. 54:20>> So, um, good question. So, we have
  1314. 54:23memory and we have the core, right? And
  1315. 54:25so, load and stores is our way to get
  1316. 54:26data in and out of the core from memory.
  1317. 54:29So, we're going to load data from memory
  1318. 54:32into the core. So, we're going to take a
  1319. 54:3332-bit 16 or 8 bit value and we're going
  1320. 54:36to put it into a 32-bit register.
  1321. 54:38>> That's a load. That's a load because
  1322. 54:39we're from Oh, because ARM ARM doesn't
  1323. 54:42care about memory. ARM doesn't care
  1324. 54:44about peripherals. ARM only cares about
  1325. 54:46the core's point of view. They designed
  1326. 54:48it that way. So from ARM's point of
  1327. 54:49view, we're loading into the register.
  1328. 54:51>> Then the answer would be or I think the
  1329. 54:54answer might be because
  1330. 55:01>> Yep. Exactly. There there's no there's
  1331. 55:04no like type casting or anything weird
  1332. 55:05in memory. it's just bits and um now
  1333. 55:09it's your job as the programmer to keep
  1334. 55:13track of what is the data type you put
  1335. 55:15in there. Okay, so the value is is
  1336. 55:17pretty minimal. Then
  1337. 55:20uh okay, a word of caution with IDE and
  1338. 55:23I mess this up at least once a year. How
  1339. 55:26you display information in your IDE
  1340. 55:28depends on the endingness. Right? So
  1341. 55:30these are all the same values, but I
  1342. 55:32asked my IDE to display in 8 bits, 16
  1343. 55:36bits, and 32 bits, right? And it's using
  1344. 55:39the same kind of mental model I talked
  1345. 55:41about before. It's incrementing
  1346. 55:42addresses by four. In fact, it's
  1347. 55:44incrementing down in this particular
  1348. 55:46tool, right? Um, but it's just you can
  1349. 55:49get easily confused about which which
  1350. 55:52way is being represented. It gets me
  1351. 55:54once a semester.
  1352. 55:57All right.
  1353. 55:58Now specific for ARM we have special uh
  1354. 56:03load operations. We have special cases
  1355. 56:05for load. So we have offset and
  1356. 56:07pre-indexing and post-indexing. So a
  1357. 56:09normal load function. So this is
  1358. 56:11register space inside the core that is a
  1359. 56:14data space and memory. Okay. And here we
  1360. 56:17have a a load function which is going to
  1361. 56:19take the address is stored in R0. Go to
  1362. 56:23that address and put it into R1. So
  1363. 56:25we're going to go here. This is a 32-bit
  1364. 56:27operation. is going to take all those
  1365. 56:29bits and put them in there. Normal load,
  1366. 56:31nothing fancy. Then we have offset
  1367. 56:34indexing which allows us to offset from
  1368. 56:38this value. And what you're going to
  1369. 56:39find out this is particularly useful
  1370. 56:40because how they've organized memory is
  1371. 56:43that they might have like a GPO
  1372. 56:45peripheral and they're always going to
  1373. 56:47store the second bit of any port is
  1374. 56:50always going to be the same thing or the
  1375. 56:51third bit or whatever the address is. So
  1376. 56:53because there's so much uh repetition in
  1377. 56:56the structures of microcontrollers,
  1378. 56:58having a base address and then indexing
  1379. 57:00off of it is a useful uh modality. Also,
  1380. 57:04if you want to iterate through lists or
  1381. 57:06uh those sorts of things, uh having a
  1382. 57:08base address and being able to index is
  1383. 57:09useful. And so they the compile they you
  1384. 57:12know they they did workload evaluations
  1385. 57:14and they say okay this is so so often
  1386. 57:16used we'll give special instructions
  1387. 57:18just to support this. So here we're
  1388. 57:21going to go uh assuming the same thing.
  1389. 57:23We're going to go the value stored in R0
  1390. 57:25is the address and then we're going to
  1391. 57:27store in R1, but as we go we're going to
  1392. 57:30on the fly add four to it. So we're
  1393. 57:32going to increment that value and go to
  1394. 57:34a different set of addresses and we're
  1395. 57:36going to bring those four in and we're
  1396. 57:38going to place it in R1. Okay,
  1397. 57:42so that was uh that's offset indexing.
  1398. 57:45Now pre-indexing
  1399. 57:47is uh so here we have we're going to
  1400. 57:50pre-index by four. It could be a larger
  1401. 57:52number, right? It doesn't just have to
  1402. 57:53be four. It could be a negative number.
  1403. 57:54So we have four and then we have a bang
  1404. 57:56and and when I think of asking bang as
  1405. 57:58in immediately right now it's going to
  1406. 58:00happen. So what it does is it augments
  1407. 58:02the value stored in the register. So
  1408. 58:05we're going to uh on the fly oh wait uh
  1409. 58:08oops did I go wrong? I went the wrong
  1410. 58:10way. Here we go.
  1411. 58:12So before we do the memory uh uh the
  1412. 58:16fetching of the information, we're going
  1413. 58:18to offset this value. We're going to
  1414. 58:20make that value four in one instruction.
  1415. 58:23It's going to update that R0 and then
  1416. 58:25it's going to go and grab that value and
  1417. 58:27put it into memory.
  1418. 58:29>> Yeah.
  1419. 58:34>> Yes. So this one just offset indexing.
  1420. 58:37Oops. This never actually hit the
  1421. 58:39register. This was like on the fly. the
  1422. 58:41ALU as it's going out trying to find
  1423. 58:44that uh address this adds four to it
  1424. 58:47right but here it never changes the
  1425. 58:50register
  1426. 58:51in pre-indexing it changes the register
  1427. 58:55then it goes out and all does it in one
  1428. 58:57operation okay
  1429. 59:00and then you have the the inverse of
  1430. 59:02that postindexing where you go through
  1431. 59:05and you say okay in post the last
  1432. 59:07operation after I've gotten the
  1433. 59:08information I'm going to uh iterate or
  1434. 59:12imp increase the uh value stored in R0.
  1435. 59:14So the next time in my loop uh it has
  1436. 59:17four on it. So it's this is a statement
  1437. 59:19about compared to the memory access
  1438. 59:21where does that value get updated and
  1439. 59:23does it get updated? Yeah.
  1440. 59:28>> Uh you know is that you're running
  1441. 59:30through some loop and is it that you did
  1442. 59:33your operation before the indexing or
  1443. 59:35after the indexing? It's kind of like an
  1444. 59:36off by one scenario.
  1445. 59:38>> Is that does the compiler take your plus
  1446. 59:41versus plus+ I and do that
  1447. 59:43>> it could I mean compiler does anything
  1448. 59:46compiler does wild things but yes that
  1449. 59:49that is it's I would say it the other
  1450. 59:51way which is these workloads are so
  1451. 59:52common that they made special
  1452. 59:54instructions for this
  1453. 59:58uh yeah so those are there's four
  1454. 1:00:01different types there's no indexing
  1455. 1:00:02there's um pre-indexing without updating
  1456. 1:00:06there's pre-indexing with updating and
  1457. 1:00:08there's post updating basically It's
  1458. 1:00:10just uh does that value get in stored in
  1459. 1:00:14the register the address value get
  1460. 1:00:15manipulated and when does it get manip
  1461. 1:00:17manipulated
  1462. 1:00:20all right and the interest of time you
  1463. 1:00:23guys have seen branching functions and I
  1464. 1:00:25bring these up because there's different
  1465. 1:00:27types of branching functions there's
  1466. 1:00:29branch there's branch while updating
  1467. 1:00:30your link register there's branch with
  1468. 1:00:33uh indirect updating uh different oh and
  1469. 1:00:36and uh branching to a particular label
  1470. 1:00:38or a value in a register. So there's
  1471. 1:00:41four basic basic different types of uh
  1472. 1:00:43branching functions.
  1473. 1:00:45The other trick is that with those ALU
  1474. 1:00:47flags now you can concatenate them uh to
  1475. 1:00:50make a whole bunch of different
  1476. 1:00:51branching conditions. So you can say I'm
  1477. 1:00:53going to add in branch uh when greater
  1478. 1:00:56than. And so by concatenating these
  1479. 1:01:00things together so branch uh greater
  1480. 1:01:02than and then your label. Now the branch
  1481. 1:01:06function will go and look to see if
  1482. 1:01:08those conditions have a meant and then
  1483. 1:01:10it will switch. Okay, so this is just
  1484. 1:01:12coming back to the program status
  1485. 1:01:13register. You you get to use those
  1486. 1:01:16values. So um if you need to in your
  1487. 1:01:19function and then you can manually set
  1488. 1:01:21some of those without necessarily having
  1489. 1:01:22to do an add or a subtract. There's um
  1490. 1:01:26uh fun instructions here like compare
  1491. 1:01:28test that allow you to um you don't need
  1492. 1:01:32to set the s bit. So, normally for an
  1493. 1:01:34ad, if you want to update the uh al or
  1494. 1:01:37the program sash register flags, you'd
  1495. 1:01:39have to go and put the s here. These
  1496. 1:01:41don't require that and they don't need a
  1497. 1:01:42destination register. They just need to
  1498. 1:01:43know what two things you're going to
  1499. 1:01:44compare. And all these functions do is
  1500. 1:01:47update uh those flags.
  1501. 1:01:51All right, any questions before we go to
  1502. 1:01:53an example?
  1503. 1:01:59Not one question, huh?
  1504. 1:02:01Okay,
  1505. 1:02:03let's see.
  1506. 1:02:07All right, so as promised in this class,
  1507. 1:02:09we will have little worksheets. Get your
  1508. 1:02:11brains thinking.
  1509. 1:02:13Uh so you fill them out, you hand them
  1510. 1:02:16back in at the end of class. Uh
  1511. 1:02:19there's probably enough over there. You
  1512. 1:02:20guys can work together. It's not a quiz.
  1513. 1:02:27Here we go. Maybe one. Oh, here. A for
  1514. 1:02:30the guy behind you. Can you can I
  1515. 1:02:32deputize you to go up that row over
  1516. 1:02:34there and start handing some out?
  1517. 1:02:38There you go. Let's see. Hand them that
  1518. 1:02:42way.
  1519. 1:02:44Let's see.
  1520. 1:02:47There you go. Oh, you probably need more
  1521. 1:02:49than that.
  1522. 1:02:51Yeah,
  1523. 1:02:54there you go.
  1524. 1:03:05She needs one over there.
  1525. 1:03:13>> Yeah.
  1526. 1:03:15>> Yeah.
  1527. 1:03:20>> Let's see. You can hand them down.
  1528. 1:03:24Go. Yep.
  1529. 1:03:29Go.
  1530. 1:03:31>> Let's see. I don't know. You look like
  1531. 1:03:33you're Did they make them down there?
  1532. 1:03:38>> Okay, we'll get them there. Here you go.
  1533. 1:03:46Howdy. You go.
  1534. 1:03:50All right.
  1535. 1:03:54You got any extras? All right,
  1536. 1:03:56everybody's got some.
  1537. 1:03:59Anybody missing one?
  1538. 1:04:02Oh, okay. Go work together.
  1539. 1:04:07>> You can write in decimal. I think your
  1540. 1:04:09brain of uh the value
  1541. 1:04:31We have over here.
  1542. 1:05:06Go back to the
  1543. 1:05:47So I
  1544. 1:06:13>> [clears throat]
  1545. 1:06:30>> I want
  1546. 1:06:46>> [snorts]
  1547. 1:06:49>> You're going
  1548. 1:06:52to be [clears throat]
  1549. 1:07:07Yeah.
  1550. 1:07:27>> [clears throat]
  1551. 1:07:54>> Yeah.
  1552. 1:07:56I
  1553. 1:07:58am.
  1554. 1:08:23Hallelujah.
  1555. 1:08:25Heat. Heat.
  1556. 1:08:34[laughter]
  1557. 1:08:49I love you. [snorts]
  1558. 1:08:57Yeah.
  1559. 1:09:03Heat.
  1560. 1:09:13Yeah.
  1561. 1:09:38>> [clears throat]
  1562. 1:09:46>> Heat. Heat.
  1563. 1:09:52Heat. Heat.
  1564. 1:10:02Heat. Heat.
  1565. 1:10:20Heat. Heat.
  1566. 1:10:30Heat. Heat.
  1567. 1:10:42Heat. Heat.
  1568. 1:10:52Heat. Heat.
  1569. 1:11:02Heat. Heat.
  1570. 1:11:12Heat. Heat.
  1571. 1:11:22Yeah.
  1572. 1:11:48Everybody
  1573. 1:12:01Heat. Heat.
  1574. 1:12:11Heat. Heat.
  1575. 1:12:24Hallelujah.
  1576. 1:12:36Amen.
  1577. 1:12:56I like
  1578. 1:13:17>> [clears throat]
  1579. 1:13:54>> together.
  1580. 1:14:01That's
  1581. 1:14:08That's
  1582. 1:14:12another
  1583. 1:14:38Okay.
  1584. 1:14:59Oh my god.
  1585. 1:15:04Heat. Heat.
  1586. 1:15:11[snorts]
  1587. 1:15:22Hallelujah.
  1588. 1:15:36Heat. Heat.
  1589. 1:15:49Hallelujah.
  1590. 1:16:07I'm sorry.
  1591. 1:16:26Yeah.
  1592. 1:16:40Heat.
  1593. 1:16:53All right, let's go through this problem
  1594. 1:16:55here. I have this little online
  1595. 1:16:56simulator. If you find it, it doesn't do
  1596. 1:16:58exactly ARM V7N, just ARM V7. So is the
  1597. 1:17:02instruction coding is going to be
  1598. 1:17:03slightly different, but we'll at least
  1599. 1:17:05for the the purpose of this example,
  1600. 1:17:07we'll just use this thing. Okay. And so
  1601. 1:17:10I've got my code over here and I've got
  1602. 1:17:12memory in set up like yours that hex 98
  1603. 1:17:16gives a certain value 64.
  1604. 1:17:19All right. And then we're going to go
  1605. 1:17:21through. We're going to compile.
  1606. 1:17:23Great. And let's see what else we have
  1607. 1:17:26here. We have Do you guys see that?
  1608. 1:17:29Probably. Maybe. Uh we have our
  1609. 1:17:31registers over there. So we have R0 at
  1610. 1:17:33the top going all the way down to PC at
  1611. 1:17:35the bottom and some other program status
  1612. 1:17:36registers we don't care about. And now
  1613. 1:17:38we're going to do the first function.
  1614. 1:17:40Right? [clears throat] This first
  1615. 1:17:41function is a move. It's going to move
  1616. 1:17:43the value of a decimal 152 into the
  1617. 1:17:49register. Which register? R0. And our
  1618. 1:17:52dissembler has done a nice job and
  1619. 1:17:54already told us what the hex value is.
  1620. 1:17:56So here step into it. You can see that
  1621. 1:18:00uh the R0 has been incremented. In fact,
  1622. 1:18:02our PC has been incremented as well.
  1623. 1:18:04Okay. or our R0 sorry has been loaded
  1624. 1:18:08with 98. Okay, everybody good so far?
  1625. 1:18:12Okay, then we're going to go and we're
  1626. 1:18:14going to do our load function, right?
  1627. 1:18:16And so load from the core's point of
  1628. 1:18:18view is going to take the value in R0
  1629. 1:18:21and store it in memory at the address
  1630. 1:18:23defined by R0. Sorry, the value in R1
  1631. 1:18:26and store it in memory at the location
  1632. 1:18:27R0. And uh the trick that was not clear
  1633. 1:18:31is that R0 was this 64 or sorry I went
  1634. 1:18:36too fast we pre-indexed but it just
  1635. 1:18:38stored it right back into location was
  1636. 1:18:40already at. So it overwritten wrote that
  1637. 1:18:42thing and then because this is post
  1638. 1:18:44indexing after the memory operations
  1639. 1:18:46happened it's incremented that that
  1640. 1:18:49pound two there has incremented R0. It
  1641. 1:18:51was a hex 96 and now it's hex 98.
  1642. 1:18:56How are we doing?
  1643. 1:19:00All right, keep going. Now, we're going
  1644. 1:19:02to get into our loop. We're going to
  1645. 1:19:03start doing some stores.
  1646. 1:19:05Uh, we're already doing that. We're
  1647. 1:19:07going to do our next one. Here is
  1648. 1:19:08pre-indexing. So, [clears throat] we
  1649. 1:19:10went through and we stored the value
  1650. 1:19:12into um that was in R1 into the address
  1651. 1:19:16defined by R0. However, on the fly, we
  1652. 1:19:19added two to it. So, now we've
  1653. 1:19:21incremented a full address space. And we
  1654. 1:19:23can see that if we do this, let's see.
  1655. 1:19:26Will it work? Yes, we've uh changed our
  1656. 1:19:30address over here and we've taken the
  1657. 1:19:32value in R1 and we put it into 9 C
  1658. 1:19:37because we added two two times, one at
  1659. 1:19:39the end of the first store and one at
  1660. 1:19:42the beginning of the first store. So
  1661. 1:19:43that the value in R one uh has been
  1662. 1:19:47stored and it didn't get any offboundary
  1663. 1:19:50errors or anything.
  1664. 1:19:54Okay, keep going and we'll do the

About this transcript

This page contains the full transcript of EECS 373 - Fall 2026 - Lecture 2: “Instruction Set Architecture (ISA)” by Interactive Sensing and Computing Lab , generated from the public captions YouTube serves with the video. The transcript has 10,981 words across 1,664 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.