|Heroic Snowman on Tool’s hell part I: setting up…|
|R on A 3 DOF Robotic Arm Simul…|
|EngineerDog.com on A 3 DOF Robotic Arm Simul…|
|R on Tool’s hell part I: setting up…|
|Lift on Tool’s hell part I: setting up…|
Just another WordPress.com site
I frequently find myself deep in tool’s hell trying to set up a program for my engineering needs, it’s a common and necessary step in the design cycle, that’s reasonable. Unfortunately, the amount of time I invest in such triviality is, more than often, just ridiculous.
If you are into hardware design, you’ll have a good grasp of the kind of tools we, hardware designers, must deal with on a daily basis. I’ve a strong opinion about these tools. I’m aware that they get the work done, but c’mon, most of them look ugly, have an awkward graphical interface and love to install the “hard way”, let’s address that right away and leave the opinions for later.
ModelSim, nice, advanced verification, eh?
This first post will be a mini guide in how to (quickly!) set up everyone’s favorite HDL simulator, ModelSim. If you’re having trouble with mentor graphics’ finest, follow this guide and you should be investing countless hours of waveform debugging in no time.
First Circle: The basics
This is the scenario I faced while trying to install this thing: I’m working with Altera Quartus II 9.1 Web Edition; I tried installing Quartus II version 9 through 11, and version 9.1 was the only one I could get working under windows 7 (64-bit).
ModelSim console (FATAL) error. With bonus ambiguous signal value warning.
Now, you may be aware that Altera has its own ModelSim “edition”, called ModelSim-Altera. The main advantage of this edition is that it has all of Altera’s libraries built-in right out the box, so no need to mess with that, but if you’re out of luck (like myself) installing a Modelsim-Altera version compatible with Quartus II ver 9.1 will surely fail for whatever reason.
The only solution left is to use a stand-alone version of ModelSim (whichever version you hate the less) and manually compile Altera’s libraries and link them to ModelSim’s configuration files.
This is what we’re going to do:
Second Circle: Getting our hands dirty
Let’s get this show started. After successfully installing ModelSim you’ll need to browse the following directory path_to_quartus/eda/sim_lib and take note of its contents, you should identify the FPGA/device of your interest and take note of the exact filename because this is the library we will include in our automated script later (the extension could be either .vhd or .v for verilog). You can also compile for all the devices available. I’m working with VHDL, so I identify all the files with .vhd extension, it should be the same for Verilog files.
Next, download this handy script and open it with your favorite text editor (please, do not use notepad). We will run this script from ModelSim’s console to compile all our libraries. The script must include the exact same paths of the files you identified in the previous step. Be sure to modify the following line: path_to_quartus with the actual Quartus path you got.
Now, as an example, in the /eda/sim_lib directory, I’ve identified the cyclone family as a potential must-include FPGA library on ModelSim, so I’ve added the following lines to the script:
vlib cyclone vmap cyclone cyclone vcom -work cyclone -2002 -explicit $path_to_quartus/eda/sim_lib/cyclone_atoms.vhd vcom -work cyclone -2002 -explicit $path_to_quartus/eda/sim_lib/cyclone_components.vhd
You can manually type or uncomment the line of your interest inside the script. Remember that # is the comment identifier on ModelSim scripts. Be sure to include stuff that actually exists in the /eda/sim_lib directory, otherwise your compilation will fail, and that will probably make you sad for a while, but worry not, you can always try again!
Once ready, we’ll head to ModelSim’s application directory, in my case rootDrive/modeltech_6.5b inside, we will create the following subdirectories /altera/vhdl here we’ll place our nifty little script.
Fire up ModelSim and change directory to where the script is located, once there, simply type the following: do vhdl-library-setup.tcl in the console, the script should start execution. It will take a while, depending on how many libraries you’ve included inside the script.
After ModelSim is done, close it and browse to your rootDrive/modeltech_x.x/ directory, we’re looking for modelSim’s configuration file, modelsim.ini we will modify it. It might be set to read-only, be sure to modify that file attribute beforehand.
It may be wise to make a backup copy of modelsim.ini just in case things get hairy after our modifications. Ok, now take a look inside the ini file and identify the [Library] configuration block, we will add some lines after sv_std = $MODEL_TECH/../sv_std and before the [vcom] block.
Now, we will link each library that was created in the /altera/vhdl path with a variable, this is easy, for the script provided, I’ve included the following lines:
lpm = $MODEL_TECH/../altera/vhdl/lpm altera_mf = $MODEL_TECH/../altera/vhdl/altera_mf altera = $MODEL_TECH/../altera/vhdl/altera sgate = $MODEL_TECH/../altera/vhdl/sgate altgxb = $MODEL_TECH/../altera/vhdl/altgxb cyclone = $MODEL_TECH/../altera/vhdl/cyclone cycloneii = $MODEL_TECH/../altera/vhdl/cycloneii cycloneiii = $MODEL_TECH/../altera/vhdl/cycloneiii max = $MODEL_TECH/../altera/vhdl/max maxii = $MODEL_TECH/../altera/vhdl/maxii stratix = $MODEL_TECH/../altera/vhdl/stratix stratixii = $MODEL_TECH/../altera/vhdl/stratixii stratixiii = $MODEL_TECH/../altera/vhdl/stratixiii stratixgx_gxb = s$MODEL_TECH/../altera/vhdl/tratixgx_gxb stratixiigx = $MODEL_TECH/../altera/vhdl/stratixiigx stratixiigx_hssi = $MODEL_TECH/../altera/vhdl/stratixiigx_hssi arriagx = $MODEL_TECH/../altera/vhdl/arriagx arriagx_gxb = $MODEL_TECH/../altera/vhdl/arriagx_gxb
We’re adding just the name of the library to the path where it was compiled, again, make sure you’re adding actual directories you created in the rootDrive/modeltech_x.x/ altera/vhdl path and make sure to not repeat variable names.
Third Circle: Wrapping it up
Once done, save and start ModelSim, you should see our newly compiled libraries right in ModelSim’s main library tab. Success, you should be able to painfully debug Altera components now.
ModelSim simulating a 10 hour-long run. Note the
ugly traditional wave editor.
This is all for now, tool configuration is a pain in the arse, but it is something that must be done, hopefully this guide will help you to do it as quickly as possible. I promise a more “action-oriented” post the next time.
During the last couple of days, I’ve been thinking of using this blog as a kind of “idea-bin” where I’d dump any thought about the projects I’m currently working on. The main reason being that I need a record/archive of my own progress to be queried and read at any time, anywhere.
So, for the following months, I’ll describe some ideas that will be heavy involved with the following themes:
Computer Science and Digital Electronics
Those are the two main areas I’m constantly moving on. Of course, all this is related to one, main, field, which basically involves the designing of a computer system, but I’d like to point out that the main areas I deal with range from hard implementation (actual circuitry) to soft abstraction (programming).
This is all for now, during the following weeks I’ll be updating this blog with random thoughts, inner monologues and reflections about the stuff I’m currently developing, hope this proves useful for anyone with similar interests, or just with a little bit of curiosity of how some things (may) work.