Raspberry 4:

This is the latest and most powerful raspberry pi, released in 2019. It's also known as Raspberry Pi 4B (there is no Raspberry Pi 4A). There are three current Raspberry Pi 4 models that are identical, except for the amount of RAM. Cheapest one at 2GB ram, next one at 4GB ram, and highest performing one at 8GB. Even the 2GB one is powerful enough to work as a desktop. 4GB version suffices for almost any application, as Raspbian OS is very memory efficient, and never exceeds 4GB even with bunch of tabs and processes running. It is powered by a new processor, the Broadcom BCM2711B0, which is built in 28nm, and is based on ARM Cortex-A72 core, instead of earlier ARM Cortex A53 core. it has 4 CPU and clock speed of 1.5GHz. It also has a GPU from Broadcom called VideoCore VI, running at 500MHz.

Installation:

To use Raspberry pi, you will need to raspbian as explained in previous "Raspberry" section. Then you install vncserveer for raspbian, so that you can work on the raspberry w/o having a monitor and keyboard. Once vncserver is running, you access raspberry pi using vncviewer from some other laptop. Now you can start working on this great little machine.

Getting started:

Open a terminal, and type "pinout" cmd. This gives info on all the pins on the header that can be used for our purpose.

Setup time  and Hold time:

Any logic you design from RTL, you will always hear about setup time and hold time, when running timing tools. Sequential elements such as flops and latches have setup and hold time requirements, in order to function correctly.Let's explore this important concept.

Origin of setup and hold time:

In broader terms, any circuit that stores value has a back to back inverter or some other back to back gates to hold the value. However such a circuit is not of much use, unless we can control the value that's stored in this back to back inverter. This is done via a signal to enable or disable the write, and another signal which transmits the value to be written into. This signal which enables or disables the write has a timing relation wrt to the signal that we are trying to write in. The value to be written in has to be stable around the time, the enable/disable signal changes, or else we may not store the desired value. This time window where we want our input signal to be stable is called setup time and hold time.

Setup time: The time before the enable signal that the input signal has to be stable

Hold time: The time after the enable signal that the input signal has to be stable

 The sum of "setup_time + hold_time" is the window where the input signal shouldn't change, or else the value stored in the seq element would be unpredictable.

This link does a superb job of explaining them:

https://www.edn.com/understanding-the-basics-of-setup-and-hold-time/

Setup and hold time in circuit paths:

We understand the setup/hold time of flops/latches, etc. But let's say we have a path from 1 flop to other flop. The 2nd flop can't have it's data change within it's setup/hold window.

Let's see a simple 2 bit counter. Violating setup time (too slow) or hold time (too fast) causes counter to have incorrect values as shown in the diagram.

Attach diagram FIXME

Eqn is:

That's why the 0 cycle path is called the hold timing for the path, as "hold time" of the capturing flop is involved in the eqn. Being a 0 cycle path, the freq of the clk has no impact on whether the path meets the "hold time". So, these paths are independent of freq.

Similarly 1 cycle path is called the setup timing for the path, as "setup time" of the capturing flop is involved in the eqn. Being a 1 cycle path, the freq of the clk will impact on whether the path meets the "setup time". So, these paths are dependent on freq, and setup time of the path can be fixed by relaxing the clk freq.

 

Timing Tools applying setup and hold time:

In PT and other timing tools, single cycle paths are easy to analyze. Usually paths are from flop to flop. So, most of the designs have 0 cycle hold paths and 1 cycle setup paths. When we have multiple clks with diff freq, then relationship gets more complex. Discuss MCP, and how setup/hold are calculated by timing tools

 

 

 

 

Deep Learning

Most of the material here is from Andrew Ng's AI course on couesera.org. It's called Deep Learning specialization. Even though it's called Deep Learning, it starts with basic concepts of AI, and then moves to ML, ANN and finally to CNN. It consists of 5 courses as outlined in link below:

https://www.coursera.org/specializations/deep-learning

The 5 courses in deep learning specialization are as follows:

Course 1: Neural Networks and Deep Learning: => Has 4 weeks worth of material, requiring about 20 hrs to complete.

Course 2: Hyperparameter tuning, Regularization and Optimization => Has 3 weeks worth of material, requiring about 18 hrs to complete.

Course 3: Structuring ML projects => Has 2 weeks worth of material, requiring about 5 hrs to complete.

