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

 

 

Brain:

Brain is the most vital part of your body. Your brain defines who you are. All other organs of your body may be replaced by artificial equivalent, and you will still remain "you", as long as your brain is not replaced.

Good video showing internals of brsain with a model: https://www.youtube.com/watch?v=xQ6-e0sF7Yk

 

FPGA = Field Programmable Gate Array

As an electrical engineer, you should try to learn "How to build a digital circuit on FPGA". FPGA are compact chip, that have millions of gates on it. You can build any custom digital logic with FPGA. FPGA are an essential device for any Electrical Engineer to have fun with.

If you are a VLSI designer, you probably know how to write RTL in Verilog. In an FPGA too, we write RTL, and then the tools that come with FPGA, build a custom digital circuit based off that RTL. This allows us to quickly test our digital circuit, as well as build prototypes, without going thru expensive time consuming process of having a fab fabricate your digital design. FPGA also allow you to learn how to code in Verilog, and test your logic without writing any testbenches. Nowadays, FPGA have millions of gates on them, which you can use to make a full blown microprocessor on an FPGA.

One good video series on FPGA by DigiKey (total 12 videos): https://www.youtube.com/playlist?list=PLEBQazB0HUyT1WmMONxRZn9NmQ_9CIKhb

Early FPGA started in 1983 with Altera and then with Xilinx in 1985. Later Actel and Lattice Semiconductor joined the FPGA race. Xilinx was later bought by AMD, Altera was bought by Intel while Actel was bought by Microsemi, which was itself bought by MicroChip Tech. By 2015, Xilinx (50%), Altera (35%) and Actel (10%) and Lattice (3%) captured almost all of the FPGA market. As of 2020, 100's of millions of gates are being put on a single FPGA chip in 5nm nodes, with FPGA revenue exceeding $8B. FPGA are being increasingly used in low end embedded devices, and expected to grow at a CAGR of 10%.

Main FPGA product lines of these 3 companies are:

  1. Xilinx: They provide low cost Spartan family (made in higher nm tech as 28nm), as well as high perf Virtex family (made in lower nm tech as 16nm as of 2020). They have multiple generations, with Xilinx 7 series introduced in 2010, which is the most popular one.
    1. Spartan: Spartan family is the oldest and lowest cost FPGA. Spartan 7 intoduced in 2017 lacks high BW transceivers.
    2. Artix: Artix family is similar to Spartan, as it's low cost. However, Artix-7 have high BW transceivers, and that's what we'll be using for our training.
    3. Kinetx: Kinetix family delivers mid range performance at much lower cost than Virtex.
    4. Virtex: Virtex family is most advanced and highest performance. Several gen from Virtex-E to Virtex UltraScale+. It has lot of prebuilt logic for commonly used functions as multiplication, etc to improve performance.
    5. Zynq: Zynq 7000 were developed as SoC (System on chip). Zynq-7000 integrate a complete ARM Cortex A9 MPCore-processor-based 28 nm system. It made FPGA processor centric, which could boot at start up, and load OS.
  2. Altera:
    1. Startix: Startix series were Alter'a highest BW devices with up to 1 Million logic elements.
  3. Altec: Actel's portfolio of FPGAs is based on two types of technologies:
    1. Antifuse-based FPGAs: Axcelerator, SX-A, eX, and MX families
    2. Flash-based FPGAs:  Fusion, PolarFire, IGLOO, and ProASIC3 families

 


 

Training on Digilent BASYS3 Board with Artix 7 FPGA using Xilinx Vivado Tools:

"Digilent BASYS3 Board" is the recommended Board for Introductory users wanting to learn FPGA basics. It has Xilinx "Artix 7 FPGA" chip on it. I have this Board, and all my tutorials are based off it.

Buying the Board. ouple of options:

