URL
https://opencores.org/ocsvn/copyblaze/copyblaze/trunk
Subversion Repositories copyblaze
[/] [copyblaze/] [trunk/] [copyblaze/] [sw/] [tools/] [asm/] [pBlazASM/] [Main - pblazasm - Picoblaze (R) command line assembler and merger - Picoblaze (R) commandline assembler and vhdl verilog file merger - Google Project Hosting.htm] - Rev 27
Go to most recent revision | Compare with Previous | Blame | View Log
<!DOCTYPE html> <html> <head> <link rel="icon" type="image/vnd.microsoft.icon" href="http://www.gstatic.com/codesite/ph/images/phosting.ico"> <link rel="canonical" href="http://code.google.com/p/pblazasm/wiki/Main" /> <script type="text/javascript"> var codesite_token = "69ccc810eb65d900c7571852ed2f21bc"; var CS_env = {"profileUrl":["/u/@VhdVS1RVBhdHXgN9/"],"token":"69ccc810eb65d900c7571852ed2f21bc","assetHostPath":"http://www.gstatic.com/codesite/ph","domainName":null,"assetVersionPath":"http://www.gstatic.com/codesite/ph/13841197563397998716","projectHomeUrl":"/p/pblazasm","relativeBaseUrl":"","projectName":"pblazasm","loggedInUserEmail":"meziti.abdallah@gmail.com"}; var _gaq = _gaq || []; _gaq.push( ['siteTracker._setAccount', 'UA-18071-1'], ['siteTracker._trackPageview']); _gaq.push( ['projectTracker._setAccount', 'UA-10408907-2'], ['projectTracker._trackPageview']); </script> <title>Main - pblazasm - Picoblaze (R) command line assembler and merger - Picoblaze (R) commandline assembler and vhdl/verilog file merger - Google Project Hosting </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" > <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > <meta name="ROBOTS" content="NOARCHIVE"> <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/13841197563397998716/css/core.css"> <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/13841197563397998716/css/ph_detail.css" > <link type="application/atom+xml" rel="alternate" href="/feeds/p/pblazasm/svnchanges/basic?path=/wiki/Main.wiki"> <!--[if IE]> <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/13841197563397998716/css/d_ie.css" > <![endif]--> <style type="text/css"> .menuIcon.off { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 -42px } .menuIcon.on { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 -28px } .menuIcon.down { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 0; } #maincol { padding-top: 0; padding-bottom: 0; } </style> </head> <body class="t6"> <script type="text/javascript"> (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga); })(); </script> <div class="headbg"> <div id="gaia"> <span> <b>meziti.abdallah@gmail.com</b> | <a href="/u/@VhdVS1RVBhdHXgN9/" id="projects-dropdown" onclick="return false;" ><u>My favorites</u> <small>▼</small></a> | <a href="/u/@VhdVS1RVBhdHXgN9/" onclick="_CS_click('/gb/ph/profile');" title="Profile, Updates, and Settings" ><u>Profile</u></a> | <a href="https://www.google.com/accounts/Logout?continue=http%3A%2F%2Fcode.google.com%2Fp%2Fpblazasm%2Fwiki%2FMain" onclick="_CS_click('/gb/ph/signout');" ><u>Sign out</u></a> </span> </div> <div class="gbh" style="left: 0pt;"></div> <div class="gbh" style="right: 0pt;"></div> <div style="height: 1px"></div> <!--[if lte IE 7]> <div style="text-align:center;"> Your version of Internet Explorer is not supported. Try a browser that contributes to open source, such as <a href="http://www.firefox.com">Firefox</a>, <a href="http://www.google.com/chrome">Google Chrome</a>, or <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>. </div> <![endif]--> <table style="padding:0px; margin: 0px 0px 10px 0px; width:100%" cellpadding="0" cellspacing="0" itemscope itemtype="http://schema.org/CreativeWork"> <tr style="height: 58px;"> <td id="plogo"> <link itemprop="url" href="/p/pblazasm"> <a href="/p/pblazasm/"> <img src="/p/pblazasm/logo?cct=1242918360" alt="Logo" itemprop="image"> </a> </td> <td style="padding-left: 0.5em"> <div id="pname"> <a href="/p/pblazasm/"><span itemprop="name">pblazasm</span></a> </div> <div id="psum"> <a id="project_summary_link" href="/p/pblazasm/"><span itemprop="description">Picoblaze (R) commandline assembler and vhdl/verilog file merger</span></a> </div> </td> <td style="white-space:nowrap;text-align:right; vertical-align:bottom;"> <form action="/hosting/search"> <input size="30" name="q" value="" type="text"> <input type="submit" name="projectsearch" value="Search projects" > </form> </tr> </table> </div> <div id="mt" class="gtb"> <a href="/p/pblazasm/" class="tab ">Project Home</a> <a href="/p/pblazasm/w/list" class="tab active">Wiki</a> <a href="/p/pblazasm/source/checkout" class="tab ">Source</a> <div class=gtbc></div> </div> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0" class="st"> <tr> <td class="subt"> <div class="issueDetail"> <div class="isf"> <span class="inIssueList"> <span>Search</span> <form action="/p/pblazasm/w/list" method="GET" style="display:inline"> <select id="can" name="can" > <option disabled="disabled">Search within:</option> <option value="1" > All wiki pages</option> <option value="3" > Featured pages</option> <option value="2" selected="selected"> Current pages</option> <option value="5" > My starred pages</option> <option value="4" > Deprecated pages</option> </select> <span>for</span> <span id="qq"><input type="text" size="38" id="searchq" name="q" value="" autocomplete="off" ></span> <input type="submit" value="Search" > </form> </span> </div> </div> </td> <td align="right" valign="top" class="bevel-right"></td> </tr> </table> <script type="text/javascript"> var cancelBubble = false; function _go(url) { document.location = url; } </script> <div id="maincol" > <!-- IE --> <style type="text/css"> .delcom { background: #e8e8e8 } .commentcontent { margin: 2em; padding: 0px 10px; width: 66em; } .artifactcomment { border-top: 3px solid #c3d9ff; } #commentform { border-top: 3px solid #c3d9ff; } </style> <div id="wikipage"> <table> <tr> <td style="vertical-align:top; padding-left:5px"> <div id="wikiheader"> <img width="15" height="15" id="star_img" src="http://www.gstatic.com/codesite/ph/images/star_off.gif" style="cursor:pointer" onclick="_CS_toggleStar(this, '', {'scope': 'wiki', 'user': '_CURRENT_USER', 'item': 'pblazasm:Main', 'token': codesite_token });"/> <span style="font-size:120%;font-weight:bold">Main</span> <div> <i>Picoblaze (R) command line assembler and merger</i> <div id="wikiauthor" style="float:right"> Updated <span title="Thu Mar 31 02:32:59 2011"> Mar 31, 2011</span> by <a style="white-space: nowrap" href="/u/mediatronix/">mediatronix</a> </div> </div> </div> <div id="wikicontent"> <div class="vt" id="wikimaincol"> <h1><a name="Introduction"></a>Introduction<a href="#Introduction" class="section_anchor"></a></h1><p>The main feature of this assembler is the possibility to initialize the contents of the scratch-pad memory, provided it is implemented as a block-ram. The scratch-pad memory can be the second port of the code rom; this port is an 8-bit port. You can write: </p><pre class="prettyprint"> .SCR 0x380 ; equal to 0x700 as seen from the 8 bit-port. prompt .TXT "\r\n>>" ; 5 characters, CR, LF, 2 '>'s and a trailing zero. count .BUF 4 ; uninitialized 4 byte variable end .BYT 0x55 ; initialized 1 byte variable</pre><h1><a name="Directives"></a>Directives<a href="#Directives" class="section_anchor"></a></h1><h3><a name=".EQU"></a>.EQU<a href="#.EQU" class="section_anchor"></a></h3><p>Equate the value of an identifier to the value of the expression. </p><pre class="prettyprint">Ten .EQU 2 * 5 ; The ident Ten now has the value 10 Accu .EQU s8 ; The ident Accu can be used instead of register s8</pre><h3><a name=".ORG"></a>.ORG<a href="#.ORG" class="section_anchor"></a></h3><p>Set the origin of the next instruction </p><pre class="prettyprint"> .ORG 0x100</pre><h3><a name=".SCR"></a>.SCR<a href="#.SCR" class="section_anchor"></a></h3><p>Set the origin of the scratchpad memory in the code rom in case the second port of the code rom blockram is used as such or set it to 0x400 if a different blockram is used. </p><pre class="prettyprint"> .SCR 0x380 ; use the last 128 words (=256 bytes) of the code rom .SCR 0x400 ; use a separate blockram or distributed ram</pre><h3><a name=".TXT"></a>.TXT<a href="#.TXT" class="section_anchor"></a></h3><p>Initialize the scratchpad with the textstring, including a zero byte. </p><pre class="prettyprint">prompt .TXT "\r\n>>" ; 5 characters, CR, LF, 2 '>'s and a trailing zero.</pre><h3><a name=".BYT"></a>.BYT<a href="#.BYT" class="section_anchor"></a></h3><pre class="prettyprint">ver .BYT 0x55 ; initialized 1 byte variable</pre><h3><a name=".WBE_and_.WLE"></a>.WBE and .WLE<a href="#.WBE_and_.WLE" class="section_anchor"></a></h3><pre class="prettyprint">val2 .WBE 0xAA55 ; initialized 2 byte variable, AA first byte val3 .WLE 0xAA55 ; initialized 2 byte variable, 55 first byte</pre><h3><a name=".LBE_and_.LLE"></a>.LBE and .LLE<a href="#.LBE_and_.LLE" class="section_anchor"></a></h3><pre class="prettyprint">val2 .LBE 0xAA123455 ; initialized 4 byte variable, AA first byte val3 .LLE 0xAA123455 ; initialized 4 byte variable, 55 first byte</pre><h3><a name=".BUF"></a>.BUF<a href="#.BUF" class="section_anchor"></a></h3><pre class="prettyprint">count .BUF 4 ; uninitialized 4 byte variable</pre><h1><a name="Prefered_mnemonics"></a>Prefered mnemonics<a href="#Prefered_mnemonics" class="section_anchor"></a></h1><pre class="prettyprint"> MOVE instead of LOAD LD instead of FETCH ST instead of STORE RET instead of RETURN RETI instead of RETURNI ADDC instead of ADDCY SUBC instead of SUBCY IN instead of INPUT OUT instead of OUTPUT EINT instead of ENABLE INTERRUPT DINT instead of DISABLE INTERRUPT </pre><h1><a name="Scratchpad_Initialization"></a>Scratchpad Initialization<a href="#Scratchpad_Initialization" class="section_anchor"></a></h1><p>Initialization of the scratchpad memory is done is the assembler source by specifying the origin of the scratchpad by the .SCR directive. The scratchpad can be either the blockram used for the CodeROM itself using the second (byte-wide) port of that blockram or the distributed memory based scratchpad as implemented in the original kcpsm3 core. Basically the pBlazMEM tool replaces instances on {INIT_XX}, {INITP_XX} and {INITD_XX} by constant strings with the appropriate values, similar to the kcpsmasm tool of Xilinx. New is the possibility to initializing the scratchpad in addition to initializing the CodeROM. </p><p>New is the {INITD_XX} template to initialize distributed ram parts. Use someting like this: </p><pre class="prettyprint">{begin template} -- at start of file ... store_block: block is type INIT_ARRAY_t is array( 0 downto 7 ) of bit_vector( 63 downto 0 ) ; constant INIT_ARRAY : INIT_ARRAY_t := ( B"{INITD_00}", B"{INITD_01}", B"{INITD_02}", B"{INITD_03}", B"{INITD_04}", B"{INITD_05}", B"{INITD_06}", B"{INITD_07}" ) ; begin store_loop: for i in 0 to 7 generate begin memory_bit: RAM64X1S generic map( INIT => INIT_ARRAY( i ) ) port map ( D => sx( i ), WE => memory_enable, WCLK => clk, A0 => second_operand( 0 ), A1 => second_operand( 1 ), A2 => second_operand( 2 ), A3 => second_operand( 3 ), A4 => second_operand( 4 ), A5 => second_operand( 5 ), O => memory_data( i ) ) ; store_flop: FD port map ( D => memory_data( i ), Q => store_data( i ), C => clk ) ; end generate store_loop ; end block ;</pre><p>as a template instead of the store_loop construct in the KCPSM.VHD file. </p><h1><a name="Makefile"></a>Makefile<a href="#Makefile" class="section_anchor"></a></h1><p>Use a makefile like this to automate the assembly and merging: </p><pre class="prettyprint"># path to tools AS="C:/SVN/pBlazASM/pBlazASM.exe" MG="C:/SVN/pBlazMRG/pBlazMRG.exe" RM = rm -f -v CP = cp # List of PSM Files ASM_SRC = Init.psm Inband.psh SPI.psm I2C.psm UART.psm delay.psm Inband.psm MYROM.psm AFLAGS = -l -m MGFLAGS = TEMPLATE = template ENTITY = CodeROM .SUFFIXES : .psm .mem .vhd .psh # assemble and merge all: $(ENTITY).vhd $(ENTITY).mem: $(ASM_SRC) $(AS) $(ASM_SRC) $(AFLAGS) $(ENTITY).vhd: $(ENTITY).mem $(TEMPLATE).vhd $(MG) $(MGFLAGS) -e$(ENTITY) $(ENTITY).mem $(TEMPLATE).vhd $(ENTITY).vhd $(CP) $(ENTITY).vhd .. # clean outputs clean: $(RM) $(ENTITY).lst $(ENTITY).mem $(ENTITY).vhd </pre><h1><a name="Operation_with_BMM_and_MEM_in_an_ISE_project"></a>Operation with BMM and MEM in an ISE project<a href="#Operation_with_BMM_and_MEM_in_an_ISE_project" class="section_anchor"></a></h1><p>Use a BMM file like this to associate the MEM file with your ISE design: </p><pre class="prettyprint">ADDRESS_SPACE Code_ROM RAMB18 WORD_ADDRESSING [0x00000000:0x000003FF] BUS_BLOCK iPico/program/prog_rom [17:0] ; END_BUS_BLOCK; END_ADDRESS_SPACE;</pre><p>The name of the block RAM (here: iPico/program/prog_rom) needs to be derived from the design through some voodoo, like xdl.exe. </p><p>Merge is not necessary anymore. Add the CodeROM.MRG and CodeROM.BMM files to your ISE project. Add the following 'Other Bitgen Command Line Options' to the 'Generate programming file' (BitGen) function of your ISE project: </p><pre class="prettyprint"> -bd CodeROM.MEM</pre><p>Now when 'make'ing a new version of CodeROM.MEM, ISE will see it has changed and 'Generate programming file' can be rerun to make a new bit/bin file. </p><p>Remove the merge step from the makefile, since it would invalidate CodeROM.VHD, which will trigger a full build of your FPGA, instead of a mere BitGen. </p> </div> </div> </td><tr> </table> </div> <div id="commentform"> <form action="../w/detail.do" method="post"> <table> <tr><td class="vt"> <input type="hidden" name="pagename" value="Main" > <input type="hidden" name="token" value="69ccc810eb65d900c7571852ed2f21bc" > <div class="graytext" style="float: right;"> Hint: You can use <a href="http://code.google.com/p/support/wiki/WikiSyntax">Wiki Syntax.</a> </div> <div>Enter a comment:</div> <textarea name="content" rows="6" cols="100"></textarea><br><br> <input type="submit" name="submit" value="Submit" > </td> </table> </form> </div> <form name="delcom" action="../w/delComment.do" method="POST"> <input type="hidden" name="sequence_num" value="" > <input type="hidden" name="create_time" value="" > <input type="hidden" name="mode" value="" > <input type="hidden" name="pagename" value="Main" > <input type="hidden" name="token" value="69ccc810eb65d900c7571852ed2f21bc" > </form> <script src="http://www.gstatic.com/codesite/ph/13841197563397998716/js/prettify/prettify.js"></script> <script type="text/javascript"> prettyPrint(); </script> <script type="text/javascript" src="http://www.gstatic.com/codesite/ph/13841197563397998716/js/dit_scripts.js"></script> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"> </script> <script type="text/javascript" src="http://www.gstatic.com/codesite/ph/13841197563397998716/js/ph_core.js"></script> <script type="text/javascript" src="/js/codesite_product_dictionary_ph.pack.04102009.js"></script> </div> <div id="footer" dir="ltr"> <div class="text"> ©2011 Google - <a href="/projecthosting/terms.html">Terms</a> - <a href="http://www.google.com/privacy.html">Privacy</a> - <a href="/p/support/">Project Hosting Help</a> </div> </div> <div class="hostedBy" style="margin-top: -20px;"> <span style="vertical-align: top;">Powered by <a href="http://code.google.com/projecthosting/">Google Project Hosting</a></span> </div> </body> </html>
Go to most recent revision | Compare with Previous | Blame | View Log