Digital Logic Design:

Here we'll cover some of the logic blocks that are used very frequently in RTL. We'll show code using Verilog. Some of the most common Logic elements are:

  • Logic Gates, flip-flops, i.e NAND, OR, LATCH, etc. These need a circuit diagram, and will be covered as analog part of digital
  • Clk gaters: These are also parrt of logic gates (available in librrary), but will be covered separately
  • Async Fifo => Very popular technique to transfer data from one clk domain to other clk domain

Asynchronous FIFO

This is such a popular interview topic and also a highly used component in design, that I'm having a separate section for this.

There are 2 very good papers on Async FIFO design by Clifford Cummings of SunBurst.

Add hand drawn diagrams

 

 

Version Control Software (VCS):

This refers to Version control (also known as Source Control, or Revision Control or Source Code manangement), where changes to a file or files is managed via a software called as "Version Control Software". In any modern software development, any program that we write goes thru changes over it's lifetime. If we didn't maintain a revision history of the changes, it would pose too many problems. Some of the common ones would be:

  • If the file accidently gets deleted or corrupted, our whole program is gone for ever, unless we kept backups. VCS. allows us to keep multiple backups at regular interval (either automated or manual).
  • With changes happening to our program, we want to keep a snapshot of changes, so that it's easy to revert to any previous state of the program. As an ex, if we have 5 files for a program, and we get it to work, we might want to keep a snapshot of this working program. Then we go ahead and make enhancements. If we create a bug, where the whole program now now refuses to even compile, one way is to debug it. But other easier way would be go to the snapshot and see what all changed. Or we can just restore the copy from snapshot and start from there. VCS allows us to do that.
  • With multiple people working on the same program, VCS allows us to easily merge all these changes in the central repository, without having to manually figure out all the changes and then integrating them.

Wiki: https://en.wikipedia.org/wiki/Version_control

Popular VCS are RCS, CVS, Git

Very good explanation of how VCS should work: https://tom.preston-werner.com/2009/05/19/the-git-parable.html

RCS:

 

VCS:

 

Git:

 

 

 

 

Force:

There are 4 fundamental forces or interactions in nature. All the motion that you see around us are due to forces. These forces may be friction, gravitation, push, etc. They ultimately belong to one of these 4 forces. It's easier to visualize these forces by considering a field, and then this field exerting forces. Force is always a vector as the effective force due to multiple forces is a vector sum of these forces. We are omitting the arrow sign on top of force for simplicity, but it should always be there to indicate it's a vector. The 4 fundamental forces or fields are:

  1. Gravitational force: This is attraction force due to mass of an object, and it's range is infinite. Newton's formula for gravitational force (published in 1686) gives us the formula for this:
    1. Newton's Gravitational Law: Force between 2 bodies of mass m1 and m2 as F = G*m1*m2/R^2, where G=Gravitational Constant of 6.674*10^-11 m^3/(kg*s^2). Here both F and R are vectors.
    2. Gravitation Field is defined as field due to presence of mass M and is given as g = F/m = G*M/R^2. The other mass is removed in eqn here, as F =m*g where g is the Gravitation Field due to mass M,
    3. The value of G wasn't determined at Newton's time. It was used to calculate forces relative to one another. It was in 1798 (>100 years later) that value of G was found out experimentally. It can be seen that this gravitational force is very weak (as G is a very small number), and is only relevant when at least one of the bodies is very large as moons, planets, stars, etc. What in the mass causes gravity or gravitational field is unknown. Even Newton hypothesized that cause of this power is unknown and contrary to sound science.
  2. Electromagnetic Force: This is the attractive or repulsive force due to charge. Look under "ElectroMagnetism" section.

 


 

Newtonian Laws:

3 of Newton's Laws shaped human advancement, as his 3 laws were revolutionary and considered one of the greatest scientific advancements. His book "Philosophiæ Naturalis Principia Mathematica", published in 1987 in Latin, contained his 3 laws. An excerpt of his laws from the original Latin and translated to English is here => https://www.gsjournal.net/Science-Journals/Communications-Mechanics%20/%20Electrodynamics/Download/4537

