States/Phases of matter:

There are three common states of matter: solid, liquid, and gas. (Plasma is another state of matter but is beyond this discussion.)

Libretexts has this excellent material on it: https://chem.libretexts.org/Courses/Bellarmine_University/BU%3A_Chem_104_(Christianson)/Phase_1%3A_The_Phases_of_Matter


A solid will maintain its shape (ice, wax, steel), while a liquid will flow and take the shape of its container (water, mercury). A gas or vapor will fill all available volume (steam, air, mercury). There is a 4th state which is plasma, also known as ionized gas state. It's a gas state where atoms lose their electrons in presence of very high electromagnetic field, which causes these electrons to start conducting electricity, which isn't typical of gases. In nature, lightning is the most common example of plasma. It's the most common state in the universe, since all stars are in plasma state. However, in real life we don't encounter this state, so we don't discuss the plasma state.

States of matter are generally based on the form of the substance at room temperature and pressure. Things like air are gaseous at room temperature while water is a liquid. When heated, water become gaseous, but is referred to as a vapor. At atmospheric temperature (25C) and pressure (1.0 atm), most of the elements are found in solid state. Mercury (Hg) and Bromine (Br) are the only 2 elements found in liquid state. All noble gases and H, N, O, F and Cl are the only ones found in gaseous state.

For Pressure details, see "Force, work, energy" section under Physics.

 


 

GASES:

Maxwell-Boltzmann distribution (MBD): Maxwell-Boltzmann (MB) distribution gives the distribution of speed of gas particles. It's derived from MB statistics (MBS) which s the more general case. MBD is a special case of MBS. MBD was found first by Maxwell in 1860, and then proved formally in 1870 by Boltzmann.

Link for MB statistics (not distribution) => https://en.wikipedia.org/wiki/Maxwell%E2%80%93Boltzmann_statistics

MBS describes the distribution of classical material particles over various energy states in thermal equilibrium. It states that # of particles, Ni with energy εi is:

{\displaystyle \langle N_{i}\rangle ={\frac {g_{i}}{e^{(\varepsilon _{i}-\mu )/kT}}}={\frac {N}{Z}}\,g_{i}e^{-\varepsilon _{i}/kT},} where total # of particles N = Σ Ni and

{\displaystyle Z=\sum _{i}g_{i}e^{-\varepsilon _{i}/kT},}

Basically what MBS is trying is getting the fraction of particles in a particular energy state (the numerator and denominator with T term in the exponents) and then multiplying by N to get total particles. Let's see if it makes sense. At 0K (absolute 0 temperature), the number of particles in any energy state is 0. This makes sense as at 0K, there are no energy states besides the ground energy state, and all particles are in that energy state. As Temp inc, the number of particles in higher energy states begin to inc.

MBD is a probability dist func of particles with a particular speed and applies to ideal gas. We can derive MBD from MBS by observing that  εi is the kinetic energy of that particle = 1/2*m*v^2, and then doing some manipulation.

Therefore, the Maxwell–Boltzmann speed distribution (i.e MBD) is :

{\displaystyle f(v)=\left({\frac {m}{2\pi k_{B}T}}\right)^{3/2}4\pi v^{2}\exp \left(-{\frac {mv^{2}}{2k_{B}T}}\right)} where m=mass of particle

 

The above eqn is of the form x*e-x. It starts from 0 at x-=0 and goes to 0 at x=infinity. It's not a gaussian distribution as it's not symmetric. It's a chi distribution.

If we find RMS velocity of all particles, it's V = √ (v1^2 + v2^2 + ...). We use func above to find # of gas particles having speed b/w v and dv. We then integrate it as v^2*f(v)*dv, which leads to

Vrms  = √ (3*kb *T)/m = √ (3*R *T)/M = Where M is molecular mass and R = kb * Na (universal gas constant explained below)

Vrms of diatomic N2 gas at 300K = sq rt[ 3*1.38*10^-23*300/(1.67*(10^-27)*28)] = 515m/s. Total KE of each particle = 1/2*m*(Vrms)^2. = 3/2*kb *T. What this implies is that KE of any gas is the same for a given temp (doesn't depend on anything except Temp).

From above eqn, Vrms is higher for lighter gas, and lower for heavier gases. With pdf plotted on Y axis and rms velocity plotted on x axis, pdf curve's peak has to be at lower velocity for heavier gases. However total kinetic energy of any gas is dependent only on Temp. Since RMS velocity became lower for heavier gases, more particles will need to within the vicinity of the peak to keep energy same (i.e area under the curve can't change). This causes the curve to start shifting right for lighter gases (i.e curve starts flattening for lighter gases).

Total energy of 1 mole of gas = 1/2* (3*kb *T) * Na = 3/2*R*T. This is the most known eqn that KE of any gas at any Temp is 3/2*R*T (which is only dependent on Temperature and nothing else). This can also be seen from the observation that for a given thermodynamic system at temp T, the average thermal energy carried by each microscopic degree of freedom in the system is 1/2 kT (i.e., about 2.07×10−21 J, or 0.013 eV, at room temperature). Since particles in 3D have 3 degrees of freedom, each particle has 3/2 kT of energy. For 1 mole of particles, energy = 3/2kT*Na = 3/2RT = 3/2*8.3 J⋅K−1⋅mol−1 =* 300K * 1mole =  3735 J = 3.7KJ.

