Dear all,
I am building a CPU from scratch using logic gates and I have a puzzle that has just come to mind.
I have planned the RAM write cycles in the following way:
If the CPU wants to write data to RAM, it will spread the writing in 2 cycles. At the beginning of the first cycle/state/positive clock edge, the CPU will output the address it needs to write to into the Address bus. It will also output a control signal to tell the RAM chip that it should be writing data. This signal however will not be read by the RAM instantly, it will take half a clock cycle, because this signal will be first sent to a D flip flop, and latched at the downward clock edge.
Then, at the next clock cycle/state/positive edge, the CPU will send a RAMEnable signal so that the RAM will be working, it will also output the data to be written on the data lines. Here's my problem:
At the beginning of this second cycle, the CPU will also need to output the address on the address lines, because otherwise RAM will receive an incorrect address for half a clock cycle and that's not good. The way I send the address to the bus is through a multiplexor, which selects what register will be sending its "data", in this case an address, to the bus. The way this address is sent to the address bus is through a multiplexor that selects which register will be used as an address base. At the first writing cycle, the CPU outputs 2 control bits, which are sent to the multiplexor to select the register.
My problem is that at the second cycle, since I will also be needing to output the address, when the CPU is changing states and entering cycle 2, I am afraid that the 2 control bits that are sent to the plexor will "wobble" for a few nanoseconds before it settles again to the correct value.
Do you see what I mean? Because there is some combinational logic that decides what control bits will be output at each CPU state, when the values fed into this logic are changed, the outputs will wobble for a few nanoseconds until they settle again. But I will be using the values while they wobble because the Address Source bits are used by the RAM from cycle 1 to cycle 2.
My question is, if this value wobbles for a few nanoseconds, and the address wobbles for a few nanoseconds, will the RAM overwrite a random address, or will the RAM not notice this because there is a minimum amount of time that an address needs to be stable in order for the RAM to recognize it and use it to write data at that address?
The wobble should be very short. My question is, will the RAM recognize the address no matter how short the time it stays on, or not?
Your help is immensely appreciated !!
Thank you
Paul
I am building a CPU from scratch using logic gates and I have a puzzle that has just come to mind.
I have planned the RAM write cycles in the following way:
If the CPU wants to write data to RAM, it will spread the writing in 2 cycles. At the beginning of the first cycle/state/positive clock edge, the CPU will output the address it needs to write to into the Address bus. It will also output a control signal to tell the RAM chip that it should be writing data. This signal however will not be read by the RAM instantly, it will take half a clock cycle, because this signal will be first sent to a D flip flop, and latched at the downward clock edge.
Then, at the next clock cycle/state/positive edge, the CPU will send a RAMEnable signal so that the RAM will be working, it will also output the data to be written on the data lines. Here's my problem:
At the beginning of this second cycle, the CPU will also need to output the address on the address lines, because otherwise RAM will receive an incorrect address for half a clock cycle and that's not good. The way I send the address to the bus is through a multiplexor, which selects what register will be sending its "data", in this case an address, to the bus. The way this address is sent to the address bus is through a multiplexor that selects which register will be used as an address base. At the first writing cycle, the CPU outputs 2 control bits, which are sent to the multiplexor to select the register.
My problem is that at the second cycle, since I will also be needing to output the address, when the CPU is changing states and entering cycle 2, I am afraid that the 2 control bits that are sent to the plexor will "wobble" for a few nanoseconds before it settles again to the correct value.
Do you see what I mean? Because there is some combinational logic that decides what control bits will be output at each CPU state, when the values fed into this logic are changed, the outputs will wobble for a few nanoseconds until they settle again. But I will be using the values while they wobble because the Address Source bits are used by the RAM from cycle 1 to cycle 2.
My question is, if this value wobbles for a few nanoseconds, and the address wobbles for a few nanoseconds, will the RAM overwrite a random address, or will the RAM not notice this because there is a minimum amount of time that an address needs to be stable in order for the RAM to recognize it and use it to write data at that address?
The wobble should be very short. My question is, will the RAM recognize the address no matter how short the time it stays on, or not?
Your help is immensely appreciated !!
Thank you
Paul