⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pacoblaze3b_tb.v.html

📁 和picoblaze完全兼容的mcu ip core
💻 HTML
📖 第 1 页 / 共 2 页
字号:
wrappage = (inc==1) ? first_page() : last_page();if (nextpage!="" || wrappage!="") {if (nextpage=="") { if (!confirm(text + " not found. Search again from "+((inc==1)?"first":"last")+" page?"))return false;nextpage=wrappage;}location=nextpage+ "?" + escape(text) + "&" + ( y - window.pageYOffset ) + "&" + inc;return false;}if (confirm(text + " not found. Search again from "+((inc==1)?"start":"end")+"?")) {if (inc==1) i=-1;else i=document.links.length;} else return false;}return true;}function loadqs() {var opt=location.search, text="", s="", y=0, si=0, inc=1;if (opt.length==0) return true;  for (var i=1;i<opt.length;i++) { if (opt.charAt(i) != "&") s += opt.charAt(i);else {if (text=="") text=unescape(s);else             y=s;s="";}}if (text=="") return true;if (s == "-1") { si=document.links.length-1; inc=-1; }window.scrollTo(0,0);search(text,y,si,inc);return true;}// --></script><body onload='loadqs();'><script language="JavaScript"type="text/javascript"><!--function prev_page() { return ""; }function last_page() { return ""; }// --></script><center><table class=NB cols=7 ><tr><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index.html';"><a target="_top" href="index.html">Hierarchy</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-f.html';"><a target="_top" href="index-f.html">Files</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-m.html';"><a target="_top" href="index-m.html">Modules</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-s.html';"><a target="_top" href="index-s.html">Signals</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-t.html';"><a target="_top" href="index-t.html">Tasks</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-fn.html';"><a target="_top" href="index-fn.html">Functions</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='http://www.burbleland.com/v2html/help_7_30.html?htf-ni-s-';"><a target="_top" href="http://www.burbleland.com/v2html/help_7_30.html?htf-ni-s-">Help</a></td></tr></table></center><pre><span class=C>/*
  Copyright (c) 2004, 2006 Pablo Bleyer Kocik.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

  3. The name of the author may not be used to endorse or promote products
  derived from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE AUTHOR &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED
  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.
*/</span>

<span class=C>/*
  PacoBlaze test
*/</span>

<a name="33"></a><span class=M>`define</span> <a  onClick="return qs(event,this,0)"  class=D href="cmprnd3_tb.v.html#5">PACOBLAZE3</a>
<a name="34"></a><span class=M>`define</span> <a  onClick="return qs(event,this,0)"  class=D href="compare3_tb.v.html#8">TEST_FILE</a> <span class=S>&quot;../test/pb3_int.rmh&quot;</span>

<span class=M>`include</span> <a  onClick="return qs(event,this,0)"  class=S href="timescale_inc.v.html">&quot;timescale_inc.v&quot;</a>
<span class=M>`include</span> <a  onClick="return qs(event,this,0)"  class=S href="pacoblaze_inc.v.html">&quot;pacoblaze_inc.v&quot;</a>

<span class=K>module</span> pacoblaze3_tb;

<span class=K>parameter</span> tck = 10, program_size = 1024;