Internal Energy (U) and degrees of freedom: Internal energy of a gas includes not only translational energy due to motion of particles, but also rotational energy (molecules spinning) and vibrational energy (molecules vibrating). All of these energy contribute to KE. On top of KE, we may also have PE resulting from proximity of particles. Combing both of these (KE+PE), we get Internal Energy (U) of the particle. What all motion (translational, rotational or vibrational) any molecule has is determined by it's degree of freedom.

Degree of freedom is the number of variables required to describe the motion of a particle completely. For any molecule with n atoms, each molecule has 3 degrees of freedom as the molecule is free to move in any of 3 dimensions. For n atoms in the molecule and assuming each atom within the molecule can also move independently in 3 dimensions, it will have a total of 3*n degrees of freedom. For ex, He gas will have 3 degrees of freedom, while N2 gas will have 3*2=6 degrees of freedom.

However, all atoms within molecule are not free to move in any motion as these atoms are bonded together. So, all motions are not translational; some become rotational, some others vibration. For non-linear molecules, all rotational motions can be described in terms of rotations around 3 axes, the rotational degree of freedom is 3 and the remaining 3N-6 degrees of freedom constitute vibrational motion. For a linear molecule however, rotation around its own axis is no rotation because it leave the molecule unchanged. So there are only 2 rotational degrees of freedom for any linear molecule leaving 3N-5 degrees of freedom for vibration. And to complicate matters, the degrees of freedom changes with Temp too !!

This link has few videos to explain => https://openbooks.library.umass.edu/toggerson-131/chapter/energy-associated-with-motion-at-the-molecular-scale-temperature-and-thermal-energy/

Each degree of freedom has 1/2RT of energy. For monoatomic gas such as Helium, atoms have translational energy only. So, total energy is 3/2RT. For diatomic gases such as Nitrogen gas (N2) , on top of translational energy, we have rotational energy of RT due to 2 degrees of motion, while vibrational energy is almost zero. So, Total internal Energy U of N2 gas is 5/2RT. For other molecules, we have vibrational energy too, which may contribute to total energy. 

