| |
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
| Use PicoBlaze soft processor |
| Hand-code a machine language program from assembly language |
| Design a simple interface circuit between the embedded processor and other
I/O circuitry |
Software
Equipment
|
D2SB/DIO4/SIO1 board combo or D2E/DIO1 board combo |
|
Parallel port cable |
Documents
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.).
-
Read the PicoBlaze application note, especially
the section detailing the instruction set.
-
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.
-
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.
-
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.
-
Create a top-level module that contains the
following:
-
PicoBlaze processor (tie the interrupt input to
inactive level... 1'b0),
-
Program memory (a simple sequential (clocked)
‘always’ block with a ‘case’ statement would work well here -- see Tip #2
below),
-
Read-only register(s) to supply the switch
values -- use a MUX-based bus for the processor's DataIn port,
-
Write-only register to capture the computational
result, and
-
Your choice of output display circuitry.
-
Verify the correct operation of your system using
the Digilent D2SB/DIO4/SIO1 or D2E/DIO1 board combo.
Tips and Info
-
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).
-
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
- 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:
- 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.
- Use "equates" (EQU) to establish symbolic names for port numbers and
constants.
- See the pBlaze IDE web page for more details on syntax:
http://www.mediatronix.com/pBlazeIDE.htm
- 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.
- 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
-
Brief cover memo that describes your
design
-
Block diagram of your hardware
-
Processor program, both in assembly
language format (human-readable form) and machine instructions (sequence of
16-bit binary and hexadecimal values)
-
Hardcopy of all synthesizable Verilog
files that you create
-
Demonstration of your design to instructor (obtain
initials)
Due Date
Beginning of lab one week from today
|