Tuesday 28 May 2019

digital logic - How is 'specific' data found and taken from a Semiconductor Memory Source?


In a semiconductor memory chip, each bit of binary data is stored in a tiny circuit called a memory cell consisting of one to several transistors. Volatile type.


Suppose an application stored its data in a particular segment on the computers RAM.


How would the CPU know what data to extract and how would it sort through the other data to get to it. If everything in its core level is 0 or 1 its hard to distinguish what purpose 'x' memory has.



Answer



Typically, a memory is controlled by several address inputs, as well as a read/write control signal and some inputs that control when the read or write operation should occur.


Given n address inputs, 2n locations in the memory can be distinguished. These are the "specific" locations that the computer is able to access. Usually each location contains more than one bit. It could be a byte (8 bits, or memory cells), or a multi-byte word, which could be 16, 32, or 64 bits wide.


If you have a megabyte of memory, with single-byte access, you will need 20 address bits (individual input signals) to control it. For a gigabyte of memory, you would need 30 address bits.




How would the CPU know what data to extract and how would it sort through the other data to get to it?



Generally it's up to the programmer (if using assembly language) or the compiler (when using a higher-level language) to keep track of what data is stored at what address.


For example, if you write a C program with a global variable x, then the compiler will decide what location to store it at, and take care of generating instructions that access that location whenever your program needs to use x.


If you create a local variable y within a function, the compiler will actually keep track of that variable relative to the value held in a special register called the stack pointer (SP). Each time the function is called, SP might hold a different value. But y will be created anew with each call and stored at the same offset from SP (which is kept track of by the compiler and generally not seen by the programmer).


A third possibility is heap allocation. Meaning the storage space is allocated from a "heap" of available memory. In some languages (Java, for example) the compiler might do most of the work of tracking heap memory. In C, the programmer is responsible for keeping track of heap memory. This is done with pointer variables, which basically encode the address where the program should access to get that particular data.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...