# Prepared by: Syed Saad Ahmed 2012 LECTURE 4

What is memory? What is the role of memory in the computer? Some those people computer is new to them they are many confused of many things, operating system, computer hard ware, computer software and computer language etc. Actually sometimes we call software and we call programming languages and we call packages, but there is a difference, like MATLAB is a package it not a language.

Packages and tools:
Many packages and tools are available to stimulate electronics circuit and other problems and these tools are based on some programming language. Packages are very different and they are very simple because we have a manual of the package and with the help of manual we can perform our simulation.

Computer simulation:
What is computer simulation? Simulations are computer aided programs (CAD tools). The real experiments are very difficult and expensive so we use CAD tools, with the help of computer instead of art we can design better, like we can write mathematical equation so we can manipulate mathematical equation and we can write a program in that way and we can put all the idealities and non idealities in the program. And of course our simulation result very close to ideal it s not real and if we go to real world that is different. If you have an equation F=ma and I write the program whenever I put the m and a I ll get F .If I want to calculate it in a real way then I ll get little bit error. So this is the difference of the real world and simulation. Nowadays we use simulation program because we have many software available whose simulations are very close to the real experiments. We can t go to the lab every time of course we want to calculate thousands of experiments, if we want to go more than this, if we want to go for histogram, if we want to plot graphs then it is very hard for us to do the real experiments so most of the time we have to go for computer simulation. If we want to build a big building if we really build a big building it will take a year or two, lots of money but if I go to computer simulation then we can build it we say it is our office building, 25 floors one cafeteria one base etc. That s software are available in the architecture designing. In Civil Engineering lots of software available and same thing is in the Chemical Engineering.

Use of MATLAB and C Language:
Actually when you see MATLAB most of the programs in C language and MATLAB are similar, MATLAB based on many Mathematical formulae, we can plot a graph, we have many geometrical shapes, we have all types of diagrams, we can do a lot of stuff, we can resolve many problems so it is better in that way but when we solve some logical problem no formula is available just a logic so most of the time we use C language not MATLAB. But when we have to solve by any kind of formula then MATLAB is available. 1|P a ge

Prepared by: Syed Saad Ahmed 2012
The main essence of this course is that how we use any program to resolve our problem. If we want to make a very good tool in chemical Engineering so we have to talk to someone who has knowledge of programming but he should have knowledge of Chemical Engineering as well, because we know the non ideality, linearity, non linearity. What is the difference between the linearity and non linearity? Because most of the things have non linearity and non linearity we can t calculate with the help of formula. In non linearity most of the thing it is not like that if we increase one thing the other thing will be increased this is not the case sometimes we increase a thing the other thing will go up and then decrease it will be a curve may be ellipse, may be other diagram or anything.
6 5 4 3 2 1 0 0 2 4 6 8

In this graph y is increasing with an increase in x axis and then decrease this graph has non linearity but the thing is that we have to write a program on that. This graph is a probability distribution graph. Simulation programs based on the real values, once we get the real value then we can make a program so than we don t need to repeat that experiment we can change the date and get the results, by this we can save a lot of money and a lot of time most of the research articles based on the computer simulation programs. We have high level language and low level language, high language is C, C++ and visual basic but in low level we have addition, Subtraction, multiplication and division of binary language. We don t need to learn low level language this the work of computer engineer and electronic engineer then we can use some kind of compiler in between so it can compile the instruction and convert it into the machine language. We can t run our computer without operating system, operating system based on some language, like UNIX is based on C language someone wrote the operating system in C language, C language is very powerful language. BELL laboratory the research laboratory in America invented C language and UNIX as well and it is very popular now. The other two languages are VHDL (Very high speed Hardware Description Language) and VERILOG.

VHDL:
In VHDL we can write some gates (and, or and not etc) when we write a program we don t need to go to the lab and use the gate in the real way, we can just write the program. In that way if we have millions of gates we can write into the language that is the advantage. Let s say I have a circuit and I have millions of gates if I go to the lab and I want to do the experiment then it is very difficult so what can I 2|P a ge

Prepared by: Syed Saad Ahmed 2012
do, I can write a program in the VHDL. If I know one AND gate then I can copy and paste thousands of time. Then we can simulate the program and we can see the result, so VHDL is the hardware language and very similar to C language, C language is not for hardware. If we are familiar to C language then we can easily handle the VHDL. Those kinds of circuits are available now that I can write program in VHDL and then I can download or burn this program in the chip, I can download or burn the software program in the hardware, it safe time and money. But the problem is that it is expensive. After using we can erase it like EEPROM (Electrically Erasable Programmable Read Only Memory). (19.00) In the base of logic we write a program

Reducing the size of the circuit and program:
All the time we have to reduce the size. If I have a circuit of one thousand gates and I know the way to reduce to 100 gates it is simple and better than the previous design. It doesn t matter if the code is very lengthy because we are doing this for simulation. Suppose we have a function below: F= B+AB There are four gates in this function. If I want to reduce this gates then what can I do? F= B+AB F= B ( +A) F=B (1) F=B

It shows that we don t need any gate we can directly connect with B. So with the help of simplification you can reduce the hardware and once we reduce the hardware we would never use the software. If we are writing any Chemical engineering program, first of all we have to simplify it. If it is not simplified then it is very complicated. We have to know which term we can remove, which term we no need to count or we can erase it then you need to write a program because long program is not a good thing, long program will make you a poor programmer.

3|P a ge