You are on page 1of 11


TXT file for KCPSM3 --------------------------[Release 8a - 4th August - New ZIP file to correct fault with PB_BMM.EXE file su pplied Release 8] Release 8 Date : 6th July 2005 Macro Version v1.30 Assembler Version v1.30 This is the 8th release of PicoBlaze for Spartan-3, Spartan-3E Virtex-II, Virtex -IIPro and Virtex-4 devices. Note that the main documentation for this macro, User Guide (UG129), is not incl uded in this package. It should be downloaded from the PicoBlaze web site ( m/picoblaze) where a forum and other user pages can also be accessed.

New information --------------This release includes minor changes to the assembler and provides descriptions a nd tools to facilitate the use of the Xilinx DATA2MEM utility (see DATA2MEM_assistance direc tory). This provides a way to modify a PicoBlaze program directly in the configuration BIT f ile and should be very useful for program development in designs. Additional UART macros are provided (in VHDL) which allow parity bits to be tran smitted and received. These have been used in a few designs, but your help is requested in v erifying them and any feedback would be most welcome. Please see the VHDL directory for the additi onal files and notes. My continued thanks to Nick Sawyer and Shalin Sheth of Xilinx for their ongoing support of the Verilog files. Relatively New Information -------------------------Do check out the JTAG loader utility which allows rapid modifications to be made to PSM programs during development. Once you have used it once, you will use it all the time. Thanks here to Kristian Chaplin of Xilinx for this very useful tool. The assembler has a new 'INST' directive (please read Additional Assembler Notes ).

Controls include a reset. It features 16 general purpose registers and an internal 64-byte scratch pad mem ory. Important Note -------------It should be appreciated that it is virtually impossible to fully test a process or given the almost infinite number of combinations of code and signals which can be enco . A simple ALU supporting addition. Best of all. The ALU also supports Carry and Zero flags which can be used in conditional jumps and could fit 12 of them into an XC3S200 device.Author -----Ken Chapman email: picoblaze@xilinx. compare. An internal program counter stack su pports nested subroutines automatically. shifts and rotates. Virtex-II(PRO) or Virtex-4 device and is based on the popular KCPS M and KCPSM2 macros which have the collective name 'PicoBlaze'. logical operations and t esting including Staff Engineer .Applications Specialist Xilinx Ltd (UK) email: ken. The KCPSM3 assembler is supplied to assist in the development of programs.pdf' supplied with this package.chapman@xilinx. it uses just 96 slices .com' especially c oncerning the Verilog -------------------It is advised that questions are directed to 'picoblaze@xilinx. Quick Description ----------------KCPSM3 is a very simple 8-bit micro controller designed to be 100% embedded into a Spartan-3(E). but would you ever need to ?! The main documentation is provided in User Guide UG129 and is supplemented by th e original 'KCPSM3_manual. Use of the PicoBlaze forum is also encouraged. subtraction. an interrupt and int errupt acknowledge. Performance >44 MIPS.

