Skip to main content Skip to local navigation

VPL: Simplest Working Example

VPL: Simplest Working Example

Virtual Programming Lab can be a little intimidating to use, but once you get the swing of things, it's pretty good. So, let's get you started with the simplest possible working example. We assume that:

  1. you have Moodle working at your institution
  2. someone has installed VPL on Moodle and
  3. you don't need or have access to a local VPL server that connects to Moodle.

By default, the VPL Moodle activities are set to set data to a server in Spain that hosts compilers and development tools that can be used to evaluate student submissions. We'll use that server for this example.

Step 1: Set up a VPL Assignment on eClass (Moodle)

In eClass (Moodle), add a VPL assignment.

add an assignment in Moodle (eClass)
Add a VPL assignment in eClass / Moodle

Note, the VPL icon may be in a different location in the "Add an activity" menu. Try "Activities" or "All" if you don't see it immediately. Now, describe the assignment. Skip all the "Submission period", "Grade", "Tags", etc. settings. Then, "save and display."

describe the assignment

Step 2: Access the Editor via the Edit tab

We're going to create a simple file for testing within this VPL activity. Now that you've set up the assignment and displayed it, click on the Test activity tab, shown below.

Click on the "Test activity" tab. This will then reveal the "Edit" tab.

You will now see the "Edit" tab. Click on the Edit tab. A "Create a new file" window will appear, superimposed over the Editor window.

Click the Edit tab. You can now name your test program.

Name your test program file here. The file extension is key as this allows VPL to determine which programming language you intended to use. If it's a Java program, name it somethingSomething.java. If it's a Python program, name it blahBlah.py. Me, I'm going to test out a Verilog program and I'll call it myVerilogProgram.v.

I've named my program myVerilogProgram.v

My program is this:

module TestModule;
reg [8:0] x; // an 8-bit register

initial
begin
$display($time, " ", x);
x = 0;
$display($time, " ", x);
x = x+2;
$display($time, " ", x);
$finish;
end
endmodule

This is my Verilog test program. Feel free to copy and paste.

Step 3: Run the program

Write it in the editor area and save it using the old-school diskette icon.

edit and save

Now it's time to run your program. Click on the rocket icon to run it.

run using the rocket icon.
run using the rocket icon.

When you run the program a black console will appear superimposed on your editor. If your program prints anything, it will appear here. In my example, three lines appear and show the time (left) and variable value (right).

Running the program.
Running the program. You can see the program result in the console that gets superimposed on the VPL editor.

Error? VPL will find it for you!

If you mistype something, VPL will tell you when it tries to run or compile your program.

VPL will provide feedback to you if there are errors.

Next steps: Getting more help

I like looking up things on

  1. The VPL main website
  2. The Moodle VPL support page
  3. A downloaded copy of the VPL source code
  4. The Kindle book on VPL (it's inexpensive but could use a good edit to clean it up a bit; however, it's a decent reference)