Below are Newton's 3 laws, directly translated from his original book.

  1. First law: Law of Inertia => Every body perseveres in its state of rest, or of uniform motion in a right line, unless it is compelled to change that state by forces impressed thereon.
  2. Second law: Force and momentum => The alteration of motion is ever proportional to the motive force impressed; and is made in the direction of the right line in which that force is impressed. We write it as F=m*a, but in reality it's F=d/dt(m*v) or Force is equal to mass times rate of change of momentum.
  3. Third law: Action and Reaction: To every action there is always opposed an equal reaction; or the mutual actions of two bodies upon each other are always equal, and directed to contrary parts. Most important thing to note is that the 2 forces of action and reaction are acting on 2 different bodies.

 

Ex of force/work => To get an idea of how much 1N of force is, consider a 100g weight that you carry on your hand. That is 1N of force that you are applying to counteract earth's gravitational force. Now if you lift it up by 1m, that's 1J of work that you did. So, 1N of force and 1J of force look like very small amounts, as your body doesn't feel any tiredness doing this.

 

Pressure: Pressure is Force per unit area. i.e P = F/A. SI unit of P is Pascal (Pa) which is 1N/m^2. 1 N is the force equiv to holding 100g of weight. This doesn't sound like too much weight. Now if we spread this weight over 1m^2, that's almost negligible Pressure. 100g of weight over 100cm*100cm = 0.01g/cm^2 of weight is 1 Pa. It's more convenient to use 1kPa (1 kilo pascal) or 1 bar (=100 kPa). 1kPa is 10g/cm^2, while 1 bar is 1kg/cm^2. Atmospheric pressure due to air is measured in atm (atmospheric pressure), where pressure at sea level is defined as 1 atm=101,325 Pa, which is ~1 bar (To be precise, 1 atm is slightly greater than 1 bar). Pressure is also measured in inches/mm of Mercury (Hg) where pressure at sea level = 760mm = 29.9 inches (approximated to 30 inches) = 1 atm pressure.

In USA, pressure is measured in pounds of force per square inch (psi)—for example, in car tires. 1 lb=453.6g => 1 lb force = 453.6g*9.8N/kg = 4.445N. So 1 psi = 4.45N/(0.0254)^2=6897.5N/m^2 = 6.9kPa. => 1 bar = 100/6.9=14.5 psi. So, 1 atm=14.7 psi. Pressure readings in excess of atmospheric pressure are usually more relevant in measurements, so we use psig (pounds per square inch gauge) in such cases. PSIG is measured relative to atm pressure, i.e 1 PSIG = 1 PSI - 14.7, so at sea level PSIG =0. PSI measures pressure relative to vacuum.

Barometer: Barometers are used to measure pressure. We take a tube closed at end end, and fill it with liquid as Mercury or water. Now, if we invert and immerse it in container of same liquid, then liquid inside the tube will rise until the point where pressure due to weight of liquid (+ any air/vapor pressure inside the tube in the empty space above the liquid) inside is same as pressure due to air outside. Mercury rises to 760 mm (or 2.5 ft), while water rises to 34 ft (since Hg is ~13,6 times denser than water). P = h*ρ*g.

In pressure gauges (usually in HVAC applications), pressure is usually shown as PSIG. In a barometer, if the air inside the tube is at atm pressure, then the mercury level will be at 0 inside the tube. But if the air inside the tube is in perfect vacuum, then the mercury will rise to 30 inches. We take these readings inverted to indicate relative pressure and indicate it as inch Hg Pressure, So a pressure reading of "0 in Hg" means the pressure is same as atmospheric pressure, while a "-30 in Hg" pressure means absolute 0 pressure. These can also be shown in bar as "0 bar" for 1 atm pressure and "-1 bar" for absolute 0 pressure. However, showing these on linear scale is hard, because we can never go to 0 vacuum. We keep on going down by a factor of 10 or something infinitely. So, a log scale is preferred in many gauges, where very precise measurement is required.

