Type the command "setenv MGC_WD <path>" where path is the path from your root directory to the working directory created in the previous step. You can enter this command in your ".cshrc" file to avoid having to issue the command every time you log on to the computer.
Type the sample file, shown below in Figure 2, into a text editor and save it as "sample1.vhd". This program is a representation of the state diagram shown in Figure 1.
Figure 1 - a simple four state machine
entity statemachine is
port(clk, x : in bit;
y : out bit);
end statemachine;
architecture datapath of statemachine is
type state is (state0, state1, state2, state3);
signal state : states := state0;
begin
-- output y based on state
y <= '1' when state = state0 and x = '1' else '0';
s:
process(clk)
begin
if clk'event and clk = '0' then
case state is
when state0 =>
state <= state1;
when state1 =>
state <= state2;
when state2 =>
state <= state3;
when state3 =>
state <= state0;
end case;
end if;
end process;
end;
Figure 2 - a sample VHDL program
Type "qvlib work" at the Unix command prompt to create a working library. This command will create a directory called "work" that contains all the files needed to simulate the design using QVSim.
Type "qvcom sample1.vhd -synth" to create a synthesizable VHDL model. The model will be stored in the "sample1" directory located directly below the "work" directory created in the previous step.
Note: Do not delete, move, copy, or edit any files located in the "sample1" directory using Unix commands. If you need to delete any files, use the command "qvdel <model name>" from the working directory or use Design Manager to delete them.
Type "alui" at the Unix command prompt to start AutoLogic II.
Select the file "sample1.vhd" from the menu as shown in Figure 3.
Figure 3 - The "Open Design" dialog box
Library/Technology sample_lib scna20orbit_fast scna20orbit_nom scna20orbit_slow xc4k/default altera/defaultThis will load the Xilinx library to be used in generating the schematic. The Xilinx library contains the logic components necessary to synthesize the design in the XC4003 and other Xilinx 4000-series FPGAs.
Figure 4 - The "Synthesize VHDL Design" dialog box
Figure 5 - The "Optimize Design" dialog box.
Click "Optimize->Optimize Design" once more. This time select the "Add I/O Buffers" option from the dialog box.
Note: Optimizing for IO cells will add input and output buffers to all the lines coming in and out of the design.
Re-optimize for area, but this time select "Map" from the "Area Optimizations Options" options. This will add external IO pads to the input and output ports.
Figure 8 -The "Save Design" dialog box.
When the design is saved, a new directory called "eddm" will be added directly under the working directory. All the files generated by Autologic II will be placed in this new directory. The directory structure is as follows.
..../working_directory _______|_______ | | /work /eddm | | /sample1 /work | /sample1_s
Note: Since Autologic II creates these files in memory during operation, all changes will be lost if not saved prior to exiting the program.
Type "pld_da" at the Unix command prompt to start Design Architect.
Select "Design Sheet" from the toolbox located to the right on the Design Architect window or click "Open->Design Sheet" from the menu bar at the top of the screen. Type "eddm/work/sample1" or select the navigator, as shown in Figure 10, to open the "sheet1" file.
Figure 10 -Navigator dialog box.
This will open the schematic and display it to the screen.
Click "View->All" to view the entire schematic in the window.
Tip: To zoom to a particular area of the design, hold down the middle mouse button and move the mouse from left to right while traveling in a downward direction over the area that you wish to view. Release the button and the area that you selected will display in the window.
Select "Unified" from the libraries selection box on the right side of the screen.
Select the "XC4000 LIB" option from the libraries selection box on the right side of the screen.
Select the "By Type" option from the library selection box at the right of the screen.
Tip: You can add components to the design by selecting the component from the library and placing it in the desired location in the schematic window. When the desired component is selected from the parts selection box, located on the right hand side of the screen, it is automatically attached to the mouse pointer. To add the component, just move the mouse until the highlighted component is over the desired location and click the left mouse button. The component will attach itself to the circuit.
Figure 11 -Autologic II-generated schematic for sample1
edit, and manage your models from this tool. You can also start some of the other Mentor Graphics tools from here.
Type "pld_dmgr" at the Unix command prompt to start Design Manager.
Figure 12 - Design Manager interface
Select the "pld_dve" icon from the "tools" window located on the left side of the screen, and double-click on it to start PLD DVE. A dialog, as shown if Figure 13, will appear.
- Type "eddm/work/sample1" into the "Design Object" text box.
- Select "XC4000" from the "PLD Technology" options.
Click "OK" or press the <ENTER> key to start the viewpoint creation process.
Figure 13 - the PLD DVE dialog box
Figure 14 - the QuickSim II dialog box
Figure 15 -The Signal dialog box.
Figure 16 -The List window.
-- initialize values force //globalsetreset 1 0 force x 0 0 force y 0 0 force clk 0 0 force state 0 0 force //globalsetreset 0 60 -- start simulation force clk 0 60 force clk 1 80 force clk 0 100 force clk 1 120 force clk 0 140 force clk 1 160 force clk 0 180 force clk 1 200 force clk 0 220 force clk 1 240 force clk 0 260 force clk 1 280 force clk 0 300 force clk 1 320 force clk 0 340 force clk 1 360 force clk 0 380 force x 1 380 force clk 1 400 force clk 0 420 force clk 1 440 force clk 0 460 force clk 1 480 force clk 0 500 force clk 1 520 force clk 0 540 run 600
Figure 16 - force file for "sample1" model
Type "force_control" or use the navigator to load the file and press <ENTER>. This will cause the simulator to run the force file. The values of the signals will appear in the list window as illustrated in Figure 17.
Figure 17 - output from simulation
The function of the "sample1" model is to cycle from state to state, assigning a value to the output signal y based on the value of the input signal x. If the value of x is 1 at the time of transition between state 3 and state 0, the value of y will become 1. Otherwise, the value of y is 0.
To check the model for correct output, look at the values of x and y during transition from state to state. The signal y should only equal 1 when x is 1 and state is 0.