 In this video, we're going to be looking at one of the more subtle features of the MIPS architecture and how it handles memory, which is that the memory operations expect their addresses to be aligned. We'll start with a quick review of a couple major points for our memory. First is that our memory is byte address, which means that our addresses can only point at a byte of memory. We can't get anything smaller than that. But we also have a few different operations we can use, which access one byte by using say load word or store word. But we can also access half words, which are two bytes, and full words, which are four bytes. So we have three different types of operations, each of which can work with a different size chunk of memory. However, the MIPS architecture expects that the addresses these instructions get will be aligned based on the size of the data that they're working with. For load byte and store byte instructions, that's not terribly important because they're just one byte. We can access any one byte in our architecture just fine, and MIPS architecture doesn't care. But if we're going to be working with half words or full words, then we will have to worry about alignment. With halves, those are two bytes, so the MIPS architecture expects that you will give it an address that is aligned to a multiple of two, which is essentially any even number. For words, those are four bytes, so the architecture expects an address that is aligned with fours, so some multiple of four. So in that case, we're looking at pretty much any address that ends with zero, four, eight, or C. So those are the four addresses we've got that are some multiple of four. You can think about having zero, just counting up zero plus four is four, plus four is eight, plus four more gives me 12, or C in hexadecimal. Then four more would bring me back to 10, or zero. This shouldn't be a big issue for us anytime soon, since we'll mostly be working with full 32-bit numbers. We're not going to be mixing those up a whole lot just yet. We will see some issues with that when we get to data structures. But this will also come back a whole lot more when we start looking at our actual architecture. We start seeing, well, how do these numbers work together? How do they access memory? What would the memory do if it gets a non-aligned address? Well, it throws an error at you. So you may notice if you're incrementing your address is wrong that your simulator may throw an error at you saying that you've got an unword-aligned address. Well, that's because you gave it an address that's not a multiple of four. You need to make sure that all of your addresses are a multiple of four if you're working just with integers. For those cases later where we're working with, say, half-words or just bytes, then that won't be a problem. But this will be one thing to kind of keep in mind as you go forward that it will crop up on occasion. You're likely to run into some issue with memory alignment at some point.