Category Archives: Technology/Software/

adb install over WiFi!

Quick tip for installing android apk files – On Developer options, enable adb debugging over network. You wouldn’t need to be rooted.


Use the following simple commands for adb install over WiFi or through an USB connection. WiFi just needs to be on the same network and doesn’t have to be over a Hot Spot between your phone and system.

sudo adb devices

sudo adb connect

sudo adb install -r <path to the apk on your PC>

Using -r in the install command will over write any previous installation of the same apk.



My Personal Guide to Intel Edison

Here’s my personal guide to setting up Intel Edison – I will be updating this guide as an when I work with Intel Edison. Please email me if you have any questions or need information regarding anything Edison. If you want to read the the guide in web layout, see here.

– thanks

understanding regular expressions to finite state machines

i recently came across a question on designing a state machine for detecting a binary string sequence. the solution to such a problem has two approaches. the very commonly followed approach is analyze the “given” sequence over and over again and try to scribble state transitions and test the patterns on it to check if breaks. i believe this is the way hardware engineers work this out, primarily because they spend some time which is considerably less than what they spend for other problems they analyse :) i say hi to “theory of relativity” here..

the second approach is to have rules to analyze such problems because they only consist of binary patterns (0s and 1s) and a rule based solution is like some kind of a program, so you don’t necessarily have to do much testing or alter, adjust your state machine as you try to solve the problem. the theory that deals with such kind of problems of pattern matching and sequence detection is the famous regular expression or the re. regular expressions can be analyzed as finite automata, or what can be called as our commonly known finite state machine.

so the best way to deal with such problems is to represent the sequence as a regular expression and just try converting it to finite state machine based on rules.

So some notations w.r.t re:

a* : an a* would mean 0 or more matches of the letter “a” followed by successive letters. for instance a*b matches “ab”, “aab”, “aaab” or just “b”.

a+ : an a+ would mean 1 or more matches of the letter “a” followed by successive letters. for instance a+b matches “ab”, “aab”, “aaaab” but will not match just b.

a? : an a? would mean 0 or 1 matches of the letter “a” followed by successive letters. for instance a?b matches “ab” or just “b” but will not match “aaab”.

the problem statement mentioned the sequence detection for the string 101011, which also meant that the state machine should be able to sustain 101010111 or a 111101011 as a match since both these string involve the string 101011.

Looking more closely at the sequence, a few points to notice.

a. match as many 1s preceding this sequence so that we end up matching 11101011, or 11111111010111 or 11111111111111101011. to put this in the basic atom terminology, we match (1+)01011.

b. match as many 10s preceding this sequence so that we end up matching 10101011 or 101010101011 … so we can end up consuming any number of 10s once we get past the first occurrence of 10. to put this in the basic atom terminology, we match (1+)0(10)+11

so that is pretty much translating problem into a regex string. The following slideshow will try to illustrate a method to translate a regular expression into a state machine. There might have been mistakes in my understanding and representation. Comment or e-mail me if you think there is something wrongly interpreted.


Emacs: macro within a macro

It has been around 4 years now that I am using Emacs and it feels awesome. You are an RTL engineer, probably you are no good to me without Emacs. Recently a friend of mine Anil Godasi (I call him the walking encyclopedia of HDL, you name the language he knows it and knows it __right__), asked me about an emacs query on how do we have nested macros on it. The answer was quite short, rename your last keyboard macro and you could call the macro as is. I am assuming he could not find it when he Google’d it and here is how we do it.

  1. Define the first macro
    C-x (
  2. Start your macro operations and finish defining the macro
    C-x )
  3. The macro is now defined, but then it is stored as the last-kbd-macro in emacs.
  4. So we rename the last-kbd-macro
    M-x name-last-kbd-macro
  5. Gives you a prompt to define the name for the macro as my-macro1
    Name last kbd macro : my-macro1
  6. Now get to defining the second macro and start your second macro.
  7. Call the first macro by
    M-x my-macro1
  8. Finish defining the second macro with a
    C-x )
  9. Execute the second macro with a
    C-x e
  10. This still calls the last macro and the last macro being defined was your second macro. You could still rename the second macro and call the nested macro in another third macro.


DDR Performance Evaluation and Design tips

I came across this article on on Design and Re-use. In my experience as a design engineer working with memory applications, for quite sometime I have been intrigued about how a DDR2 or a SDRAM Interface can be evaluated from a performance point of view. This month’s edition of Design And Re-use features something interesting about Performance Evaluation of DRAMs for Network on Chip applications. DDR Controller experts might see the content in the article as trivial but this is something which I could understand easily and is articulated very well.

Engineers who work on or want to work on DRAMs will really like reading this one. Apart from stressing the parameters for a DDR memory interface design, the article gives you an insight on how memory interfaces are tricky for bandwidth pressed designs. The article takes use an example of a Network On Chip(NoC) design to document how DDR memories are critical to such applications where huge amount of data buffering cannot be avoided as well as random access becomes absolutely necessary.

Quick Points I take back from the article

  • Skip banks rather than rows for efficient latency handling
  • Keep the moderate burst lengths, not too short or not too long. (4 to 8 )
  • Efficiency of an realistic DDR controller ranges from around 50% to 80% of the total bandwidth? So what does that mean? Run your Controller at 1.5x the frequency of your incoming data stream
  • Do not use a dumb slave model to quote performance numbers, use it as only a best case number which you will long to meet.
  • DDR Controllers are tricky to implement and a careless “design” can scrap your project for it is difficult to analyze exact behavior of slaves.
  • Have a Scheduler module before the Controller if possible, for not all real applications have data streams that are well-partitioned (arranged according to banks)



