Lab 5

horizontal rule

ece533 | doering | ece labs | ece | rhit

Home
Course Documents
Homework
Labs
Resources

Embedded Processor Warm-Up

Overview

In this lab you will gain experience working the PicoBlaze embedded processor, an 8-bit microcontroller created by Ken Chapman of Xilinx.

Objectives

bulletUse PicoBlaze soft processor
bulletHand-code a machine language program from assembly language
bulletDesign a simple interface circuit between the embedded processor and other I/O circuitry

Software

bullet

Xilinx ISE WebPACK FPGA implementation tools

bullet

Ken Chapman's PicoBlaze processor at ftp://ftp.xilinx.com/pub/applications/xapp/xapp213.zip (look for the kcpsm.vhd file)

bullet

Mediatronix pBlazeIDE integrated assembler and simulator for PicoBlaze at http://www.mediatronix.com/pBlazeIDE.htm

Equipment

bullet

D2SB/DIO4/SIO1 board combo or D2E/DIO1 board combo

bullet

Parallel port cable

Documents

bullet

PicoBlaze 8-Bit Microcontroller for Virtex-E and Spartan-II/IIE Devices, Xilinx Application Note XAPP213, http://www.xilinx.com/bvdocs/appnotes/xapp213.pdf (includes datasheet, instruction set description, and assembler manual)

bullet

PicoBlaze homepage at Xilinx: http://www.xilinx.com/ipcenter/processor_central/picoblaze/member/ (you need a Xilinx account to get access to this page)

bullet

PLD Oasis > Tutorials/Documents > PicoBlaze interface template diagram

Activities

NOTE: Your design must conform to ALL of the Synthesis Design Rules, including the naming conventions at the bottom of the document (use at least the minimal format of r_, w_, p_, etc.).

  1. Read the PicoBlaze application note, especially the section detailing the instruction set.

  2. Create a simple assembly language program, e.g., add two four-bit values from the slider switch inputs, and display the result on either the digit display or the discrete LEDs. Feel free to be creative, realizing that you want to use the DIO4 (or DIO1) board as your input/output device. If you are looking for more challenge, consider using the UART_Tx (transmitter) module as the output device.

  3. Create a hardware block diagram for your system showing the processor, the external interface registers, and other major components of your system. I suggest that you start with the PicoBlaze interface template diagram and hand-draw the rest of your system on the diagram.

  4. Manually translate the assembly language program into machine language (a sequence of 16-bit values). You may use an assembler to check your work (probably a good idea to do so... try the Mediatronix integrated assembler and simulator), but the point here is to learn about the bit fields in the 16-bit machine instructions.

  5. Create a top-level module that contains the following:

    1. PicoBlaze processor (tie the interrupt input to inactive level... 1'b0),

    2. Program memory (a simple sequential (clocked) ‘always’ block with a ‘case’ statement would work well here -- see Tip #2 below),

    3. Read-only register(s) to supply the switch values -- use a MUX-based bus for the processor's DataIn port,

    4. Write-only register to capture the computational result, and

    5. Your choice of output display circuitry.

  6. Verify the correct operation of your system using the Digilent D2SB/DIO4/SIO1 or D2E/DIO1 board combo.

Tips and Info

  1. Our version of ModelSim does not support mixed-HDL designs. Our version of NC-Sim DOES support mixed-HDL simulations, but you will probably need to do something  special with library setups to make this work (I have not attempted it yet).

  2. The program ROM must be a synchronous ROM, otherwise serious timing errors in the processor's read and write strobes will become apparent. A synchronous ROM simply means that the ROM output is a register that is clocked on the rising edge of the system clock. Here is an example of a short machine language program in synchronous ROM that could be included in your top-level module:
     

    always @ ( posedge i_Clock or posedge i_Reset )
    	if ( i_Reset )
    		r_Instruction <= 16'h8100;
    	else
    	case ( w_InstructionAddress )
    	0 : r_Instruction <= 16'hA000;	// start:	INPUT s0, 00
    	1 : r_Instruction <= 16'hA101;	// 		INPUT s1, 01
    	2 : r_Instruction <= 16'hE003;	// 		OUTPUT s0, 03
    	default: r_Instruction <= 16'h8100;	//	JUMP start
    	endcase
  1. You have two assemblers at your disposal. Ken Chapman's PicoBlaze assembler is a DOS application packaged in the same zip file as the processor VHDL file. The Mediatronix pBlaze IDE is a Windows-based application that integrates an editor, assembler, and simulator. The simulation capability is a big plus for this package. Here's some things to know about the pBlaze IDE:
    1. The assembly language mnemonics differ slightly from those in Ken Chapman's PicoBlaze manual. For example, use "IN" instead of "INPUT" and "OUT" instead of "OUTPUT". The editor will boldface the mnemonic when it recognizes it.
    2. Use "equates" (EQU) to establish symbolic names for port numbers and constants.
    3. See the pBlaze IDE web page for more details on syntax: http://www.mediatronix.com/pBlazeIDE.htm
    4. Click the button to invoke the assembler and simulator. When you have cleared all the syntax errors, you will be presented with a panel that looks like this: . Wave your cursor over the buttons to learn what they mean. Click the blue button to return to the editor.
    5. In subsequent labs you will learn how to directly incorporate the assembler output into your system. For now, simply look at the hexadecimal listing in the simulator to verify your hand-coded machine instructions.

Deliverables

  1. Brief cover memo that describes your design

  2. Block diagram of your hardware

  3. Processor program, both in assembly language format (human-readable form) and machine instructions (sequence of 16-bit binary and hexadecimal values)

  4. Hardcopy of all synthesizable Verilog files that you create

  5. Demonstration of your design to instructor (obtain initials)

Due Date

Beginning of lab one week from today

 

 

horizontal rule

Home | Course Documents | Homework | Labs | Resources

 ECE533: Programmable Logic Systems Design (S 2004-05)
Department of Electrical and Computer Engineering
Rose-Hulman Institute of Technology


For questions or comments regarding this web contact:
Last updated: 03/10/05.