<span class=K>reg</span> clk, rst, ir; <span class=C>// clock, reset, interrupt request
</span><span class=K>wire</span> [<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#73">code_depth</a>-1:0] ad; <span class=C>// instruction address
</span><span class=K>wire</span> [<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#60">operand_width</a>-1:0] pa, po; <span class=C>// port id, port output
</span><span class=K>wire</span> rd, wr; <span class=C>// read strobe, write strobe
</span><span class=M>`ifdef</span> <a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#40">HAS_INTERRUPT_ACK</a>
<span class=K>wire</span> ia; <span class=C>// interrupt acknowledge
</span><span class=M>`endif</span>

<span class=K>reg</span> [<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#60">operand_width</a>-1:0] prt[0:<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#83">port_size</a>-1]; <span class=C>// port memory
</span>
<span class=K>wire</span> [<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#72">code_width</a>-1:0] di; <span class=C>// program data input
</span><span class=K>wire</span> [<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#60">operand_width</a>-1:0] pi = prt[pa]; <span class=C>// port input
</span>
blockram #(.width(<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#72">code_width</a>), .depth(<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#73">code_depth</a>))
  rom(
  .clk(clk),
  .rst(rst),
  .en(1'b1),
  .we(1'b0),
  .ad(ad),
  .di(<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#72">code_width</a> 'b0),
  .do(di)
);

pacoblaze3 dut(
  .clk(clk),
  .reset(rst),
  .address(ad),
  .instruction(di),
  .port_id(pa),
  .read_strobe(rd),
  .write_strobe(wr),
  .in_port(pi),
  .out_port(po),
  .interrupt(ir)
<span class=M>`ifdef</span> <a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#40">HAS_INTERRUPT_ACK</a>
  , .interrupt_ack(ia)
<span class=M>`endif</span>
);

<span class=C>// clocking device
</span><span class=K>always</span> #(tck/2) clk = ~clk;

<span class=C>// write to port memory
</span><span class=K>always</span> @(<span class=K>posedge</span> clk) <span class=K>if</span> (wr) prt[pa] &lt;= po;

<span class=C>// initial setup
</span><span class=K>initial</span> <span class=K>begin</span>
  <span class=ST>$dumpvars</span>(1, dut);
  <span class=ST>$dumpfile</span>(<span class=S>&quot;pacoblaze3b_tb.vcd&quot;</span>);
  <span class=ST>$readmemh</span>(<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="#34">TEST_FILE</a>, rom.ram);
<span class=K>end</span>

<span class=C>// simulation
</span><span class=K>integer</span> i;
<span class=K>initial</span> <span class=K>begin</span>
  <span class=K>for</span> (i=0; i&lt;<span class=D>`</span><a  onClick="return qs(event,this,0)"  class=D href="pacoblaze_inc.v.html#83">port_size</a>; i=i+1) prt[i] = i; <span class=C>// initialize ports
</span>  clk = 0; rst = 1; ir = 1;
  #(tck*2);
  @(<span class=K>negedge</span> clk) rst = 0; <span class=C>// free processor
</span>
  #(program_size*tck+100) <span class=ST>$finish</span>;
<span class=K>end</span>

<span class=K>endmodule</span>
</pre><center><table class=NB cols=7 ><tr><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index.html';"><a target="_top" href="index.html">Hierarchy</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-f.html';"><a target="_top" href="index-f.html">Files</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-m.html';"><a target="_top" href="index-m.html">Modules</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-s.html';"><a target="_top" href="index-s.html">Signals</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-t.html';"><a target="_top" href="index-t.html">Tasks</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='index-fn.html';"><a target="_top" href="index-fn.html">Functions</a></td><td align="center" width="14%" onmousedown="this.style.border='inset';" onmouseup="this.style.border='outset';"  onclick="location='http://www.burbleland.com/v2html/help_7_30.html?htf-ni-s-';"><a target="_top" href="http://www.burbleland.com/v2html/help_7_30.html?htf-ni-s-">Help</a></td></tr></table></center><script language="JavaScript"type="text/javascript"><!--function next_page() { return ""; }function first_page() { return ""; }var extra_info = [[]];disabled=0;// --></script><hr><table> <tr><td><i>This page:</i></td>  <td><i>Maintained by:</i></td>  <td><i><a href="mailto:pablo.N@SPAM.bleyer.org">  pablo.N@SPAM.bleyer.org</a></i></tr><tr><td> </td>  <td><i>Created:</i></td><td><i>Tue May 29 02:37:53 2007</i></td></tr><tr> <td> </td> <td><i>From:</i></td><td><i>  <a href="pacoblaze3b_tb.v">pacoblaze3b_tb.v</a></i></td></tr></table><hr><table width="100%"><tr><td><i>Verilog converted to html by  <a target="_top" href="http://www.burbleland.com/v2html/v2html.html">  v2html 7.30</a>  (written by <a href="mailto:v2html730@burbleland.com">Costas Calamvokis</a>).</i></td><td align="right"><b><a href="http://www.burbleland.com/v2html/help_7_30.html?htf-ni-s-">Help</a></b></td></tr></table><table height="90%"><tr><td></td></tr></table></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -