Saturday, January 17, 2009

From Python to Silicon

Salam 3lykum
Currently I'm trying to get a holdon hardware design using Python language with the aid of myHDL. The authors claim through their logo "From Python to Silicon" that you can use Python to design hardware directly or at least play a role in the design process author than the conventional role taken by a script language as Python, which is making scripts to automate recurring tasks such as compiling, simulating, etc. 

The path seems far from python to silicon but there is one to say the least. It is not like the path from Verilog/VHDL to silicon, which is the usual path, and it is not as smooth (H/W design is rarely smooth but we compare it to the conventional design flow) or as predictable, on the other hand the original path is not pleasant to start with. The advantage of using such high level (even when compared to C/C++) powerful language is the degree of abstraction and simplicity. In addition to the open source nature in the case of Python and the growing enthusiastic community behind it.

Python can be used for scripting in HDL design process, by myHDL adds two main features to it;
1) It can build a verification framework; powerful and simple to perform the tedious testing tasks.
2) More interestingly it can provide the actual hardware design that can be synthesized into silicon.
But as mentioned earlier this comes with a high price of extra effort in setting up the appropriate environment for developing, debugging and testing. Such environment can be found easily in the open source community (and freely as well). What is needed for this is:

1) Developing environment: Eclipse + PyDev.
2) Verilog HDL (HDL that I'm using) compiler and simulator: Icarus.
3) Wave viewer: GTKwave.

Furthermore, the way most literature explains how to program in Python is significantly different from the methodology used in H/W design, or even the way used by engineers (excluding software engineers). Although there is attempts to bridge the gap with the amazing efforts in SciPy, which tries to rise up to MATLABs' success.
On the bright side, I managed to set up this "tool chain" if we abuse the term and design simple shift register with myHDL. If Allah give me time to my next post, we will inshAllah describe how to set up the development environment and discuss the design strategy with Python.
Salam 3lykum

Tuesday, December 30, 2008

3omra pics

That was a quick come back don't you think, anyway I thought that I should put the pics fro 30mra here. It was the best experience I have ever had, ten days of hardwork just worshiping the creator of the earths and heavens that I hope Allah will accept them from me however minute they are compared to his blissing on me; the bliss of Islam, especially evident in a non-muslim country. The bliss of the Sunnah, again evident in an environment that are far from it. Those are the greatest of them all. May Allah guide me to the correct path and keep me firm on it.

Back to blogging

My last blog was in 10th of March 2008, and now its 29th of December, it's been a long time. Why so long? Well, it could have been lack of time to blog, lack of ideas to blog or even lack of motivation and interest. And I think all of them contributed in the long absence but the last reason contributed the most. Lack of motivation mainly comes  from insufficient energy to undertake such action, or even the perception that a certain level of effort shpould be invested in it.

I came to the conclusion that any project should be pursued in a pyramid fashion, i.e. layout a broad base first then narrow it to ultimately reach the objective, in other words divide it into layers. In blogging it seems that the layers are temporal, the blogging experience improves with time. So I will try to blog more often and broaden the issues in my blog. 

I will aim inshallah to use the blog as a tool again to document projects and activities carried out, and the procedure to followed. Allah almosta3an.

Monday, March 10, 2008

Signal Processing Insight

Signal processing is an interesting engineering and mathematical discipline. And it's rapidly invading many fields of engineering, science and even our daily lives. This may be attributed to the high level of mathematical abstraction since signals can be obtained from any source such as acoustic, seismic, medical , etc, which facilitates using signal processing as a vital tool to solve many problems in engineering and science.

To get a clear insight into signal processing we need to understand the title. A signal is simply a carrier of information whereas processing is the mathematical operations that the signal undergoes to achieve a certain task. This brief explanation conceals underneath it the reason why such operations are used in signal processing instead of others, e.g. Fourier analysis instead of Taylor expansion which is widely used in mechanics, which will be clarified later on.

As human beings we are interested in informations, varying informations to be more precise. For example a constant signal is not very informative since we can extract the level solely, as it is the case for a single sinusoid (having three constant parameters; amplitude, frequency and phase), a varying signal would carry more information to us such as AM or FM signal.

From mathematical point of view we have an infinite vector space of signal and we need a basis to describe such vector space. Such vector space must conform to our need to describe signal variations, an appropriate basis function would none other than the sinusoid, different frequencies represent different change rates, more formally this is the famous Fourier analysis. From engineering point view, signals with high variations in time consists of high frequency components and thus require high bandwidth.

But like everything in engineering there must be a compromise. The time-frequency representation is inversely promotional, i.e. a wide frequency support (high frequency resolution) results in a narrow time support, meaning when represent a signal accurately in the frequency domain yields a poor time representation. Do not despair, there is an alternative that ensures a satisfactory time-frequency trade off, this alternative is wavelets. Wavelets is a class of function that forms a basis to represent signals, wavelet functions can be tailored to the required time-frequency trade off in both resolutions. Wavelets are still mathematically intensive from practical point of view, it will be a while till the use of wavelet spread into applications or even replace the Fourier analysis in certain fields. Actually it depends on the theoretical improvement in simplifying the computation of (like the fast Fourier transform) and the advance in computational horse power.

Friday, March 7, 2008

The reason why?

The reason why I am blogging is purely of engineering nature contrasting the social motivation which is the primary reason of blogging popularity. Engineers look subjectively upon the tools they use to achieve a certain task, in the same way I use blogging as a tool to develop my ideas and thoughts into better more polished ones. From my MSc experience in Kings', I reached the convention that expressing theoretical and technical ideas leads to better understanding to such ideas. In my opinion the best way to polish such ideas is discussing them with peers and friends, but in the case of absence of peers or intellectual friends writing is the best alternative. It is obvious now why I'm resorting to writing. I'll attempt to write about topics with career engineering relevance. I hope that I achieve the goal behind this effort.