Documents are meant to be beautiful

I come across some really shitty documentations and some really nice document formats. Formats are important to documents, some might disagree that content matters more. But seriously aesthetics is what attracts you and what holds you on to something… That is why there are two words ugly and beautiful! So some documentation tips

  • A simple terse heading on the cover page with Author name, revision and date. — Just like one would not want to meet a crowd at once, one who not want showers of text information at the beginning of a page.
  • A small footer with Footer/Header in plain text colour, a slightly smaller font — It is the frame for the document Not a rough area to scribble tonnes of information
  • Insert a Table of Contents at the beginning of the document with Cross referencing
  • No Justified text for heavens sake, its like giving the reader a text to read on convex mirror
  • Use of inbuilt Heading formats
  • Do not increase indent as you go on with sub-headings. There is not point wasting so much indent space.
  • Bold Arial Headings and Regular TimesNewRoman(Arial) paragraph text
  • Use ‘captions’ options for Figures and Tables
  • Use Cross Referencing in paragraphs to point to Tables and Figures
  • Create inline diagrams. Do not insert .bmps or jpegs or cropped pictures.

Here is a document that I am maintaining for my usage, can be freely distributed and used. Git-SVN-Workflow and Moving to Git

Suggestions and more tips invited.


I used an utility on Linux some time back to demonstrate an application that I developed. “Anything that can go wrong, will go wrong” – Murphy’s law. And so, I did not want to have a live demonstration. Not that my app code is flaky, but things screw up at the demo, no matter how hard you try and hang your self upside down, it does nt matter. It just goes wrong..

So I used this utility to record the procedure for executing the app. And yes the presentation went really well. The utility is called RecordMyDesktop.

I tried documenting a small procedure on installing and using this app. Here is how.


Wassup !! .. get sup for yourself

This is one of my first posts on my blog, and I straightaway start with a technical blog on mail client called sup…

I had to switch to Gmail for obvious reasons like convenience and configured my office mail to my Gmail account. Meanwhile I ended up sending mails without even remembering to change the from-address to my official e-mail and came under a little suspicion by office management[i think so], and got a mail from my management saying, “whats-gmail-doing-in-here”[which had a connotation “scrap-it-use-office-mail-with-thunderbird”] But I liked the way Gmail organized mails, linking the mails with the subject lines, combining sent items with the received mails, “Labels” are an amazing feature.. and am not okay with having to ditch Gmail

One of my friends harsha (harshavardhana ranganath) came up with a suggestion to use the open source mail client .. ‘sup’. it is .. I, for my mis-fortune use CentOS, where not even a getting connected to ethernet automatically when the cable is plugged in, is easy….So i went through the feature list and decide to make a log of getting ‘sup’ on my CentOS machine.

Sup is basically an open source email client developed on the ruby platform. Some of the amazing features of sup is that it is light[command-line], it supports labeling, it maintains mails like Gmail linking mails on the basis of subject lines.

To install sup on an Ubuntu m/c [karmic is what i tried on]

>> sudo apt-get install sup

To install sup on a CentOS m/c you got to do some dancing and you have to be liking dancing for that matter :). We get ruby installed and then ruby gems follows.

>> sudo yum install ruby

>> sudo yum install ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc ruby-mysql

This doesn’t get you ruby gem though, and here is how you do that

>> sudo wget

>> tar xzvf rubygems-1.3.1.tgz

>> cd rubygems-1.3.1

>> ruby ./setup.rb

Gem installs and there you go with

>> sudo gem install sup

Now here is some thing where every other ruby installation post ends and says life’s good. It’s here you start with the errors.The following error is what popped and there has been a lot of rambling on this on the ruby forums.

Building native extensions.  This could take a while…

ERROR:  Error installing sup:

ERROR: Failed to build gem native extension.

rake RUBYARCHDIR=/usr/lib/ruby/gems/1.8/gems/xapian-full- RUBYLIBDIR=/usr/lib/ruby/gems/1.8/gems/xapian-full-

sh: rake: command not found

And it takes quite a “real” while..

With having installed gem, get rake for yourself

>> sudo gem install rake

Now start with installing sup all over again with

>> sudo gem install sup

Sup installed, errors don’t stop here. but all that starts well ends well..Invoke sup to get this error for yourself..

>> sup

./sup/keymap.rb:129:in `[]’: odd number of arguments for Hash


from ./sup/keymap.rb:129:in `run_hook’

from ../bin/sup:98

Now there is a patch to be applied. Patch available here


def self.run_hook global_keymap

–    modes = Hash[ { |klass,keymap| [Mode.make_name(,klass] }]

+    modes = Hash[* { |klass,keymap| [Mode.make_name(,klass] }]

locals = {

:modes => modes,

:global_keymap => global_keymap,

diff –git a/lib/sup/keymap.rb b/lib/sup/keymap.rb

index 93060b8..8d54924 100644

— a/lib/sup/keymap.rb

+++ b/lib/sup/keymap.rb

@@ -126,7 +126,7 @@ EOS

All you have to do is add an additional “*” character on line number 126.Once this is done, sup would still require something important. Adding the “ncursesw” utility.

>> sudo gem install ncursesw

So wassup… just

>> sup

to invoke sup :)