Micron unit: Since pressure becomes very low close to vacuum, we use another unit called micron in pressure gauges to indicate very low level of pressures. 1 mm Hg of pressure is divided into 1000 parts called microns. So, 1 micron pressure = 0.001 mm of Hg pressure.  At 1kPa (or 0.01 bar), water boils at 10C. We usually try to get to this vacuum level, when we want to get rid of moisture in any system (as at this pressure, liquid water will get converted to steam, and get sucked out via vacuum pump). 100 kPa = 760 mm of Hg, so 1kPa=7.6mm Hg or 7600 micron. As a thumb rule, going to 1% of atm pressure starts the process of water to boil at room temp. People in HVAC industry accept a pressure of 1000 micron or lower in order to guarantee that no water is present in the evacuated system. Usually 500 micros or lower is what people shoot for when vacuuming an HVAC system. These kind of low pressures can only be read by "micron gauge", which are very expensive ($200 for branded ones)

1 Pascal = 7 micron of Hg (implying 1 micron is extremely low pressure, since 1 Pascal is already too low of pressure)

1000 micron = 1 mm of Hg pressure = 0.02 psi

100K micron = 100 mm of Hg pressure = 2 psi or 0.1 atm (this is the highest pressure that a micron gauge will read, since it's designed to read vacuum pressure and NOT high pressure)

Link => https://vacaero.com/information-resources/vacuum-pump-technology-education-and-training/633-understanding-vacuum-measurement-units.html

Manometer: These are similar to Barometer, and are used to measure pressure of gases. Manometers are used in measuring blood pressure using device called a sphygmomanometer (Greek sphygmos = “pulse”).

 


 

Passive Elements = Resistors, Capacitors, Inductors

Almost all the matter around us has the 3 passive elements built as intrinsic part of that matter. These 3 elements are Resistors, Capacitors, Inductors. They arise due to physical properties of resistance, capacitance and Inductance that gives rise to these 3 passive elements respectively.

Resistance:

Ohm's Law ad resistivity:

Conductivity of a material is defined by ohm's law as: J = σ*E where J=current density=I/A (I=current, A=Area), σ = conductivity of material and E=Electric field thru that material.

Resistivity (ρ) = 1/σ = inverse of conductivity.

For a material with uniform cross section A and length L, E=V/L (In a medium with no source/sink point, electric field is constant. It it weren't, charges would start accumulating at the point where electric fields are different)

=> I/A = σ*V/L

=> Resistance R = V/I = ρ*L/A => This is the classic Ohm's law that is stated in books, but it applies only to special case of homogeneous material with uniform cross section.

Units of ρ are Ω-m. The value of ρ comes by experimentally measuring it for different materials. Metals are good conductors and have lower ρ.

Cu=1.7*10^-8 ohm-m (Cu less resistive than Al and used in most conductors now, including wires on chip)

Al=2.6*10^-8 ohm-m

Resistivity is also written in units of ohm-mm^2/m, so Cu resistivity is 17 mΩ-mm^2/m => For a wire with area=1mm^2, Resistance is 17mΩ/m. Or for 1km of 1mm thick wire, Resistance is 17Ω. Gauge (AWG) is used in transmission wires to specify the thickness and current carrying capacity of wire (see in Power Transmission section).

Mobility of electron:

Other term used in connection with resistivity is mobility. Looking at atomic level, we see that any conductor has free flowing electrons which are moving randomly in all directions. When we apply a n Electric field, these electrons experience F = q*E and start accelerating as per Newton's law. They hit the atom lattice, and scatter off and lose some of their energy. Then it again starts accelerating in same direction, and this process continues. The final result is that the electron moves with a finite average velocity, called the drift velocity. This causes an electric current in the direction of the Electric Field. This motion is lot smaller than normally occurring random motion.

F= m*a=e*E (where m is mass of electron, e is it's charge)

Avg drift velocity (Vd) = a/τ = e*E/(m*τ) where τ=mean free time (i.e avg time between collisions).

So, Vd = -μ*E, where μ=e*/(m*τ) and is known as mobility of electron. SI unit of mobility is m^2/(V.sec) but is almost always expressed in cm^2/(V.sec)

I = -n*(A*L)*e/t = -n*(A*L)*e/(L/Vd) = -n*(A*L)*e*Vd (n=electron density per unit volume, Length L of distance covered in time t)

J=I/A = -n*e*Vd = -(-n*e*μ*E) =  n*e*μ*E

From Ohm's law J = σ*E  => σ = n*e*μ

So, conductivity of any material is related to the mobility of electron in that conductor as well as the concentration of free electrons. That is why different metals with same number of free electrons may have different resistivity as electron mobility might be different between them, depending on the lattice scattering. Thus electron mobility depends on following:

  • Lattice structure: Depending on the lattice structure, scattering (or collision) may occur sooner, which will cause lower electron mobility.
  • Velocity saturation for electrons may occur. Electrons don't keep going faster and faster with increasing Electric field. At some point, sufficiently high drift velocity is reached, and velocity maxes out. This is called Velocity Saturation (vsat). vsat is on the order of 1×107 cm/s for both electrons and holes in Si. It is on the order of 6×106 cm/s for Ge. So, basically μ starts decreasing as velocity sat approaches, and finally goes to very low values.
  • Temperature affects electron mobility => With increasing temperature, phonon concentration increases and causes increased scattering, thus lowering the carrier mobility. In semi Conductors (Si, Ge), μ ∝ 1/T^2.  The power to T isn't exactly but varies based on material and whether it's electrons or holes. So, conductivity is supposed to decrease with increasing Temperature (as mobility decreases), but at the same time, carrier concentration may increase due to higher Temperature (true for semiconductors)

Typical electron mobility at room temperature (300 K) in metals like gold, Cu, Silver is 30–50 cm2/ (V⋅s). Carrier mobility in semiconductors is doping dependent. In Silicon (Si) the electron mobility is of the order of 1,000, while in germanium it's around 4,000.

Determine ρ of Cu using mobility:

1 mole of Cu has weight = 64g =>  1 atom of Cu has weight = 64g/(6.02*10^23 ) = 10^-22 g.

Density(Cu)=9g/cm^3 => # of atoms in 1cm^3 = 9g/(10^-22) = 10^23 atoms. Assume 1 free electron per Cu atoms

σ = n*e*μ = 10^23*1.6*10^-19*40 cm2/ (V⋅s) = 0.6*10^6 => ρ = 1/σ = 1.6 * 10^-6 ohm-cm = 1.6*10^-8 ohm-m, which matches closely to the ρ shown above (1.7*10^-8 ohm-m)

 

Capacitance:

Capacitance of a material is defined by gauss's law.

We saw insulators above which don't conduct electrons that well (i.e electrons drift very slowly in response to Electric field). Within insulators, we have a subset of materials which will get polarized when an Electric field is applied. This is called permittivity of the material. The electrons in such materials don't drift, but instead just shift slightly causing an internal Electric field. Such materials are called dielectric. A perfect dielectric is a material with zero electrical conductivity.

Dielectrics: https://en.wikipedia.org/wiki/Dielectric

Atomic level: Every material is made up of atoms. Atoms contain a =ve proton and -ve electrons around it. In presence of electric field, the charge is distorted slightly with electrons moving in the opposite direction to the direction of electric field. In insulator type materials (called as dielectric), these electrons don't flow from one end to other, but instead shift just slightly. This creates a dipole for each atom (think of it as separated +ve and -ve charges at 2 ends with some distance b/w them). When the electric field is removed, the atom returns to its original state. This shift of electrons from their average equilibrium positions, causes dielectric polarisation and creates an internal electric field that reduces the overall field within the dielectric itself (the applied electric field minus the dielectric polarisation induced Electric field). This tendency to polarize is referred to as the permittivity of the material, an is expressed as:

D (displacement field) = ε . E (electric field) where ε is the permittivity of material. Vacuum has a permittivity of ε0

 

A material with high permittivity polarizes more in response to an applied electric field than a material with low permittivity, thereby storing more energy in the material.