# About

Hi! I’m Ashwith and I’m an engineer from Bangalore who loves working on little projects. I have my own mini lab at home where I spend time working on simple circuits. My main goal is to use these to write tutorials for others to learn – especially in cases where information has been hard to find or the existing resources took me a lot of effort to understand.

I worked for two years at Cortina Systems as a design verification engineer. I have been involved in three successful tapeouts. I worked on networking chips and was involved in both testbench development (module level as well as full chip) and test case development – up to the point of code and functional coverage.

I’ve completed my bachelor’s degree in engineering at BMSCE, Bangalore in the field of Electronics and Communication. I’m now hoping to pursue a Master’s degree and continue with my passion for analog desgin.

When I’m not playing around with circuits or writing code in C, FORTRAN, Verilog, Assembly, VB.NET(etc…. etc…), you’ll find me playing my guitar, playing NFS, Age of Empires or simply chatting with friends.ย Do stick around and check out the projects I’m working on (and other stuff) :-). If you need more “professional” info, you can fine me on Linkedin at in.linkedin.com/in/ashwith/

**Disclaimer :**

Although I have tested my projects to work as I have stated, I take no responsibility for any direct, indirect, incidental, consequential, or exemplary damages due to any of my blog posts. The software, code, circuits or any sort of information posted on this blog comes with no warranty.

**License**

All my work is, unless otherwise stated, covered by the following Creative Commons License. **This is only for my** **work.** In cases where I have borrowed others’ ideas, I have explicitly said so in my posts and the rights are with the original creators.

This work by Ashwith Jerome Rego is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Wassup man….wat an awesome site….keep it up…

Good one man……

Thanks ๐

use ccsa license mate aka creative commons share alike

nice blog

you rock!

I want to start with line follower.What should i buy and from whre can i buy?.Help me.

I have a project that helps make a very simple line follower: https://ashwith.wordpress.com/2010/03/16/the-simplest-line-follower/

I’m not sure where you can buy the components. If you live in Bangalore, go to Om Electronics, SP Road. If you are from Mumbai, go to Lamington road. Tons of shops in that place. You could also search for any online stores but I think the prices will be higher there.

Hello Sir, I had tried the first and beginning circuit of VI-diode one, But I am facing some problem related to schematic output, there is no waveform generated in gwave when I try to generate through gspiceUI. Please help me out, as I am new to both Linux and gEDA. Thanks

Could you list the sequence of steps you followed? I did have problems with gspiceUI because I missed out one tiny detail. I wrote the tutorial only for demonstration. If you don’t

have touse a GUI interface, I would suggest just going to the “Simulating Circuits in the CLI” tutorial.Hey Ashwith,

I used your Fortran code for finding determinant of matrix as a function in my main program. I would like to reference your work to show that it is not mine but I don’t know how to do that in this case. Can you please supply my with a suitable reference of/to you to include in my report?

Thanks in advance.

Is this for the “references” part of your report? Just put my name “Ashwith Rego”, add my email D as ashwith@ieee.org and put the URL to the dreamincode page. Probably “FORTRAN 90: Determinant of a Matrix by Ashwith Rego (ashwith@ieee.org) at http://www.dreamincode.net/code/snippet1273.htm” That should be fine I guess. I didn’t think about licenses/citations back then.

Does that code work properly BTW? I knew very little Fortran when I wrote it (forgotten most of it now because I couldn’t find any use of it for me). My code for matrix inversion has bugs. Was wondering about this one. No one has commented on it yet.

Yeah it works perfectly. I have probably tested about 20 sample matrices with online calculators and it holds up everytime. If you still have some knowledge on the Algorithm, then can you please take me through the steps? I tried for over half an hour to follow it but so many loops inside loops that I get lost. Thanks by the way for the response.

The algorithm I use is pretty standard. It’s called Gauss elimination http://en.wikipedia.org/wiki/Gaussian_elimination. You could look up any book on Linear Algebra if you need to know more.

The idea is that I use Gauss elimination to reduce the matrix to upper triangular form. The determinant of a triangular matrix is simply the product of the diagonal elements. Another key idea is that row operation will not change the value of the determinant.

