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

Before FPGA came, PAL (programmable logic array) were used widely widely as they built as memory with programmability added by fusing wires. This kept it cheap, ad was easy to understand by users. FPGA were remarkable departture from the PALs. FPGA were nothing like memory, but instead were built like other logic with Look up Tables, Flops, etc. Early FPGA started in 1983 with Altera and then with Xilinx in 1985. Xilinx was the one that really took FPGA mainstream. Later Actel and Lattice Semiconductor joined the FPGA race. Xilinx was later bought by AMD in 2022, Altera was bought by Intel in 2015, 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%.

Real Success of FPGA came in 1990's as transistors started scaling fast. PALs weren't able to scale, while FPGA scaled, and their cost started coming down, with more and more logic on a smaller silicon. Earlier FPGA suffered from very low yields (1st one had only 1 chip out of 25 chips working from the one wafer that was fabricated). This was due to FPGA having a large die which resulted in very low yield in 1980's. As size of die started coming down, yields improved exponentially.

UPDATE 2025: Intel sold 51% of Altera to SilverLake to free up cash, valuig the company at $9B, almost 40% below what it paid 10 yrs back. For 2024, Altera made revenue of $1.5B,  non-GAAP gross margin was $769 million and non-GAAP operating income was $35 million. As can be seen, it's high money losing business.

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.

 

Vivado Tips:

  • To access the pin layout, click on layout on top corner and then IO  planning, doing this also lets you access ports and set pins for them 

 


 

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

 


 

My notes:

 

 

Car buying / renting / License:

 


 

Driver's License:

Before we talk about buying/renting, let's get to know the process of getting a drivers License (DL). I'll be talking about steps to get DL in Texas. Rules may vary from state to state, but general process remains similar.

Teen Driver's License: 

In Texas, a teen b/w the age of 15 and until his 18th B'day, can apply for a teen Learners License. This is a License that your teen can get easily by passing an online test (a quiz). Then he can start learning how to drive with an adult in the front seat of car all the time. The great news is that you can add the teen to your auto insurance as being on "Learner's License or Learners Permit", with no impact to the rates. The teen can also decide to get a real DL later on, for which he has to give a real driving test. But then, your auto insurance rates will go up a lot, as teen's auto insurance rates are easily $200-$300 per month, when driving by himself/herself.

DPS Link on how to apply for learner's permit => https://www.dps.texas.gov/section/driver-license/texas-learners-license-teen

Steps:

  1. Order PTDE (Parent Taught Driver Education) pkt from TDLR. IT costs $20. It's 1st page has receipt number that you'll need when applying for license => https://www.tdlr.texas.gov/ParentTaught/PTSelect.aspx
  2. Now go and buy "Online Driver Education" program. Here's a list of TDLR approved courses. They don't list the rates upfront, so you need to click on each of them, to find the rates. 
    1. Link from TDLR => www.tdlr.texas.gov/driver/education/providers/search/
    2. One of the cheapest ones for $45 is here => https://www.easytexasdriversed.com/texas/course/parent-taught-drivers-ed-14-17
    3. Other one that I ordered is $50 here => https://ptde.smartwaydriving.com/
  3. These courses have Total 24 hours of online training material. You need to complete module 1 for the 1st 6 hours of online training. Then you are eligible to take the written exam, which is also administered online as part of that pkg (Make sure your pkg says that it has online test included. Most of them do).
  4. Once you have passed the online quiz in step 3, you need to take all supporting documents to DPS to get your teen's Learner's permit.

 


 

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.  Renting a car usually costs $20-$40 per day (as of 2025). Sometimes you can get cars for < $10 per day, as I've seen happen a lot at expedia, when renting from an airport location. However, it appears to be random, on when it shows up.

 


 

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

 


 

 

 

 

College Admissions:

Things that you should get into to get into a good college:

The first thing that any college admissions officer wants to see when looking at extracurriculars is that a student sticks with the activities they choose. Devoting oneself to one club and one sports team is far more impressive than trying a new club and a new sports team every year. This shows that a student is able to stick to something and wants to perfect skills and lessons.

The next things that a college admissions officer looks for are passion. In any application, a student should make sure that they explain what they love about the extracurricular activities they chose during their high school years.

The final thing that every college admissions officer looks for is leadership. This is key. Above all, a student should look to assume a leadership role at some point in the extracurriculars they pursue. Through time, leadership roles should be highly possible and will look fantastic on any college application.