THE VHDL TEXT EDITOR

When you first start MAX+plus II there are no files defined. So it is at this point you must open your VHDL file or create a new file.

Creating a New Text File:

There are a couple different ways to do this. You can either click on the appropriate tool bar button or you can choose new from the file menu. You will be prompted with the following box:

figure 1.1

Click on the Text Editor File and choose OK. A blank sheet will now be displayed on the screen. This is where you type in your VHDL code.

Opening and Existing File:

In MAX+plus II you can open any ASCII file that is in either DOS or UNIX format. As a convention you should probably save a VHDL file with a .VHD extension however you do not have to. To open a file, choose the file menu and choose open, or you could press the Tool Button Bar. You will see the following box:

figure 1.2

Navigate your way to where your file is located, select it and click okay. The file should load up as a text file in the main MAX+plus II screen. You can also open up graphics (schematic) files, symbols, waveforms or an assorted array of text files in the different languages supported by MAX+plus II (VHDL, AHDL - Altera Hardware Design Language, Verilog - HDL, etc.).

Entering Your Code:

As you type in your VHDL you will notice that the keywords are highlighted in navy blue, the comments in green, the functions and macros like rising_edge() in purple, the predefined components like lpm_ram_dq in dark red and the rest will all be in black. This is extremely useful for debugging and makes your code many times easier to read. If you wish to add a function you can use the templates to ensure correct syntax. To do this choose Templates and VHDL Template then choose the function that you wish to implement. The proper code will be inserted at the current cursor position. You can use the CUT (ctrl-x), COPY (ctrl-c), and PASTE (ctrl-v) commands to move text around. You can also highlight text you want to move and click and hold the Right Mouse Button and drag it to where you want the text to go. If you wish to replace many items of text at the same time you can go to the utilities menu and use the various tools there.

figure 1.3

After you have completed entering your design you must now save it. If it is a brand new file you will have to enter in a path and file name otherwise you can click Save from the File menu or the tool bar button that looks like a disk. It is good practice to save often and there is no auto save feature.

figure 1.4

Now that your design is saved you have to tell MAX+plus II which device you are using.

Practice:

We will be using a program called blink to illustrate what is going on. To follow along you should create a new Text Editor file and enter the following code into the text editor:

-- This file will cause the output o to toggle
-- while the input i is on.

library ieee;
use ieee.std_logic_1164.all;

entity blink is

port(i :in std_logic;
o :out std_logic);

end blink;

architecture blink of blink is
begin

o <= not i;

end blink;

You must then save the file someplace on the local machine as BLINK.VHD. Because the rest of the process generates many files it is strongly recommended that you create your own directory in which to save your BLINK.VHD file.


[BACK][MAIN][NEXT]

Mark Fedorak, Vera Casteel, Kris Pucci, Ron Smith - 1998