Course 4: Convolutional Neural Networks (CNN) => Has 4 weeks worth of material, requiring about 20 hrs to complete. CNN is the most popular NN

Course 5: Sequence models => Has 3 weeks worth of material, requiring about 15 hrs to complete.

More AI related reserach and info is available on https://www.deeplearning.ai/

Before we go into the course work, we have to get prepared for doing exercises in Python. Without doing exercises and playing around, you will never get a feel of AI. AI is a very fast field, and we will never be able to learn even a little fraction of it, but whatever we learn, we should make sure we learn the basics well.

Installation of Python and various modules:

Below are some of the pgm you will need to install on your computer, before you can do any exercises on coursera. Ofcourse they have Jupyter Notebook for you to work in (Jupyter Notebook migrated to Coursera Lab environment starting Sept, 2020). Jupyter Notebook is an app that allows you to run python and many other pgm languages from within it. However, you may not be able to understand all bits and pieces of how things are working. Also, as these keep changing on Coursera website (i.e you are at the mercy of coursera on how long they continue with which app), I highly encourage you to install python and other needed modules on your local machine (running any Linux OS, I'm running it on CentOS 7), and do all the programming exercises locally. It'll be much more fun. I'm doing it locally myself, so will post all needed info below.

Python: Visit the section under Python programming. Install Python3 (python 3.6 as of July, 2020) as detailed in that section, and then install these other modules.

NumPy: Install NumPy package for python as detailed there, and go thru the basic tutorial

H5py: Install H5py package for python which is used to read data files in HDF5 format. This format is used for our exercises to store large amounts of data.

matplotlib: Install matplotlib module for python and go thru tutorials as explained in that section

PIL: Install Pillow module for python, which we'll use widely for reading images, as compared to matplotlib and scipy. See PIL/Pillow section.

Downloading various local functions and datasets:

There are many functions and datasets that you will see being imported in python pgms on coursera. You do not see them on main notebook page. One way to see all the files being used in python pgm is to go to Jupyter Notebook, and click on File->open on the top of the page. This will take you to a new page, which will show all the folders and files for that programming assignment. There is a "download" button on top, so download all the files that you need (one file at a time, if you try to download multiple files, the download button disappears)


 

 

Machine Learning (ML):

ML is a particular subset of AI. ML itself has many branches. One such particular algorithmic approach of machine learning is called artificial neural networks (ANN) which was loosely based on how human brains work. In this section, we'll learn very basic concepts of ML.

 

 

 

Maths:

This section deals with basic maths.

I've divided Maths section into multiple parts. I'll mostly be discussing maths curriculum as it's organized in USA schools and universities. USA schools have grades from Kindergarten (KG) to Grade1 (i.e class 1 in India) to Grade 12 (i.e class 12 in India). Then after grade 12, you go to colleges of your choice.

Best place to learn school level Maths is from www.khanacademy.org

It's free as it's non profit, and has videos which are very easy for kids to understand. It's one of the best resources for any educative material.

Then there is this wonderful fun website to learn everything related to Maths: https://www.mathsisfun.com/

One more website with lots of free sample exercise and theory is: https://www.math-only-math.com/

Other website similar to math-only-math with lots of practice questions is: https://www.mathopolis.com/questions/course.php

Interesting Maths Questions:

This is a list of very elegant Maths question, kind of which don't require anything more than elementary or basic high school Maths. These are the types asked in Maths Olympiad:

  • Finding radius of a semicircle inside a right angled triangle: https://www.youtube.com/watch?v=_o79ngJ0TI4
    • Soln: on link above
  • Find the number of distinct pairs of integers (x,y) such that 0<x<y √1984 = √x + √y.
    • Soln: 1984=16*4*31. So, √1984 = 8*√31. So,  8*√31 =  √x + √y => 8*√31-√x = √y => sq both sides => 1984 - x - 16√(31*x) = y => 16√(31*x) = 1984 - x - y => So, RHS is integer as all numbers are integers, so, LHS also need to be an itger. That means (31*x) needs to be a perfect sq root. => x=31*a^2 where a is an integer. Possible values of a=1,2,
    • x=31,31*4,31*9,31*16,31*25,31*36,31*49 => √x=1*√31,2*√31,3*√31,4*√31,5*√31,6*√31,7*√31
    • y=31*49,31*36,31*25,31*16,31*9,31*4,31 =>  √y=7*√31,6*√31,5*√31,4*√31,3*√31,2*√31,1*√31
  • Elementary School Q:
    • Averages: Find the avg speed of a person who drives from Austin to Dallas at a speed of 40mph and drives back at 60 mph. It's not 50mph as avg speed = total distance/ total time. Avg of total is not the avg of partials. Answer = 48mph.
    • Area: given area of circle is pi*R^2, could you find the circumference. Or given Circumference=2*pi*R, find formula for it's area. Trick is to cut circle into small triangles (From the center to the edge forming a very narrow isosceles triangle), and make a rectangle out of it, the length of which is pi*R and width is R, so area=L*W=pi*R*R=pi*R^2 
  • Middle School Q:
    • The eqn of straight line is y=mx+c. So why is x=a a straight line, as it doesn't fit the straight line eqn. Answer => It does fit straight line eqn if we take m=-c/a (-ve sign since slope is b/w points (0,c) and (a,0) which gives (c-0)/(0-a)=c/-a). Now we substitute for m, and then take limit of c approaching to ∞. We get x=a. The problem of why it doesn't seem to fit the eqn is because both m and c are ∞.
    • 2 cars at s distance of 200 miles, travel towards each other, one at 40mph and the other at 60mph. A bid travels at 50mph starts from the 1st car, flies towards the 2nd car, as soon as it touches 2nd car, it flies back to 1st car and so on, until the cars collide.What is the total distance covered by the bird? => It's total time * speed of bird = 50mph*2hr = 100 miles
  • High School Q: This appeared as Problem 25 in AMC 8, 2015. I've generalized it as follows: Given a sq of length n, one cuts squares of length "m" from each corner. What's the max square that can be fit in remaining area?
    • There are various ways to solve it. the question is not hard. However, there is one solution which is a one line solution and really smart. See link:
    • Solution 2 (Contest Soln) is the smartest way to solve it. Area will be n*(n-2*m). To convince ourselves, we can also solve it other way, where we find the ratio of sides of the 2 similar triangles that will form the side of the new square that can fit in. Once we find the ratios, it's easy to solve. But this will be a longer soln.

  

Modulo questions:

Modulo questions are very popular in Maths olympiad, because they involve applying a new trick to solve such problems. A very interesting set of modulo questions is finding "n mod m" where n and m are some integers. You have to apply some basic pattern finding skill to solve such problems. These are easier, and that is why I'll tackle these :)

ex: Find 2^101 mod 5 => Here we try to find repeating pattern. Let's try few values of n=1,2,3,....

n 2^n ones digit 2^n mod 5
1 2 2 2
2 4 4 4
3 8 8 3
4 16 6 1
5 32 2 2
6 64 4 4
7 128 8 3
8 256 6 1

From above table, we see that ones digit can only be 2,4,8,6. Since mod 5 will only depend on ones digit, we can ignore other digits as tens, hundreds, etc. The ones digit follows a pattern as follows:

For any whole number k=0,1,2,3...

when n=4k (i.e n=4,8,12,...) => ones digit=6, so 2^n mod 5 = 1 (exclude k=0)

when n=4k+1 (i.e n=1,5,9,...) => ones digit=2, so 2^n mod 5 = 2

when n=4k+2 (i.e n=2,6,10,...) => ones digit=4, so 2^n mod 5 = 4

when n=4k+3 (i.e n=3,7,11,...) => ones digit=8, so 2^n mod 5 = 3

Since 101 is of form 4k+1 => 2^101 mod 5 = 2

 


 

Interesting Maths Tricks:

Some of these tricks will look like magic even to sophisticated Maths folks. A lot of them here: https://puzzling.stackexchange.com

  • A five card trick (aka Fitch Cheney trick): Alice and Bob perform a magic as a team. Alice shuffled a pack of cards, and then asked someone from Audience (Charlie) to pick 5 cards out of this pack.  Charlie looks at 5 cards and returns the 5 cards back to Alice. Alice hands over 4 cards to Bob, and 1 card back to Charlie. Bob looks at the 4 cards, looks at Charlie and then is able to tell which card Cjharlie is holding. This looks impossible, as there are 52 random cards, and figuring 1 out of 48 based on 4 cards is just insane. However, the trick is in arranging the 4 cards in a pattern, and then using that pattern to figure out the 5th card. To narrow down the choice to 1 unique card, Alice also uses fixed algo to decide which card to return back. This all works out to give a unique card that is always returned back. Details here: https://puzzling.stackexchange.com/questions/6569/a-five-card-trick-how-does-it-work