If a system has RAM containing 16K bytes with each of them needing their own distinct address and on top of that it has 16 peripherals and they each require 2^4 distinct addresses, then how many total addresses are required for this system? Based on what I know about memory, I think it's 2^16k + 16*2^4 however I'm not sure how to translate bytes to bits. I know that if a system has 15 bits then it requires 2^18 distinct addresses but what about bytes?
How many addresses are required for this system
addressinghardwarememoryramsystem
Related Solutions
When designing a modern computer / operating system combination one of the things we want to do is run multiple programs at the same time. One of the problems that you would run into designing this system is that all your programs want to assume they have access to all the memory they want, and they don't coordinate what addresses they use.
The solution to the problem is a system called virtual memory. The virtual address space is the address space the operating system makes available for a program to use. When a program tries to access virtual memory at say, address 1024, they don't get to access the physical memory address (the addresses that go out on the wires to the ram chips) 1024. Instead there is a mapping system.
The operating system handles all the mappings, so that two different programs can both access what they consider address 1024, but process 1 might have its virtual address 1024 mapped to physical address 2048, while process 2 might have its virtual address 1024 mapped to physical address 4096.
In order to keep the mapping information manageable, the operating system maps memory in "chunks" called pages. 4096 bytes is a very common page size. In the example you site, a certain process has a single page, located at virtual addresses 4096, that is 4096 bytes in length (extending to virtual address 8191), mapped to the physical address 0 (since the page is 4096 bytes long, the mapping extends to physical address 4095)
The actual size of the virtual address space is not specified (it must be at least 14 bits wide because the address 12287 is mentioned), but that hardly matters. One thing for sure, it is not a 12 bit addressing system. That's just the size of a virtual memory page, the smallest chunk of memory the operating system will manage. The addresses 8192 through 12287 are just other virtual addresses a process could access.
The author asks the question "what happens if there is an access to memory that is not mapped?"
In a computer without a virtual memory mapping system, the hardware notices that accesses to addresses not connected to physical ram are errors. The hardware signals the operating system of the offense. This process is called an error trap. The operating system would then print the message "Nonexistent memory referenced" and terminate the process. That's the suitably rude message.
In a computer with a virtual memory mapping system almost the same thing happens. Since most programs don't use all the memory that they could possibly address, the operating system doesn't map all of a process' virtual memory to physical memory (also, most computers have more virtual address space available then total physical ram installed in them). So when a process tries to access a virtual address in unmapped memory, the hardware notices there is no physical memory mapped to the virtual address in question. The operating system is signaled, it prints a rude message, and terminates the process.
This mapping and error trapping system not only allows multiple processes to have their own views of the address space, it also allows the operating system to contain and protect the running processes from each other. Even though they may be using the same virtual addresses, the operating system keeps different processes mapped to different physical addresses. That way is isn't possible for a process to (accidentally or on purpose) access or overwrite the memory of any other process. This keeps buggy programs from taking out your whole computer when they crash.
It's not clear what you are really asking, but it is common to store binary values that are wider than the addressable unit of memory. For example, if you want to store 16 bit words in a byte-addressed memory, then you use two bytes. That also means the software has to know which byte is stored first.
In your case you seem to have native 4 bit words. To store a 16 bit value, use 4 words. Again, your software will have to know what convention you are using, like low word first or high word first.
Since your memory only has 4 address lines, its size is limited to 16 native words. Your native word size appears to be 4 bits, so your memory can hold only 64 bits. That means it will be completely used up by two 32 bit values or four 16 bit values, for example.
Best Answer
The total number of addresses in use in the system described would be 16384+16*2^4 for a total of 16640 addresses. In order to address 16640 addresses, you need an address bus with at least 15 address lines, which could address a maximum of 32768 addresses, so 16128 addresses would be unused. This is assuming that your RAM is organized in 8 bit words and is read 8 bits at a time. If for instance, the RAM is organized as 16 bit words, then each address would access two bytes of RAM, then you would need (16k/2)= 8192+16*2^4 or 8448 addresses. Each peripheral still takes one address, but since each address of RAM is now 16 bits wide, you only need half as many addresses for the RAM, but you need 16 data bus lines. If your RAM is organized as 32 bit words, then you need 4096+16*2^4 or 4352 addresses, if for 64 bit words, 2048+16*2^4 or 2304 addresses.