Gauss elimination is quite straight forward for the most part. You start with the first row and subtract the correct multiple of that first row from each of the rows below it so that the first column of each row below R1 contains a zero. You then proceed to row 2 and make column 2 of all rows below it 0 and so on. There are some details you’ll need to be careful about (what do you do when you wanted to make column 1 of R2 zero but column 2 became zero as well? You need to do a row exchange in this case and change the sign of the determinant if needed. The best way to do this is by exchanging it with a row which has the largest “pivot”. Look at the wikipedia article to see what pivot means).

Hope this helps you understand the code. Do let me know if you still need help.

Yes I am very familiar with linear algebra but not so much with the coding. I know the technique you used in and out, but I ment like the actual coding is confusing.

do k=1, n-1

if (matrix(k,k).eq.0) then

DetExists = .False.

do i= k+1, n

if (matrix(i,k) /= 0) then

do j=1, n

temp = matrix (i,j)

matrix(i,j)= matrix (k,j)

matrix(k,j)= temp

end do

DetExists = .True.

l=-1

exit

end if

end do

if (DetExists.eqv. .false.) then

Calculate = 0

return

end if

end if

do j= k+1, n

m =matrix(j,k)/matrix(k,k)

do i = k+1, n

matrix (j,i) = matrix (j,i) – m*(matrix(k,i))

end do

I am trying to explain the actual programming grammar used (ex. why it says if (detexits eqv.failse) then calculate =0 ) starting from the first line (do k=1 n-1) and as I proceed down it gets confusing because of the loops inside loops.

I’ve added comments to describe my code in more detail and hosted it on a github repo. You can download it there:

https://github.com/ashwith/workspace/blob/master/fortran/det.f90

Let me know if I’ve been unclear anywhere.

I also think I discovered a possible bug. The comments will tell you what I’m talking about out. Please do have a look at that as well.

Wow I cannot thank you enough. Now the loops do not seem so complicated once they are explained like this.

Glad I could help! ๐

Again, do be mindful of that possible bug. Unfortunately I don’t have time to come up with a matrix that will hit this error case. You’ll need to check if the routine works when a row is exchanged after skipping a row (like exchange R2 with R4). I think in such a case the determinant’s sign shouldn’t change. My code seems to be changing the sign without looking at this detail.

That’s the test case you’ll need to check. You’ll need to work backwards and come up with the matrix. Let me know if the routine fails for this case. I know what to change.

Hey, Hi Ashwith this is Deep here, actually I am working on Designing Two stage CMOS operational amplifier, i had already referred to your ngspice tutorial, although for bit of more assessment I am currently working on HSPICE, can you let me know the usage of tool if possible? I am great need man, Kindly buzz me at my mail if it possible for you..

Thanks Cheers ๐

Hi Deep,

Unfortunately I’ve never touched HSPICE. If you need help with SPICE code, I can try to help but I’ve no clue about Synopsis’ tools. They are quite expensive and my college bought licenses after our batch finished engineering.

All the best!

Yes that even works fine Ashwith, If you can help me with how to design that particular specification using SPICE, I mean Modelling the same, I can implement same logic on HSPICE as that tool is very similar to SPICE implementations. Just send me your mail id if it’s okay with you, I will mail my design to you, and that way you can set me up with how to design the same.

Thanks man,

You’re Saviour if you help me out in this ๐

Sure. Email me at ashwith@ieee.org. I can’t promise I’ll be able to help but I will try my best (I’ll be able to reply only on Tuesday. I’m a bit busy this weekend).

Hi Ashwith nice blog… I am Sandeep and i am trying to model LDMOS in NGSPICE.. I want to add a voltage controlled resistor at the drain side of simple mos.. ie a mos followed by a VCR at drain side.

I want output and transfer characteristics however i successfully implemented transfer chars(Keeping drain constant and varying gate (.dc analysis)), now i want output chars but when i add VCR at drain end and do dc analysis at vds it i giving me error…

Any help relating how can i add a VCR at drain end and do .dc analysis for o/p chars will be very helpful..You can mail me on my id also it is sulakhe.sandip@gmail.com

Thanks and regards..

I’m sorry but your question is Greek and Latin to me ๐ฆ I’m no expert in Analog design (but I hope to do my masters in it). I’m approving your comment hoping that someone who knows what you’re talking about can help.

Sorry for the really late reply. I’ve been (and still am) really busy.