No functional changes. V1.10 . The ENABLE INTERRUPT instruction is used to enable the interrupt input and an active interrupt automatically disables futur e interrupts.Change of '--translate off' and '--translate on' meta command directives to '--synthesis translate off' and '--synthesis translate on'. V1. Support of Verilog and System Generator design flows. (good or bad) or recommendations will be gratefully received by the author.chapman@xilinx. The change has no effect on any other situation.. Time stamp added to the LOG. However. If the execution of this instruc tion occurred at the same time as an active interrupt event.Functional change.30 . Improved handling of TAB characters and blank lines in PSM file.untered. KCPSM3 was completed in June 2003 and has been a used by many engineers in a wide range of applications during the past 24 months. KCPSM3 Assembler Revision History --------------------------------V1. The functional change was made to deal with a situation in w hich the ENABLE INTERRUPT instruction is being used in a program at a point w here the interrupt input is already enabled. Improvement to interpretation of PSM file name.00 V1.20 V1. Allow ROM_form. VHDL and Verilog files (The ROM_form templ . the net effect w as that the interrupts were not disabled by the interrupt event.12 V1.30 First release to users.20 .. An improvement to the ZERO and CARRY flag logic was also made which has no effect on functionality but is an enhancement to performance.10 V1. KCPSM3 Macro Revision History ----------------------------V1.01 V1..First release to users. your help is requested in the continuous verification of the functi onality of the KCPSM3 macro and assembler.Addition of code to enhance simulation. KCPSM3 benefited greatly from being based heavily on the experience gai ned with KCPSM and KCPSM2 which are extremely stable designs used by thousands of enginee rs for nearly five years.v to contain concatenation statements which use curly br Addition of the INST directive.. Please send your reports via email to: ken. So although this version of KCPSM3 and the assembler are believed to be stable a nd fully operational.00 . Improved coverage of Verilog syntax. V1. All reports.13 ackets.

The use of this file is described in the documentation.vhd to reproduce the wave forms seen in the documentation.VHDL file in which the KCPSM3 processor is connected to it s associated program ROM.Alternative and older form of documentation for KCPSM3.vhd.Example design VHDL file as used in the documentation. 1 stop bit. but don't panic. READ_ME.vhd .ngc . VHDL files ---------kcpsm3. 8-bit.PDF .This file KCPSM3_Manual. This can be used as example code a nd is described in the documentation.This is an alternative file defining the KCPSM3 processor and would be used as a 'black box' in a non HDL design flow.TXT . no parity.pdf . uart_clock. Files have been grouped into directories to help you find the files you would like to access. UART_real_time_clock. many of them are additional files which I hope you will find useful reference.The VHDL definition of the KCPSM3 processor. test_bench. .Documentation for simple UART transmitter and Receiver macros which are suitable for connection to KCPSM3. Generation of MEM file required by DATA2MEM.Example VHDL test bench to use with kcpsm3_int_test.pdf . with integral 16-b yte FIFO buffer. Occupies 18 slices. kcpsm3.vhd .vhd .Documentation for a reference design in which KCPSM3 and the UART macros are used to provide a real time digital clock with al arm. embedded_kcspm3.vhd . UART_Manual.VHDL hardware description for the real time clock reference des ign uart_tx. The document describes key aspects of the VHDL hardware design and assembler code. Please see User Guide UG129 for more further information. . kcpsm3_int_test. This file is the primary design flow for implementation and simulation.vhd .UART transmitter.ates supplied with this release are required to benefit from this feature). Contents -------This package contains many files.

9-bit UART receiver.vhd .v to reproduce the wave forms seen in the documentation. kcpsm3_int_test. kcuart_rx. with integral 16-byt e FIFO .txt . uart9_tx. The use of this file is described in the documentation. with integral 16-byte FIFO buffer.UART receiver. UART9_readme.UART transmitter. no parity.Description of the 9-bit UART macros suitable for parity oper ations. but typically used as part of uart_tx. 1 stop bit. but also useful standalone. but typically used as part of uart_rx.vhd . 8-bit. . 1 stop bit. Used in uart9_tx and uart9_rx. Can be used standalone. NOTE: You should be familiar with the normal 8-bit UART macro s and documentation before trying these versions. kcuart9_tx.Example Verilog test bench to use with kcpsm3_int_test. embedded_kcspm3.9-bit UART transmitter.v .UART receiver.9-bit UART transmitter with integral 16-character FIFO buffer.vhd . This file is the primary design flow for implementation and simulation.vhd . uart_clock. Can be used standalone. 8-bit. kcuart_tx. 8-bit. bbfifo9_16x9. kcuart9_rx. Used in uart_tx and uart_rx.VHDL hardware description for the real time clock reference desig n uart_tx.vhd .vh d.v . 8-bit.Verilog file in which the KCPSM3 processor is connected to i ts associated program ROM. bbfifo_16x8.A 16 byte synchronous FIFO buffer occupying 8 slices. 1 stop bit. Verilog files ------------kcpsm3.vhd .The Verilog definition of the KCPSM3 processor.UART transmitter. no parity.v .vhd .v. uart9_rx.vhd .uart_rx. This can be used as example code and is described in the documentation.v .9-bit UART receiver with integral 16-character FIFO buffer. Occupies 22 slices.vhd . no parity. testbench. 1 stop bit.v .Example design Verilog file as used in the documentation.vh d.A 16 character synchronous FIFO buffer occupying 9 slices. but also useful standalone. no parity.

psm .EXE .psm .UART receiver. ROM_form.The assembler for KCPSM3 programs.v .UART receiver. Used in uart_tx and uart_rx.coe . kcuart_rx. Assembler Files --------------**NOTE** You must copy KCPSM3. uart_rx. ROM_form. 1 stop bit. 1 stop bit.A 16 byte synchronous FIFO buffer occupying 8 slices.pdf .v .v. 1 stop bit.bat . Can be used standalone. 8-bit.v . but typically used as part of uart_tx.PSM assembler program for the real time clock reference design JTAG Loader ----------JTAG_loader_quick_guide. bbfifo_16x8.VHDL template file read by the assembler and used to define the style in which the program ROM will be implemented.v . KCPSM3. no parity.vhd . type 'cleanup <progname>' and this batch file PSM file with the formatted (FMT) file. ROM_form.v and ROM_form.v . 8-bit.Coefficient template file read by the assembler and used to defin e the style in which the program ROM will be implemented via the Core Generator flow.Verilog template file read by the assembler and used to define the style in which the program ROM will be implemented.Description of how to use the JTAG loader.Example PSM file as used in the documentation. cleanup. int_test. Please als o read "Additional Assembler Notes" included later.UART transmitter. ROM_form. This file must be placed in the same working directory as KCPSM3. no parity. no parity. kcuart_tx. It will of your original file as 'previous_<progname>. This file must be placed in the same working directory as KCPSM3.EXE.EXE.coe int o your working director regardless of which HDL language you are using.EXE. but also useful standalone. This file must be placed in the same working directory as KCPSM3. . Occupies 22 slices.buffer. Occupies 18 slices.EXE. Can be used standalone.simple batch file At the dos prompt will replace your maintain one copy m'. but typically used as part of uart_rx. with integral 16-byte F IFO buffer. ROM_form.v. 8-bit.vhd. to use after successful assembly of your code.

Remember to rename as 'ROM_form.v and ROM_form.The normal 'ROM_form. JTAG_Loader_ROM_form.v' and overwrite the normal file used by the KCPSM3 assembler.v . ple ase attempt to assemble you program in a simple directory such as c:\temp to determi ne if the problem is related to these DOS limitations. regardless of the design flow you intend to use.Batch file to automate execution sequence JTAG_Loader_ROM_form. Additional Assembler Notes -------------------------Copy KCPSM3. You can modify the template files (see documentation). .v' file when development is complete.EXE .exe playxsvf.vhd .EXE into your working directory. Remember to rename as 'ROM_form.The normal 'ROM_form. change_pb_bits. File names have a limit of 8-c haracters and care should be taken not to use in a project directory with a very deep hier archy requiring a long path specification.txt . The JTAG loader uses different templates which ar e provided. If you encounter an unexpected failure.exe jtag_loader. ROM_form.Description of a DATA2MEM design flo w.vhd.exe svf2xsvf.bat . All tem plate files are required.bat .vhd' file when development is complet e. DATA2MEM_assistance Files ------------------------DATA2MEM_how_to_use_it_with_PicoBlaze.Four executables used in the loading sequence hex2svf. Normal_ROM_form.Program to assist in the identification of Block Memories in your d esigns.hex2svfsetup.New ROM template to include JTAG interface.v .coe into the same directory.New ROM template to include JTAG interface. Normal_ROM_form. You must also copy the template files ROM_form.vhd . but no checking of syntax is performed by the assembler.vhd' and overwrite the normal file used by the KCPSM3 assembler. The assembler is only a simple DOS based utility.exe .Batch file to automate the DATA2MEM design flow and provide a starting point for your own batch files. PB_BMM.

Examples of valid syntax for INST directive INST 3245C INST 14FA2 inst 2abfe This directive was added to enable data to be embedded within the program memory space which can then be accessed via the second port of the dual port Block RAM.EXE directly from within Windows will only cause a DOS box to be displayed momentarily providing no opportunity to enter a PSM file nam e. To redirect the DOS screen output to a file the > symbol can be used in the DOS command line. The INST directives will normally be preceded by the ADDRESS directive to locate such data at a predictable location within the memory space. It is highly recommended that all files required by the assembler are located in the same working directory.20 of the assembler introduced a new 'INST' directive which allows th e definition of any instruction code in line with the existing instructions.pdf) .The assembler is normally used by first opening a DOS window in the working dire ctory and then executing KCPSM3 from within that window (please see KCPSM3_manual. More than 96 slices or less than 96 slices! ------------------------------------------- . Users have been successful using this utility on various networks but the author will not support or address any issues related to any difficultie s resulting from using KCPSM3 in this way. INST Directive Version v1. Attempting to execute KCPSM3.txt Many PicoBlaze users have also reported how much they like the free assembler an d simulator provided by Mediatronix. Obviously great care should be taken to ensure that data values are not encounte red by KCPSM3 during normal operation as the macro does not support illegal op-code tra pping. C:\DESIGN>kcpsm3 simple > screen_dump. The I NST directive has only one operand which must be a 5 digit hexadecimal value in the range 00000 to 3FFFF corresponding to the 18-bit instruction memory formed in a Block RAM.

1. th e reductions in size will be in the order of a few slices and any significant redu ction should be investigated as this would most likely indicate an error in your desig n (i. This should be considere d as the minimum size for the complete macro. Occasionally constraints on the design may result in a small increase in size wh en mapped. Fortunately. Unfortunately. This can res ult in a small reduction in size as the MAP tool removes unnecessary logic. The synthesis tool must then be instructed to ignore the 'generic map' information which is achieve d using meta command directives. Synthesis tools also require the 'INIT' values to be defined. forcing the mapping into a rectangular area has been shown to result in a size of 98 slices. there is no real standard for thes e directives and different synthesis tools will expect slightly different syntax.01i .e. It is quite common to not utilise all the available input and output signals of the KCPSM3 macro in the system design. failure to connect a valid clock input). However. Howeve r. In order for a simulator to have the correct information. but in this case t he definition is performed using a separate 'attribute' statements'. Potential synthesis issues -------------------------The HDL supplied for the KCPSM3 macro and the HDL generated by the assembler (derived from the ROM_form templates) has been written to be suitable for both synthesis and simulation. A figure of 91 slices can be achieved by adjusting the MAP property called 'CLB Pack Factor Percentage' to '1' (default is '100'). the 'Device utilization summary' will provide an estimate of 131 slices for the fina l size. the MAP tool is able to recognise the relationship between the larg e number of primitives and achieve the much smaller size of 96 slices.24) t he reported design figures for all the primitive components will be correct. the INTERRUPT input may be conne cted to 'GND' and READ_STROBE and INTERRUPT_ACK may be left unconnected. the code includes 'INI T' values defined using 'generic map' statements for each primitive component.vhd' file using XST (Release 6. For example.When synthesizing the 'kcpsm3. For example. The supplied HDL has been written using the directives '--synthesis translate_of f' .xst G.

Al though these can be safely ignored (and filtered) it is appreciated that they are less than desirable.and '--synthesis translate_on' and can be seen in the code as shown in this exam ple:t_state_lut: LUT1 --synthesis translate_off generic map (INIT => X"1") --synthesis translate_on port map( I0 => t_state. How to filter this message. In this case you should globally replace the directives in the 'kcpsm3' and 'ROM_form' files to match the requirements of your synthesis tool. Unfortunately. XST in ISE v7. It is hoped that the KCPSM3 code can be supplied in a modified form in the near future. However.1i . O => not_t_state ). If your synthesis tool reports any issues with processing the 'INIT' values decl ared as part of the 'generic map' statements then it is not ignoring these lines as i ntended.WARNING:Xst:2185 ----------------------------------With this release. I hope you can understand my position in this respect and will be pati ent for a return to a truly clean solution once again. until it is confirmed that changes to coding style are correctly interp reted by the tools from all leading HDL synthesis and simulation vendors this will not be possible. this enhancement now results in XST producing numerous warning me ssages of the type 'WARNING:Xst:2185' which report a "Possible simulation mismatch". . The syntax variants of this meta command directive encountered by the author are as follows :--translate_off --synthesis translate_off --synopsys translate_off --pragma translate_off --translate_on --synthesis translate_on --synopsys translate_on --pragma translate_on XST is able to interpret all of the above variants so '--synthesis translate_off ' and '--synthesis translate_on' have been used in the supplied code because it is the most frequently acceptable variant by other synthesis tools. XST was given the ability to interpret INIT values contained in generic maps and this should ultimately avoid the requirement to have separate I NIT attributes and generic maps.

. Simulation with VHDL-87 ----------------------Some VHDL simulators may not be able to use the VHDL supplied as it uses various VHDL-93 constructs.. Now when running XST all of the 2185 messages will have been removed. Check the box next to 'Filter enabled' and then save using File -> Save Now return to your project and run XST again and when you return to the message filters window you will find that all the warning messages have appeared in the lower ha lf of the screen. this model should not then be used for synthesis. etc. In this case..TXT ------------------------------------------------------------------------------- . In the top window.vhd Obviously.ngd sim_model_kcpsm3. Save the changes with File -> Save. select the box under 'Filter Text' and right click to choose the 'Delete' option. This will change the text to read "blank" line "blank": Possible.. Now this one filter will remove all of the 2185 warnings in one go. Move any one of the XST 2185 messages into the top window (Click once on message to select it and then click and drag it to the top window). ------------------------------------------------------------------------------END OF FILE READ_ME.. ngd2vhdl kcspm3.. it may be better to generate a simulation model for KC PSM3 using the following command.In Project navigator -> Edit -> Message Filters..