U in solids, liquids and gases: In gases, calculating total energy was easy as gas molecules only had KE (no PE as molecules don't interact with each other due to large distances), and hence their energies can be calculated in isolation. Any molecule whether in solid, liquid or gas form has KE in all forms, it's just that contribution from translation, rotational and vibrational motion changes, which changes total KE too. Gas form has the highest U and is mostly from KE due to translational energy (as particles are far apart, no interaction b/w particles, so potential energy negligible). U is lower than gas as there's limited translational motion, but at same time PE is higher as particles are closer. Solids have the lowest U as particles are fixed in place, so only KE is from vibration of particles. However PE is highest as particles are closest together. At absolute 0K, KE of particles go down to 0, but still have some residual PE known as zero point energy.

Latent heat during phase change: As a liquid changes to gas form, it takes in latent heat at it's boiling point, which doesn't inc the temperature. All of this latent heat goes into the liquid in increasing PE as particle distance increases. ,

PE change: PE at infinity is taken as 0. If +ve particles come closer together, then we have to apply energy to bring them closer, so their PE has to inc (since our work done gets stored as PE). If -ve particles come closer together, then they release energy as they come closer closer, so their PE has to dec (since we have to do -ve work which gets stored as PE). PE decreases as neutral particles come closer, as there are attractive forces b/w neutral particles (They behave as opposite charged particles or have attractive forces due to Van der waals (see below) in solid, liquid states). However, beyond a certain proximity, when particles get too close, then repulsive forces start dominating and PE starts to inc rapidly. We are talking about distances in solids/liquids where these attractive forces exist, so we can treat different particles as having opposite charges.

This is the reason, why applying heat changes from solid to liquid to gas => The internal energy increases which changes the state. Specific heat of any material in the 3 states, gives us the amount of internal energy of any molecule.

Ex: Internal energy of Water calculated from specific heat: 

  • Solid water (Ice) => specific heat = 36J/mole-K. So, at 0C (273K), Internal energy of ice = 36*273 = 9.8 KJ/mole.
  • Latent heat from ice to water => 6KJ/mole. 100X more than specific heat of ice.
  • liquid water (water) => specific heat = 75J/mole-K. So, at 27C (300K), Internal energy of water = 75*300 = 22.6 KJ/mole.
  • Latent heat from ice to water => 44KJ/mole. 500X more than specific heat of water.
  • gas water (vapor) => specific heat = 34J/mole-K. So, at 100C (373K), Internal energy of vapor = 34*373 = 12.7 KJ/mole.

Ex: Thermal energy of Noble gas Helium, which doesn't form any bonds with any other atoms.

  • Solid He => specific heat = 2J/mole-K. He becomes solid only at very high pressure and Temp of 1K. So, at 1K, Internal energy of solid He = 1*2 = 2 J/mole.
  • liquid He => specific heat = 20J/mole-K. He becomes liquid at 4K (at atm pressure). So, at 4K, Internal energy of liquid He = 20*4 = 80 J/mole.
  • gas He => specific heat = 20J/mole-K (or 20J/4g=5J/g-K). So, at 27C (300K), Internal energy of gas = 20*300 = 6 KJ/mole. From internal energy eqn, we get 3/2nRT = 4.7KJ/mole which is not too far.

Internal Energy vs atomic energy: This internal energy that we have been talking about is the thermal energy, This is energy for collection of atoms gaining energy due to heat. Other energy that we have within atome is in formation of atom itself => energy needed for formation of nucleus (nuclear energy) + energy needed for getting 2 electrons in it's orbit (Ionization energy or IE). IE for He is 7.6MJ (1000x more than U of He), while nuclear energy is 2.7BJ (1000x more than IE). These energies are also dependent on Temp? FIXME ?

 


 

Ideal gas law: This provides a relation between P, V, T of an ideal gas (ideal gas is one with no interaction among gas particles and assuming gas particles having zero size) with the number of gas molecules for an ideal gas. There were multiple laws discovered by various scientists, but they were all combined into one once "Ideal gas law" was found. Link: https://en.wikipedia.org/wiki/Ideal_gas_law

The law states that

P*V = n*R*T => where P,V,T are pressure (in pascal), Volume (in m^3), Temperature (in Kelvin) of gas and n=amount of gas particles (in moles), R= universal gas constant = k_{\text{B}} (boltzmann constant) * N_{{A}}(Avagadro constant) = 1.380×10−23 J⋅K−1 * 6.022×1023 mol-1 = 8.3 J⋅K−1⋅mol−1 . Here R represents energy in 1 mole of gas particles per unit temp.

The equation above is written in many different forms. The one above is the molar form. Under STP (T=273K, P=atmospheric pressure = 1 bar = 101kPascal), 1 mole of gas occupies V=nRT/P = 8.3*273/(101*10^3) m^3 = 0.0224 m^3 = 22.4 L (since 1L=1000 cm^3 = 1/1000 m^3). So, 1 mole of any ideal gas is always 22.4L in volume under STP. What is very surprising is that no matter what gas it is, it always occupies the same volume under same conditions of P, T. Whether the gas is water or oxygen or complex compound, they all occupy 22.4L for 1 mole of gas under STP. This doesn't seem intuitive, as one might expect gases to have different forces, size, etc and hence occupy diff volumes.

Derivation: Ideal gas law is easy to derive. See wiki link above. Simple proof:

Consider a container of Volume V with N gas particles moving with rms velocity v. Assuming random movement is equally likely in all 3 directions, x,y and z, 1/3 of the particles move in x direction (1/6 th move in +X, while 1/6 th move in -X dirn), strike against the container wall of Area S, and bounce back with reverse velocity v. Momentum change = 2mv for each particle, Force due to each particle=Momentum change/t = 2mv/t. For "q" particles hitting in time t, F=2mv/t*q. In time t, volume of particles striking the wall are = v*t*S. If there are N particles in Volume V, then number of particles in Volume v*t*S = v*t*S*N/V. But only 1/6th are striking. So, number of particles striking wall in time t = v*t*S*N/V *1/6. This is "q". So, P=F/S = 2mv/t*q*1/S = 2mv/(tS)*1/6*v*t*S*N/V=1/3m*v^2*N/V. So, PV=1/3Nmv^2

Using Maxwell-Boltzmann distribution above, ,we found rms velocity (v^2) which comes out to 3k*T/m. So, PV=1/3N*m*3kT/m=NkT => PV=NkT. This is the molecular formula of ideal gas law. If we take n moles of gas, then PV=n*NA*kT => PV=nRT

Deviation from ideal gases: Real gases follow ideal gas laws only at low pressure and at high temperatures. This happens because at low pressure molecular volume of gases is still negligible compared to volume of container. Also, intermolecular forces are low amongst the particles. The same thing happens at high temp, where particles are able to break the intermolecular forces and don't interact with each other. Van der waals eqn which has experimentally determined constants a,b corrects the ideal gas law to incorporate it for real gases. Plots are shown in link above (section 1.7). When very high pressure or low temps are applied, gases change state to liquid, which is an extreme case, where intermolecular forces are very high, and KE is not enough to break them apart.

Dalton's Law o partial pressure: It states that total pressure of a mixture of ideal gases is equal to the sum of the partial pressures of the component gases. i.e if 2 gases are in their own containers with pressure P1 and P2, then, they are both put in the same size container, then total Pressure = P1+P2, as long as the gases don't react with each other. It seems counter intuitive, as we would expect presence of other gas to affect pressure of 1st gas compared to when it was by itself. Apparently that doesn't happen. Reason is that collisions are elastic, so presence of any amount of gas particles doesn't affect the energy of our gas particles (it's only dependent on Temperature), so energies of all gas particles can just be added up.

 



Phase changes: When a substance changes from one state of matter to another, it experiences a phase change. For instance, ice melting into water is a phase change from solid to liquid. Water changing into steam is a phase change from liquid to vapor. Energy in the form of heat is required to create a phase change. The elements in periodic table change state, as well as the compounds formed from them. Infact most matter made up of any number of compounds has to exist in all of the 3 states. It's just that at room temperature and pressure, it exists in one of the 3 states. But by changing temp and pressure, it can be converted to other states too.

Section 3 from above link (dedicated to phase changes only) => https://chem.libretexts.org/Courses/Bellarmine_University/BU%3A_Chem_104_(Christianson)/Phase_1%3A_The_Phases_of_Matter/3%3A_Phase_Changes

 

Intermolecular Bonds:

Intermolecular forces (IMF) are forces that exist between molecules. They are much weaker than intramolecular bonds which are atomic bonds (explained under atomic bonds). IMF are important because they determine the physical properties of molecules like their boiling point, melting point, density, and enthalpies of fusion and vaporization. IMF are called weak bonds, while atomic bonds are called strong bonds. The force within a molecule to break the bonds is lot higher at 430 KJ/mole, while IMF is lot lower at 17KJ/mole (for conversion from gas to liquid) for HCl. So, these IMF are lot easier to break, and hence change phases. The phase in which a substance exists depends on the relative extents of its intermolecular forces (IMFs) and the kinetic energies (KE) of its molecules.

Intermolecular forces: https://chem.libretexts.org/Bookshelves/General_Chemistry/Map%3A_Chemistry_-_The_Central_Science_(Brown_et_al.)/11%3A_Liquids_and_Intermolecular_Forces/11.02%3A_Intermolecular_Forces

All of these attractive IMF are also called "Van der Waals" forces, after the name of the scientist who found these. There are 3 kinds of van der waals forces.

  1. Dipole-Dipole attraction: Polar molecules such as HCl have +ve charge on one side and -ve charge on other side resulting in a dipole. An attractive force between HCl molecules results from the attraction between the positive end of one HCl molecule and the negative end of another. This attractive force is called a dipole-dipole attraction.
    1. Effect of dipole dipole attraction is apparent when we compare Fluroride gas with HCl. Both have same molecular mass, but polar nature of HCl causes the molecules to stick together, while F2 molecules being non polar don't have this attractive force. As a result, HCl becomes gas at 188K,, compared to F2 molecules which boil at much lower temp of 85K.
  2.  London dispersion forces : These forces are present in all matter. London dispersion forces are weak attractions between molecules. They can occur between atoms or molecules of any kind, and they depend on temporary imbalances in electron distribution. This causes formation of temporary dipoles, resulting in electrostatic attraction b/w molecules. Being very weak, they become significant only when the molecules are very close. Larger and heavier atoms and molecules exhibit stronger dispersion forces than do smaller and lighter atoms and molecules. In a larger atom, the valence electrons are, on average, farther from the nuclei than in a smaller atom. Thus, they are less tightly held and can more easily form the temporary dipoles that produce the attraction. The shapes of molecules also affect the magnitudes of the dispersion forces between them. Compact shapes provide less surface area and hence less force, while elongated shapes provide a greater surface area available for contact between molecules, resulting in correspondingly stronger dispersion forces.
    1. Melting and boiling point trend in periodic table: 
  3. Hydrogen Bond: This is a a bond that is usually b/w +ve charged H atom and another -ve charged atom.  This bond forms due to EN diff b/w the 2 diff atoms that form the molecule. Water is one of the ex of H bond. Even though they are called, they are not real bonds.
    1. In general, these are the requirements for a H bond:
      1. A polar covalent bond needs to exist b/w H atom and a highly EN atom as N(2p3), O(2p4), and F(2p5), These are the only 3 that have large EN difference to form a highly polar bond.
      2. There should be at least one active lone pair of electrons available in highly EN atom. Lone pairs at the 2-level have electrons contained in a relatively small volume of space, resulting in a high negative charge density.
    2. Once these 2 conditions are satisfied, a bond starts forming b/w lone pair of electrons in 1 molecule which is highly EN with highly positive hydrogen atoms of another molecule. This bond has 1/10 the strength of an avg covalent bond, so it is strong enough to change properties of that molecule.
    3. NH3, H2O and HF are 3 examples of compounds which form strong enough H bonds that their boiling points are lot higher, compared to what is expected in the absence of H bond.
      1. Water is the perfect ex of how H bond causes higher boiling pt. There are 2 pair of lone electrons available on Oxygen to form 2 H bonds with neighboring Hydrogen atoms of another molecule. Even though H2O has covalent bonds and hydrogen and oxygen atoms share their electrons, they end up developing a polarity due to higher electronegativity of oxygen compared to hydrogen. Oxygen ends up getting a slightly negative charge, while hydrogen a slightly positive charge. This allows different molecules of H2O to form a lattice structure with -ve polarity of oxygen of 1 molecule forming polar bonds with +ve polarity of hydrogen atoms of another molecule. These bonds are called Hydrogen bonds (and NOT polar bonds). When temperature are low, the vibrational energy of each molecule is very low, and not enough to break these hydrogen bonds between hydrogen and oxygen of different molecules. This makes it a solid, where the molecules can't slide past each other. But as temperature rises, the vibrational energy of each molecule increases, causing these hydrogen bonds to get weaker to a point where the molecules can slide past each other. This forms a liquid. If we keep on increasing the temperature, these hydrogen bonds break completely free, and different molecules become independent of each other. This forms the vapor or gas state. This video from Khan Academy explains it => https://www.khanacademy.org/science/chemistry/states-of-matter-and-intermolecular-forces/states-of-matter/v/states-of-matter

 

Liquid -> Gas (phase change): Just like we have distribution of gas particles with different speed/energy (as per Maxwell-Boltzmann distribution), the same law applies to liquid particles too. Some liquid particles will have higher kinetic energy than others. Ones which exceed the energy needed to break off the liquid surface (and near the surface traveling upward) will leave the liquid surface and become gas. This is called evaporation. If this gas is allowed to escape, then avg energy of liquid particles will drop (dropping the temp). This will force absorption of heat from surroundings, which will maintain the avg speed of molecules in liquid. Over time, all liquid will evaporate. However, if the liquid is kept in closed container, then evaporation will stop after some liquid has evaporated. This is due to the fact that vapors that form above the liquid start exerting a pressure, and will start getting recaptured at the surface (i.e condense into liquid state again). The 2 rates => rate of evaporation and rate of condensation balance each other out. The pressure of vapor at which this happens is called "vapor pressure" and is constant for a given liquid at a given temperature (irrespective of it's volume). Vapor pressure of water at 25C is 24mm Hg (3 kPa).

The magnitude of the vapor pressure of a liquid depends mainly on two factors: the strength of the forces holding the molecules together and the temperature. Lower the intermolecular forces, easier for molecules to escape as vapor, and hence higher the vapor pressure. Also, as Temp inc, more molecules have higher energy and can get to vapor state, and hence higher vapor pressure. 

Boiling point: Boiling pt is related to the vapor pressure. We saw above that Vapor pressure of water at 25C is 24mm Hg (3 kPa). At this temp, water converts to gas only at surface (not thru out the liquid). This process is called evaporation and heat needed for this is called "latent heat of evaporation". If we keep increasing temp to increase the vapor preesure, then at some temp, the vapor pressure will exceed the atmospheric pressure. As soon as this happens, water will start forming bubbles even deep within the liquid, indicating the bonds have been broken inside the liquid too. These bubbles will come to surface and escape.

and those bubbles. Let's say we removed the walls of the closed container and replaced it with air pressure of 24mm Hg. Then the situation is still the same as that of a closed container. Now, we slightly decrease the air pressure. Then vapor molecules will start moving from high pressure to low pressure, creating a pressure lower than vapor pressure near the water surface. This will cause more water to evaporate as it needs to maintain the vapor pressure. This process will continue indefinitely, resulting in creation of bubbles in the liquid, which are actually vapors at vapor pressure. These will keep escaping, until all the liquid has escaped as vapor. This vigorous process is called boiling and the temperature at which it happens is called "boling point" at that air pressure. For our definition, we define "Boiling point" as temp at which vapor pressure equals atmospheric pressure. At 100C, vapor pressure of water is 1 atm, so that is our boiling pt for water (at atm pressure).

Vapor pressure Vs Temp graph shows non linear relation, but do show that as Temp inc, Vapor pressure inc. So, at lower atm pressure, vapor pressure equals atm pressure at lower temp, and so liquids boil at lower temp, when atm pressure is reduced.

Melting point: Just as boiling pt is defined, melting pt is defined as Temp where solid to liquid conversion happens.

Phase change graph: Pressure and Temp are the only 2 var affecting phases of any material. Graphs depicting these phases with P, T being on X,Y axis are called Phase change graphs.

Critical Temperature/Pressure: Once a gas is above its critical temperature and critical pressure (i.e critical point), it is impossible to get it to separate into a liquid layer below and a vapor layer above no matter how great a pressure is applied. Increasing the pressure only leads to the transition from gas to supercritical fluid.

Triple point: This is a particular temp and Pressure, where all 3 states exist simultaneously. For water, this point is at T=0.01C and P=0.006atm.

 


 

Digestion and Respiration

Digestion and Respiration are the most activity our body in involved in to keep our body cells alive. We have a separate section about human cells.

Bunch of good videos on Youtube. These are ones I found helpful:

Respiration: Respiratory system consists of taking air from the nose all the way to the lungs an then back out from the nose.

 

Digestion: Digestive system consists of taking food via the mouth, all the way to stomach and then excreted out.

 

 

 

Lungs:

Lungs are the largest part involved in respiration. It takes in clean air from outside (containing oxygen) and expels out dirty air (containing carbon dioxide). Oxygen in lungs is taken in by blood and transported to cells of the body. There's hemoglobin cells in blood which do this job of taking that oxygen in. The cells use oxygen to burn carbs, generate energy but generate Carbon dioxide as a by product. This Carbon dioxide is transferred back to blood which is carried to lungs. It's here that lungs take that CO2 and expel it out.

Khan Academy video (nice introductory video) => https://www.youtube.com/watch?v=qGiPZf7njqY

Dr John Campbell Video on youtube showing hand diagram of lungs =>

 

Sam video:

CDC = Clock Domain Crossing

In a single clock design, all paths have same launch and Capture clock. Timing tools are able to time all such paths for setup and hold. When we have more than one clock, then what happens to paths in diff clks? Well, timing tools can still time all paths within a clock domain, i.e all paths launched and Captured by same clk are still timed. What happens to paths that are launched from one clk and captured by other clock? Well, such paths are still timed by timing tools, as all paths are considered synchronous, unless told otherwise. However the question to ask is => Should these paths even be timed? Since the 2 clks are async, the capture clk can come at any time wrt launch clk, so there's really no timing that we can meet here. It's not like a regular clk->clk path that needs to meet setup/hold timing. So, in timing tools, we define all such paths crossing 2 clks as false path (FP) (to be precise, we use SDC cmd "set_clock_groups -async -group <clk1> -group <clk2>" to set all paths b/w clk1 and clk2 to be async, meaning they are all FP).

However, do we need to do anything in design to make sure signals can transmit correctly from clk1 to clk2? Well, turns out that that signal transmitting from clk1 to clk2 will violate setup/hold of the capturing flop in clk2 domain some of the times randomly, depending on the exact arrival time of clk2 wrt clk1. We have no control over the relative arrival time of clk1 and clk2, as they might be coming from 2 diff PLLs. Three possible scenarios:

  1. signal from clk1 meets setup time of clk2 (i.e signal from clk1 comes way before clk2 capture) => New value of Signal will be captured correctly at end of current cycle of clk2.
  2. signal from clk1 violates setup/hold time of clk2: Here 2 scenarios are possible here:
    1. signal from clk1 comes in the setup/hold violation window of clk2 capture (i.e signal comes right close to the clk2 capture edge)=> Since Signal is in the violation window, we don't know what is going to get captured- Is it the old value or the new value? In this situation, actually the signal remains meta stable (i.e an intermediate value b/w 0 and 1) for a little while (may be for a few 10-100 ps), before it makes it's decision to remain at old value or move to new value. Either old value or new value of Signal will be captured correctly at end of current cycle of clk2.
    2. signal from clk1 comes after the setup/hold violation window of clk2 capture (i.e signal from clk1 comes way after clk2 capture)  => Since Signal comes after the violation window, it missed getting captured at the end of current cycle of clk2. So, at the end of current cycle of clk2, it will have old value of signal, and then in next cycle, it'll have the new value of signal.

Depending on which scenario we end up in, we can either have old value or new value at the end of current cycle of clk2. But in next cycle of clk2, we are guaranteed to have new value of signal. Thus there exists a 1 cycle uncertainty, where the value may be old value or new value. This is shown in diagram below (See Async clk section in middle)

 

There's an excellent paper on CDC by Clifford Cummings at SNUG 2008: CummingsSNUG2008Boston_CDC.pdf

Based on the above paper, I found this nice 3 part series on CDC explaining it in further detail: https://www.verilogpro.com/clock-domain-crossing-part-1/

 

Metastability, MTBF and Synchronizers:

Once we capture the signal in clk2 domain (with a flop), can we just allow it to flow freely to other flops in clk2 domain? If we look at case 2.1 above, where the signal comes in the setup/hold window of clk2 domain, the signal being captured has the possibility of going meta stable for a small time. If this signal is passed to other flops, then there are 2 problems:

  1. The first is a timing problem. From this 1st capture flop (we'll call it synchronizer flop) to other flops, we have only clk2 domain (no clk1 domain). That means all flops must meet setup/hold in clk2 domain. When STA tools analyze timing for paths, they assume no metastate for any signal, i.e they go with assumption that signal coming out of previous flop has met timing and is either 0 or 1 and start timing the path from launch flop to capture flop. They check for timing based on that assumption. In our example, metastable state has eaten into the timing of the path from the very first flop to the next flop, so when STA tool reports a particular path has met timing, there's no guarantee that it has indeed met timing. As an ex: if meta state lasted for 1/2 cycle of clk2, and the path delay of the path is 3/4 cycle of clk2 (from synchronizer flop to some other connecting flop), then STA tool will say that the path met timing with a slack of 1/4 clk, but in reality the path failed timing with slack of -1/4 clk.
  2. The second problem is that being metstable is a probabilistic phenomenon. We can never say that metastability will resolve 100% within a given time. It falls down exponentially with time, but there's still a non zero probability that flop output will be metastable even after infinite time. So, our other capture flops may still be prone to getting meta stable value, and hence capture metastable value. These will get resolved to 0 or 1 in each capturing flop. But if there are multiple capturing flop, not all of them will resolve to same value. Now, we have the possibility that same signal will get captured as different values in different flops, while in RTL we assumed them all to be the same value. This may result in incorrect functionality of the gate level circuit even though RTL may work fine. This is unacceptable failure.

Metastability is measured as failure rate or MTBF (Mean time b/w failures). Here's a good paper from TI on measuring MTBF for flops => https://www.ti.com/lit/an/scza004a/scza004a.pdf

How long the flop o/p remains metastable depends on a flop time constant, known as "tau".  Formula for probablility that metastable state is unresolved at time tr is:

f(r) = e^(-tr/tau) where function f(r) is the probability of nonresolution as a function of resolve time allowed, tr, and the metastability decay time constant, tau (value dependent on electrical characteristic of flop). As an ex, if tau=0.2ns, then at time=1ns, the probability that the metastable state is still present = e^-(1/0.2) = 0.007 or 0.7%.

Probability of generation of metastable event = Probability of incoming signal being in setup/hold window of capturing flop = t0/Td where t0=setup/hold window of capturing flop, and Td= time period of data transition (dependent on launch freq of clk1 and how many times data transitions per clk period of clk1).

Failure within time tr = f(r) * probability of generation of metastable event = f(r)*t0/Td

From Probability eqns:

  • If failure rate = λ, then cummulative failures since time=0 is λ*t (this is from derivation of probability desnsity function as shown in MTBF doc). So, failure rate (λ) = cummulative failures / t

Using above eqn, we come with Failure rate (λ) = Failure within time tr / tr = f(r)*t0/Td *(1/tr)

MTBF = 1/(λ) = e^(tr/tau)/(t0*Fd*Fc) where Fc=clk freq of capturing clk assuming we are capturing this metastable value in a flop running at Fc.

Thus we can get MTBF for a 1 flop synchronizer, which gives us the probability of failure if we try to use the output of first synchronizer flop into any other flop in clk2 domain. However, if we add 1 more flop to capture the output of 1st sync flop, then net MTBF = MTBF1 * e^(tr2/tau) = e^(tr1/tau)/(t0*Fd*Fc) * e^(tr2/tau)

Thus MTBF for 2 flop synchronizer goes up exponentially by just adding 2nd stage. If we add n stages, and assume tr is same for all, then MTBF = e^(N*tr/tau)/(t0*Fd*Fc) 

So, if MTBF for 1 flop sync was A*e^6 sec, then MTBF for 2 flop sync is A*e^12 sec (i.e MTBF goes from 400 sec to 200K seconds).

So we almost always have a 2 stage synchronizer to transfer any signal from one clk to another clk. We may still have metastable signal at output of 2nd stage sync, but probability of that happening is so low (once in 10000 years or so), that we consider it as 0 probability event. There's still timing path from 1st flop to 2nd flop that may not meet timing (due to metastability). But we already know that and assume that probability of that timing not resolved within 1 period is very low. To further help us, we don't put any logic delay in this path, so that the whole cycle time is avilabe for the meta value to settle.

Transferring single signal from one clk to other clk:

We saw above that by having a 2 stage synchronizer, we can capture the signal and fan it out to all the logic in clk2 domain without any timing issues (i.e STA will time paths correctly). Is that all we need or is there something else that's needed? Let's explore.

When we transfer signals from 1 clk to other clk, our main objective is to preserve the shape of the signal waveform. i.e if signal was going from 0->1->1->0->0->1 in clk1 domain, then this exact waveform should be seen in clk2 domain. However, as saw above this is not always possible. There will be always be 1 cycle uncertainty in clk2 domain. Luckily this is not a problem as long as ALL the signal transitions are captured in clk2 domain. In other words, the signal intent should be maintained in clk2 domain - i.e if signal was supposed to be 0 in 1st clk, then 1 in the 2nd clk, then 1 in the 3rd clk (all in clk1 domain), then this exact sequence of 0->1->1 should be captured in clk2. NOTE: clk2 freq may be very diff than clk1 freq, so signal may need to be elongated in clk1 domain to make sure they are captured in clk2 domain. Let's look at 3 freq scenarios separately:

  1. Launch clk freq = Capture clk freq => Here depending on relative arrival time of capture clk, the signal may either get captured correctly every cycle of clk2, or may get missed every cycle, or may be a mix of the two.
  2. Launch clk freq > Capture clk freq => Here since capture clk is slower, few of the transition of signal in clk1 domain may get missed in clk2 domain.
  3. Launch clk freq < Capture clk freq => Here since capture clk is faster, all transitions of signal in clk1 domain will get captured correctly in clk2 domain.

These 3 scenarios are also shown at the bottom of the page in the link above. As we can see that signal in clk1 domain should be at least as long as 1 cycle of clk2, otherwise it may not get captured in clk2. However, even 1 cycle of clk2 is not enough, since there's some setup/hold time requirement. So, we need to add a "delta" margin. The requirement for signals transferred from clk1 to clk2 boils down to this:

Src signal length > (1 cycle of dest clk + ε)  where ε= delta margin. Usually we take it 1/2 a cycle of clk2 as "delta margin", so that it's easy for tools to verify it (as all sims/checkers etc are based on clk edges).

If we don't want to introduce half cycle paths, we can just have the signals crossing clk domains to be at least as wide as 2 cycles of destination clk. This works well in practice. We can achieve it in 2 ways:

  1. We know the freq of clk2 in advance from spec. We code the RTL so that the signal crossing into dest clk is held constant for that many cycles of clk1 as needed (i.e signal held stable for cycles=round(2*Tdest/Tsrc))
  2. However if the dest clk or src clk freq are not unique values, but may change based on settings, then above approach may not work. Or we may have to design cumbersome logic to take care of all the cases. In such cases, a feedback loop is employed where signal in clk1 domain is not allowed to change until clk2 domain acks that it received the signal. This is a very robust solution, as it guarantees that signal will be captured corretly no matter what. This is what is usually employed.

CDC rules for transferring single signal from one clk to other clk:

  1. The signal needs to go to a single synchronizer with at least 2 flops in the synchronizer. 1 flop synchronizer may also work for slow clk speed on capture side. There should be no logic in between the 2 flops of synchronizer so as to give full clk cycle to allow meta stable signal to settle down. The same signal can't go to more than 1 synchronizer in capture clk domain, as then the values in the synchronizer may be off by a clk cycle(due to 1 cycle uncertainty). This may cause same signal to have 2 different values at a given time, which is not what is RTL intended and will cause gate sim failures.
  2. The signal needs to be at least 1.5 clk cycle wide, so as to allow the signal to be captured on the receiving side. Most of the time feedback logic on receiving side sends an ACK signal back to the source indicating that the signal has been captured.
  3. There shouldn't be any combo logic on the data path crossing clk domain. This is because combo logic may cause short glitches, which may get captured by synchronizer of receiving clk domain, which may pass this incorrect pulse to all other logic on receiving side.

Transferring multiple signals from one clk to other clk:

Above we looked at transferring one signal from clk1 to clk2. An example of this would be an "interrupt" signals. As long as each of these interrupt signals got captured correctly, our function in clk2 will work fine. But let's assume that these multiple signals have relation between them, where we need to maintain that relation in clk2 domain. An ex of this would be a 2 bit binary counter counting from 0 to 3. The 2 bits cnt[1] and cnt[0] go from 00->01->10->11. If we have 2 stage synchronizers for each of them, then they may get time shifted by 1 cycle wrt each other depending on which got new value in next cycle while which got old value. This is shown in diagram below.

FIXME

The problem happened because here we needed to transfer a group of signals as 1 entity which needs to maintain the waveform relation amongst each other at all times. Separate synchronizers isn't going to solve this issue. So, we need to come up with other solutions. There are multiple solution as listed below:

  1. Combine signals: Combine multiple signals into one signal, and then transfer it. As an ex, if we have a 2 bit counter that we want to xfer from one clk to other clk, we can have counters in both clk domains, and then just use a signal called cntr_inc or something that goes high whenever the counter increments in clk1 domain. We can use this signal to increment counter in clk2 domain, and that way both counters will be in sync, without transferring the counter values from
  2. Gray Coding: Make only one of the signals toggle at a time, if it's possible to do so. Gray counters are an ex.
  3. MCP Formulation (aka load ctrl structure): Make a MCP (multi cycle path) formulation, as known as load-ctrl structure. Here we make a separate signal that acts as a ctrl signal for the set of signals that we want to pass across to other clk domain.
  4. Stabilize Using XOR: Wait for all signals to be stable before capturing them. In this technique we capture each signal independently thru independent synchronizers, but then we don't pass it on to subsequent logic. We generate an enable signal which is XOR of each synchronizer value (after the synchronizer, we put an extra flop to capture the toggle), and then we OR all these values. An OR value of 0 implies that there is no change occuring in any synchronizer, implying all of them are stable. So, in next cycle, we capture all of this data bus into a subsequent set of flops, and from here on the data values are passed to subsequent logic. This is very expensive technique. We needed 2 extra flops after the synchronizer for each data bit, on top of bunch of XOR/OR gates. Not used in practice.
  5. FIFO: Make a FIFO which will allow signals to be passed continuously without waiting for each of them to be consumed. We can think of a "MCP formulation" as a "1 deep" FIFO. If we put an extra flop, we can have a very simple "2 deep" FIFO. To make a "n deep" FIFO, we need complicated scheme. Here we need multiple ctrl signals (which are addr of FIFO which indicate next entry to be read or written). They all need to be synced. FIXME. Put a diagram.

 

CDC tools:

Spyglass was the most popular tool for CDC analysis.

RDC tools:

 

 

 

Eyes, Ears and Nose:

These are one of the vital parts of body, especially the eyes. Eyes re also the most fascinating organ.

Eyes:

Nice introductory video: https://www.youtube.com/watch?v=eySkNWTI03Q

Here's multiple diagrams showing internal parts of eye: https://kunnediagram.blogspot.com/2021/06/11-anatomy-of-human-eye-png.html

Main parts of Eyes:

  • Front: The front of the eye is cornea, the bulging part that you can see and feel. The black/brown circle that you see is called the Iris and is actually muscles that relax or contract. The color of the eye that we talk about is the color of the irs, as the color of these muscles depends on a color pigment. The Iris has a hole in the center which is called the pupil. If you look at someone's eye,you will see the big black/brown circle (Iris) and within it the smaller black circle (pupil). This hole is always black in color, as there's no light inside the hole. Just behind this hole is the lens of the eye. This lens is connected to ciliary muscles which change the shape of the lens to focus light rays on the back of our eyes, which is called the retina. The Sclera is the visible white part of the eye. The bulge in front of the iris is the cornea: sclera doesn't have this bulge, bulge is only for the part of the eye that is involved in vision.
  • Back: All of the back surface of the eyeball is retina where there are special light cells called rods and cones which get excited on receiving light rays. These rods/cones are connected to optic nerves, which take the signal from here to the brain for processing. The place where all the optic nerves from the eyes leaves the eyeball is called optic disc.There's no retina here, as that space is needed to bundle all the optic nerves and sendit out of the eyeball. As no picture is formed here, it's the blind spot of the eye. The brain finally makes an image, that remains well in our brain and in our thoughts. If the rays enetring the eyes don't converge exactly onto the retina, then the image will be blurred. It's the job of ciliary muscles to contract/expand to make sure light rays focus on the retina.
  • Liquid: The white thing that we seen in the front is small part of our eyeball. The space between the cornea and the lens is filled with a watery liquid called Aqueous humour. The space between the lens and the back of the eye is filled with a glassy kind of liquid called "Vitreous humour", which helps to maintain the shape of the eyeball.

 

Ears:

Nice introductory video (from Khan Academy, India): https://www.youtube.com/watch?v=98-6WfdumZY

Another video with 3D model of Middle Ear: https://www.youtube.com/watch?v=9fdO9x_Ej2M

Here's multiple diagrams showing internal parts of ear: https://www.researchgate.net/figure/shows-the-basic-anatomy-of-the-human-ear-It-consists-of-three-main-sections-the-outer_fig1_281726806

Main parts of Ears:

  • Outer Ear: The outside of the ear is called the outer ear. The opening in the ear leads to the eardrum.
  • Middle Ear: The eardrum is a very thin layer of skin, mostly translucent, and is called the tympanic membrane. Tympanic membrane needs to carry sound waves from the membrane to the internal ear, which is done via a connection of bones. There are 3 bones that connect this membrane to the inner ear. These are the 3 smallest bones in the human body, and are collectively called ossicles. The 3 bones are named Malleus, Incus and Stapes. Stapes amplify the sound vibrations from eardrum to inner ear by 20X. This is needed as there's liquid inside the inner ear to which it needs to transmit the vibrations. Liquids are denser and so it needs more forceful vibrations to get transmitted.
  • Inner Ear: The inner ear consists of 3 semicircular rings, which helps us with maintaining balance. It has nothing to do with hearing. Cochlea is another structure in inner ear, which is the main part associated with hearing. It has liquid inside it which receives the vibrations from the Stapes and transfers those as electrical signals via the auditory nerves which carry these sound signals to the brain.

There's a Eustachean tube in middle ear, which goes all the way to Pharynx, and has a opeing inside the nose. This means that any bacteria/mucus due to infection in upper nose, will get carried to the eardrum and can be seen from the outer ear when seen via enough light (as the ear drum is translucent). This is the ear infection that little kids generally have. It's frequent in kids but never happens in adults because this tube is small in kids, so it's easy for these bacteria to get carried all the way to the ears, but the long length of tube in adults prevents that from happening.

 

Nose:

Nice video: https://www.youtube.com/watch?v=e3gsndH9q1s

Dr John Campbell's video showing all parts from nose to throat: https://www.youtube.com/watch?v=IrZ3LZqrV7w