Steps on Linux OS (Ubuntu Cinnamon 22.04.2 LTS) for Installing Vivado 2023.1:

  1. Once you have the Board, download and install Vivldo from Xilinx website. You will need to make an AMD a/c (as Xilinx is now part of AMD). Provide your personal details accurately for Export Control Requirements. Once you do that, you can download any of the 3 "Vivalo ML edition" provided. The self extracting option for Window/Linux are more suitable, since they don't require huge files to be downloaded in 1 go. The 3rd option of downloading tar.gz file has 110G of file to be downloaded, which errors out almost all the time after downloading part of the file. Details here => https://digilent.com/reference/programmable-logic/guides/installing-vivado-and-vitis. Steps are:
    1. Download AMD Linux bin file => https://www.xilinx.com/support/download.html. Since we are doing it on Linux, we'll choose 3rd from top which is "Linux Self Extracting Web installer" => Xilinx_Unified_2023.1_0507_1903_Lin64.bin (~265 MB)
    2. Open a Linux Terminal and Go to Dir where Installer was downloaded. Most likely in /home/<user/Downloads dir. Run these 3 cmds:
      1. sudo apt install libtinfo5 libncurses5 => We need to install these 2, else we get stuck at "Generating installed device list" later during installation. Thread: https://support.xilinx.com/s/article/63794?language=en_US
      2. chmod +x Xilinx_Unified_2023.1_0507_1903_Lin64.bin;
      3. sudo ./Xilinx_Unified_2023.1_0507_1903_Lin64.bin
    3. A new gui will appear which will guide thru installation process. Enter amd login/password. Choose "Vivado" as "Product to install" and NOT "Vitis", as "Vitis" is too large. Choose "Vivado 2023.1 ML free Edition". This takes up abot 40GB of space. It will go thru 3 step process of downloading a 20GB file, installing and then "Final processing for device". Downloading a 20GB filw will easily take an hour, installing is couple of minutes, and Final processsing is also a few minutes. It will get stuck on final processing if we haven't done step 2.1 above. If it does get stuck, cancel,then run this on any terminal (sudo apt install libtinfo5 libncurses5), and then reexecute the binary (step 2.3). Once installation is done, the software will be installed in /tools/Xilinx/Vivado dir.
  2. Once Vivado software is installed, install cable drivers (need only for Linux0 as it doesn't come with the drivers. Run below cmds on terminal
    1. cd /tools/Xilinx/Vivado/2023.1/data/xicom/cable_drivers/lin64/install_script/install_drivers
    2. ./install_drivers => This should show "INFO: Driver installation successful." at the end, along with a warning. Ignore the warning.
  3. Install Digilent's Board files.
    1. Download from github: https://github.com/Digilent/vivado-boards/archive/master.zip
    2. Go to the dir where downloaded, and Extract it by right clicking on file (in Files window, NOt on terminal). It will extract files.
    3. On terminal. run cmd => cp -rf /home/kagrawal/Downloads/vivado-boards-master/new/board_files  /tools/Xilinx/Vivado/2023.1/data/boards/board_files => This copies all files.
    4. sudo chmod -R 777 /tools/Xilinx/ => For now set all permissions to all subdir and files for Vivado.That way, we avoid getting "Permission denied' errors later. Or you can login as root as shown below in step 4.1.
  4. Launch Vivado. Follow the instructions provided here: https://digilent.com/reference/programmable-logic/guides/getting-started-with-vivado
    1. Open a terminal, and login as root (may not be needed if all permissions are set up for all vivado dir) : sudo -i => logs in as root
    2. mkdir /home/<user>/Vivado_training
    3. cd /home/<user>/Vivado_training
    4. source /tools/Xilinx/Vivado/2023.1/settings64.sh (Or can also use dot space (i.e . ) instead of source to execute)
    5. vivado => (use sudo vivado if you aren't logged in as root). This will launch Vivado. If it shows error as "permission denied", then you need to login as root. Vivado gui will open up. Choose Tasks->Open Hardware manager. It will show "Hardware Manager" as not connected on the new pop up.
    6. Now connect your FPGA to your laptop via the USB cable provided. Flip SW16 on Digilent Board (switch near the mini usb cable). It should turn lights on, and will start counting from 0000 to 9999. "Hardware Manager" will show Digilent Board name. So, everything working at this point. Few Troubleshooting Tips:
      1. If Board doesn't power on, it may be due to power switch jumper on top left (JP2) not set to usb. Make sure the bottom 2 pins of the 3 pins are connected via jumper. If the top 2 pin of jumper re connected, that imples that the power is coming from an external source, which is not true in our case. We are powering via micro USB.
      2. If Programming our own verilog code, we have 3 options via switch jumper on top right (JP1) = QSPI, JTAG (via micro usb) and USB (which is not micro usb, but regular USB right next to JP1). We'll user jumper to connect middle 2 pins of JP1 that will allow us to use JTAG for programming.
  5. Now we can try a new project. Follow instructions on link above to create a new project.
    1. There are many videos on xilix website with all code provided.

 

 


 

Project 1 on designing a simple inverter to flip LED:

The simplest circuit that you can build on an FPGA is a simple inverter. There's a very good series on this. Just follow the instruction to get the implement the inverter to flip switches.

Series of Videos to by "ENGRTUTOR Channel"=> https://www.youtube.com/@ENGRTUTOR

Basically, this is what you do in above project is this:

  • Connect an inverter between 2 pins of FPGA. One input pin of FPGA is connected to the switch, while other output pin of FPGA is connected to the LED. We implement an inverter in FPGA and connect it b/w these 2 pins. Now, the output will be inverse of the input. So, when switch is turned on (i.e connected to 3.3V supply or binary 1), the LED turns off (or binary 0), and vice versa.

Follow below 4 videos for FPGA tutorial (The project is using Vivado 2020, but we are using Vivado 2023, so not everything on GUI of below videos will be the same as yours, but that doesn't matter, it will still work):

 


 

Project 2 on designing a MicroBlaze Processor and run C programs on it:

The most advanced circuit that you can build on an FPGA is a microcontroller. It's very satisfying to be able to build a processor and run C program on it.

AMD's MicroBlaze Microcontroller is provided with Xilinx repository. It has all the Verilog code that you can look at and then synthesize it and generate a bitstream. Then compile a simple C program, and run it on FPGA on this MicroBlaze processor. Really easy and fun.

There's a good series on this on youtube Channel (drselim) => https://www.youtube.com/playlist?list=PLbFgDf51ZkCEJb9MvxKIs-0q2obouwf-f

This playlist has videos starting with an adder, mux and then then going on with Micro Blaze Micro controller, with the last tutorial on VGA connector.

There's also a video on Xilinx website for building MicroBlaze Microcontroller on FPGA => https://www.xilinx.com/video/software/microblaze-quickstart-video.html

 


 

 

Auto Buying:

You can buy a car at any car dealership in USA. The biggest question is which car to buy and how to get the lowest price for it.

1. Which Car to buy:

Time and again, Japanese cars have proved to be very reliable in long run. I've Toyota and Honda, and both have run for 10 years without requiring any fix except changing Tires, batteries once in 1st 10 years and oil/filter change every year. Few popular cars are:

  • Mini Compact cars: These are the smallest cars. Chevy Spark falls in this category, and is usually the cheapest car.
  • Sub Compact cars: These are the smallest cars right after Mini Compact. Hyundai Accent is a very reliable car here. Even though it's Korean car, it is at par with Japanese cars.
  • Compact Cars: Compact cars and above are called Sedans and they can still seat 5 very comfortably. Hond Civic and Toyota Corolla are the best cars in this category.
  • Mid size cars: These cars are bigger than Compact cars. Honda Accord and Toyota Camry are best options here. People with kids usually opt for mid size cars over Compact cars as they have more legroom, bigger trunk, and are more comfortable with 5 people in the car.
  • Minivans: If you have a family of 4 or more, there's nothing more convenient than a minivan. It can seat 7 or 8 people. Most popular minivans are Honda Odyssey (seats 7 or 8 depending on the model) and Toyota Sienna (seats 7)

 

2. What to pay:

This is a harder problem, as what is a good price to pay. We need to buy car at a price, where if we try to sell the car te next day, we shouldn't incur a loss. That would be the ideal price to pay, but may not always be possible yo buy a car at that price. I look at used car price for a given model, and year, on various websites, and then that becomes the baseline for the price of that car. Any new car that you buy for that model and year should be close to that price include all tax, licensing fees, etc.

My go to site is www.truecar.com. You can use this to check price of used car, and then compare of new car on different websites as www.edmunds.com, www.kbb.com and www.truecar.com.

 

Auto Renting:

You always have the option of renting a car. Many times it's a necessity, i.e when you are flying to a different city, you would need to rent a car.  buy a car at any car dea

awk:

awk is the widely used utility for text manipulation in text based files. It can do a lot of complicated pattern matching, stripping, etc that will require bunch of code in any other scripting language. awk and sed are very commonly used together and almost suffice for 99.9% of text manipulation encountered in real life.

awk is a full scripting languages, though it's most suited for text manipulation. awk was named after the initials of the people who wrote it. Now we have the GNU implementation of awk called gawk. gawk is the one that is installed on all Linux systems, and awk actually is a soft link to gawk.

$ awk --version => shows "GNU Awk 4.0.2"

Good tutorial on awk: https://www.howtogeek.com/562941/how-to-use-the-awk-command-on-linux/

Syntax:

awk syntax is extremely simple. The entire awk program is enclosed in single quotes ('). It has rules, comprised of patterns and actions.

  • Patterns: Patterns are enclosed in curly braces { }. If no pattern is provided, then it works on every line of text since all lines match.
  • Action: Action is executed on text that matches the patterns.
  • Rule: Together, a pattern and an action form a rule. 
  • Fields: Fields are separate regions within a line. We define fields since that's the only way we can extract certain data within a piece of text. By default, awk considers a field to be a string of characters surrounded by whitespace, the start of a line, or the end of a line. Fields are identified by a dollar sign ($) and a number. So, $1 represents the first field, $2 the 2nd field, and $NF the last field (NF stands for number of fields). $0 represents the full line from start to end. If we want to change the input field separator to something else, we should use option -F (separator string) option to tell awk to use that (i.e -F: uses colon (:) as the separator to figure out fields for input file). NOTE: no space b/w -F and : Also, this -F option is before we we write the pgm in quotes. ex: awk -F: '{print $2}'. We can also write awk 'FS=":" {print $2}' => This also does the same thing as FS means i/p field separator.
  • awk works on an input text file and can show output on screen using "print" function, or redirect the output to another file. Just as input file has fields, o/p file also has field separator which is a space by default. To change the separator to something else, we use option OFS=":" (output field separator is a :). This option is to be used within quotes (i.e as part of the awk pgm). ex: awk 'OFS=":" {print $1}'. This OFS applies to only those print statements that are following that OFS.

Few more awk cmd:

  • print: print function prints strings by enclosing in double quotes, i.e print "my name is". To print var, we don't need quotes. ex: {print "my name is"} {print $name}. or in one as {print "my name is", $name}. If $name is put within quotes, then it's treated as a literal, and is printed as is =>"my name is $name". comma is optional, however we put as it automatically invokes a space. See below ex:
    • print specific field of certain cmd:
      • ls -al | awk '{print "3rd field" $3}' => This takes the o/p of ls -al cmd and prints "3rd field" followed by the third field of each line, which is the userid of the owner. With no comma, there is no space b/w field and $3. To invoke space either add a space within the text as "3rd field " or add a comma.
      • awk '{print $1 $4}' input.txt => This prints field 1 and field 4 of each line in file input.txt. However, the printed fields will have no space b/w them, so they will appear as one word. The output field separator is invoked on putting a comma, i.e {print $1,$4}. To change it to something else, use OFS=":". i.e awk 'OFS=":" {print $1 $4}' input.txt
    • convert field to number: When we get certain field from a file, let's say $3, it's still grepped a sa string. So, if we try to use that number outside of awk, it will error, complaining it's not numeric. In such cases, add 0 to the field to automatically convert it to number.
      • set num1 = `zgrep "Number" *.report.rpt.gz  | awk -F" " '{print $5+0}'; set sum = `echo "$num1 + $num2" | bc -l` => In this, if we just use "print $5" without adding a 0, then that field is returned as a string. Adding it with num2 gives an error. But if we add 0, then num1 automatically is cast to integer/float and and then summing works.
  • BEGIN/END rules: A BEGIN rule is executed once before any text processing starts. In fact, it’s executed before awk even reads any text. An END rule is executed after all processing has completed. You can have multiple BEGIN and END rules, and they’ll execute in order. We can have as many lines of cmd as we want in BEGIN and END by enclosing them in {}, and they will execute only once in begin and end of awk program.
  • awk as script: We can also write a full script in awk, especially when pgm gets big. # are comments. First line needs to be #!/usr/bin/awk -f. See the ex on link above.

Few examples of awk:

  • pattern matching and conditions: We an add specific conditions:
    • awk -F: 'BEGIN {print "START"; FS="/"; OFS=":"} $3 >= 1000 {print $1,$6} END {print "DONE"}' /etc/passwd => This prints 1st and 6th entries only if 3rd entry is >= 1000.
    • awk '/^UUID/ {print $1}' /etc/fstab => This searches for pattern UUID at start of line, and all lines that have that, have their first field printed.
    • To extract all lines between given markers => This is very common use case, where we want to use scripts to grep for text b/w markers:
      • awk '/## START OF MARKER ##/{a=1}/## END OF MARKER ##/{print;a=0}' /home/my.rpt > ~/extracted_marker.txt => extracted_marker.txt has all text b/w "START" and "END". "a" is just a var (can be any var name). CMD "print" is optional, as by default print happens.
      • awk '/## START OF MARKER ##/{flag=1} flag; /## END OF MARKER ##/{flag=0}' /home/my.rpt > ~/extracted_marker.txt => alternative way of above cmd. The line "flag" prints lines while flag is set. This is a shortcut of this cmd => {if (flag==1) print}

 

Substitute text between specific Markers with contents from another file: This is not easy. We saw how to do this in sed. But that sed cmd doesn't work in any other shell besides bash. So, we have an alternative way in awk cmd, that achieves this functionality.

awk 'BEGIN {flag=0;} /START of pattern/,/END of pattern/ { if (flag == 0) { system("cat replacement.txt"); flag=1} next } 1' original_file.txt > modified_file.txt => Here we grep for markers in original_file.txt and replace all the text b/w those markers (including the markers themselves) with text in replacement.txt. We save the resulting modified file as modified_file.txt (instead of saving as original_file.txt)

However, if are patterns are stored in var, or the file names are var, then we have to get those var outside of single quotes (As anything inside single quote is for awk to evaluate). When we put in double quote, then shell expands it, and then awk just concatenates that when running the cmd.

ex: awk 'BEGIN {flag=0;} /## START OF '"$pat1"' ##/,/## END OF '"$pat2"' ##/ { if (flag == 0) { system("cat /home/'"$name"'_replacement.txt"); flag=1} next } 1' original_file.txt > modified_file.txt