Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Notes on Simulation and GHDL

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to comment

  • Be the first to like this

Notes on Simulation and GHDL

  1. 1. ∗ Notes on GHDL and Simulation Dilawar Singh Email : dilawars@iitb.ac.in Version 1.0 January 18, 2011 “To leave error unrefuted is to encourage intellectual immorality.“ Karl Marx. quoted in ’The Poverty Of Theory’ by E. P. Thompson. The only Western Historian who could think beyond the nation of Atlantis.SimulationAn engineer should be able to not only correct an error but also locate them.Simulation is mostly used for these two puposes. Failure in detecting errorscould be very costly. Later you detect it, costlier it gets. Intel has witnessed itonce. It may be not a matter of life an death but surely it can throw a mid-sizedesign house out of business. Big corporations can survive but it costs a lot. Aminor FDIV bug in Intel Pentium processor cost $500 million. After you have implemented your design as per given ’specifications’, firsttask is to test whether it is giving what was expected (verification). Whiledesigning, one might have taken clues from on one’s common sense in additionto what one knows for sure. Simulation protect you from this common sense(or intuitions), same way mathematics protect natural sciences from commonsenses of humans which by the way hardly have anything in common 1 . Studyingsocial sciences is beset with ills. There is no protection from ’common sense’.No wonder, two economists seldom agree on anything. Verification of design (mostly done using Simulation) is a big fraction oftoday’s total design activities and consumes about 60-80% time. In VHDL, youwill create ’test benches’2 to test your design against certain set of test inputs.For all these possible inputs, if output satisfies given ’truth table’ (or behavioraldescription) then the design is said to be correct. One should test his/designfor all possible input combinations which is not possible for large enough input ∗ These notes have nothing to do with your course content. Usual disclaimer of ’I am notresponsible for any damages caused etc. etc’ applies. 1 As far as common sense is concerned, it make sense asking whether an electron is a waveor a particle. For mathematics, this question in itself is absurd. An electron is what itsequation implies, nothing less, yet could be more than that. 2 While using ghdl you have to write test-bench in VHDL only, in Modelsim you haveanother option called do files 1
  2. 2. ports. On top of it, one should be able to catch error as early as possible forcost grows exponentially with design stages. If design is found faulty at laterstages, you might loose your job (or get transfered if in government job). In anycase, it will be a blot on your claim to be an engineer. Simulation’s present is bright, future is surely bleak 3 . VLSI has grown upin size tremendously. A modern chip has many input combinations that onecan possibly be tested in reasonable amount of time even though computer runfaster than Chacha Cahudhary’s brain. To overcome this, what one generallydoes is to break a large design into smaller one (decomposition) and simulatesmaller parts. Most of simulation is done for moderate size components likeadder, multiplexer etc. There have been tremendous growth in the area of formal verification (youcan google it if you like) but you can not do away with simulation, at leastfor next 6-7 decades. Reduced Binary decision diagrams (RBDD) and KripkeStructures are very prominent tools these days. In the past, using formal meth-ods in practice seemed hopeless, only few crazy people stuck to them. Recently,industries are trying out formal verification like Z notation to document systemproperties more rigorously. Model checking and theorem proving (on certainstructures) are being plugged in to complement more traditional one of simula-tion.Making a case for GHDLSince I am ’lobbying’ for ghdl, it is clear that I am heavily biased and likeelectrons under bias my ideas will move in a certain direction i.e. towardssupporting ghdl. Why ghdl? I can give two arguments, one is solely driven by my love for freesoftwares, second is put forward my Prof M. P. Desai in his lecture. Free soft-wares (as defined by http://www.gnu.org/philosophy/free-sw.html) allow oneto understand how a particular software works by providing you with its sourcecode. That makes improvement as well as enhancement faster. This is the rightway of making this planet ’smarter’. Another more effective way is by dumbingdown the users by taking away their rights to know that they are using. Addinga fancy Graphical User Interface (GUI) may not necessarily translates into abetter software. We all have experiences with Microsoft Word! Second, according to Prof Desai (quoting in spirit, not the exact words), I’ll prefer giving 5 lacs more to someone who is an expert in free software rather than spending 10 lacs buying a license of a propriety softwares given that my job is done. Its like preferring a musi- cian who is better trained with his instruments over someone who is backed by costly electronic gadgets. First argument is a truism given that one is suffering from the mental neces-sity ’to know’ like Donald E. Knuth; second is also a truism if one works with(for) people who have the same vision. But most of the time, this is not thecase. Only first rate mind appreciate first rate minds. N’th level mediocrity 3 I’m Done Simulating; Now What? Verification Coverage Analysis and CorrectnessChecking of the DECchip 21164 Alpha microprocessor; Michael Kantrowitz, Lisa M. Noack;See 2
  3. 3. always support N+1’th level mediocrity. So it should not be surprising to notethat most of the people prefer Madona over Pt. Ravishankar, Daniel Steele overR. K. Narayanan, T-Shirt over Kurta - I plead guilty (Albert Einstein wouldhave looked more graceful in Kurta!) and ’some Indian Idol’ over Indian Ocean.On same lines, Modelsim over ghdl (offense indented!). Bottom line is Yourreal skills (with free-softwares) may be grossly undervalued (in pro-priety softwares driven world). To survive in Industries, it is useful to havefamiliarity with ’standard’ tools. Internet is flooded with articles about them.Installing GHDLLinux UsersBefore using package managers such as synaptic, yast etc make sure proxy vari-ables are set. On Ubuntu, synaptic is installed by default. Go to (System− >Administration− > SynapticP ackageM anager), go to the settings− > P ref erances− >N etwork and set the proxy. Search ghdl and mark for installation. If you preferusing apt − get utility from command line then make sure to put proxy informa-tion in /etc/apt/apt.conf file. For example, if my user-name is profc haos andpassword is khoonid arinda then my file will look like this.Acquire::http::proxy "http://prof_chaos:khooni_darinda@netmon.iitb.ac.in:80/";Acquire::ftp::proxy "http://prof_chaos:khooni_darinda@netmon.iitb.ac.in:80/";Acquire::https::proxy "http://prof_chaos:khooni_darinda@netmon.iitb.ac.in:80/";For other linux distribution, please google about it. If you are new to linux, youmay not be able to get things right for first few hours. That suppose to happen,but don’t let it put you off.Windows userGuys! Learn linux if you have not started learning it. As someone has said, “Welearn to live in the world of linux where there is no Gates or Windows”. . ForModelsim student edition, you have to use windows as expected. In VLSI lab,it is installed on linux and can be invoked by vsim command from terminal.Modelsim tutorial is given on its website.Text Editorghdl now have an inbuilt text editor but it may not be available on vlsi lab.You have to use vim or gedit. vim is the most advanced and simple (as a ruleof thumb, takes quite a lot of practice to learn) text editor. gedit is also agood editor. Spend some time with vim every week. You can curse me whilelearning but you will surely thank me after a year. vim is like a light saber, itis only effective in the hand of a ’Jedi Knight’. First timer can not do anythingsignificant with it. vim has a lot of tutorial and free books available on itswebsite. 3
  4. 4. CodingGet into habit of commenting your code properly. Not only because it will bereadable by others but also you can remember what you have done a week ago.Literate Programming is a school of thought which deals with readability ofcodes. Writing readable codes not only recommended but also mandatory thesedays. When a team of many people works on a single project, non-readabilityconsume much more time then it saves. You make also like to read about subversion (or git). Its a ’version controlsystem’ which keeps track of what you have done in the past. You can easilyrecover any past version of your file. You can use google-code to make your svnrepository or can set up your own local repository on your personal machine.There are many blogs written about how to do it.Few words of wisdom 4

×