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

📄 第6节 verilog常用程序示例 -与非网专题: fpga开发实用教程.htm

📁 一百多个例子很好的verilog 学习资料
💻 HTM
📖 第 1 页 / 共 4 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0046)http://www.eefocus.com/html/08-03/37231s.shtml -->
<HTML><HEAD><TITLE>第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content=all name=robots>
<META 
content="Verilog基本模块     同步RS触发器    同步T触发器    同步D触发器     同步JK触发器    基本时序处理模块" 
name=keywords>
<META content=Verilog常用程序示例 name=description><LINK 
href="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/detail.css" type=text/css 
rel=stylesheet><LINK 
href="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/book_detail.css" type=text/css 
rel=stylesheet>
<SCRIPT language=JavaScript 
src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/main.js" type=text/javascript>
        </SCRIPT>

<SCRIPT language=JavaScript 
src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/article.js" 
type=text/javascript>
        </SCRIPT>

<SCRIPT language=JavaScript 
src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/translate_c.js" 
type=text/javascript>
        </SCRIPT>

<SCRIPT language=JavaScript type=text/javascript>
            _intlStrings._originalText = "";
            _intlStrings._interfaceDirection = "ltr";
            _intlStrings._interfaceAlign = "left"
        </SCRIPT>

<META content="MSHTML 6.00.2900.3020" name=GENERATOR></HEAD>
<BODY onselectstart="return false">
<SCRIPT>_setupIW();
        </SCRIPT>
<!--专题文章头部-->
<TABLE class=nav cellSpacing=0 cellPadding=0 width=946 align=center border=0>
  <TBODY>
  <TR>
    <TD class=nav_left_logo>&nbsp;</TD>
    <TD class=nav_list align=right><A href="http://www.eefocus.com/">网站首页</A> 
      │ <A href="http://www.eefocus.com/application/" target=_blank>系统应用</A> │ 
      <A href="http://www.eefocus.com/content/theory/">通用技术</A> │ <A 
      href="http://datasheet.eefocus.com/">数据手册</A> │ <A 
      href="http://www.eefocus.com/topic/">热点专题</A> │ <A 
      href="http://www.eefocus.com/job/">招聘求职</A> │ <A 
      href="http://www.eefocus.com/zhuanlan/">名家专栏</A> │ <A 
      href="http://www.eefocus.com/blog/">博客</A> │ <A 
      href="http://www.eefocus.com/bbs/" target=_blank>技术论坛</A> │ <A 
      href="http://www.eefocus.com/myspace/">我的空间</A></TD></TR></TBODY></TABLE><!--专题广告-->
<DIV class=banner><A 
href="http://www.eefocus.com/html/08-06/415531070314nUp7.shtml" 
target=_blank><IMG src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/logo.gif" 
width=946 border=0></A> </DIV><!--页面导航信息-->
<DIV class=nav_bar>
<DIV class=nav_left>您的位置:<A href="http://www.eefocus.com/">首页</A>&gt;&gt;<A 
href="http://www.eefocus.com/html/08-06/415531070314nUp7.shtml">FPGA开发实用教程</A>&gt;&gt;正文 
</DIV><A href="http://www.eefocus.com/"><IMG class=btn_home height=18 
src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/btn.gif" width=86 
align=absMiddle border=0></A> </DIV><!--页面内容-->
<DIV class=web>
<DIV id=main>
<DIV id=left>
<DIV id=bt>第6节 Verilog常用程序示例 </DIV>
<DIV id=xx>
<DL>
  <DD><A class=ulink href="http://www.eefocus.com/content/email.php">推荐给好友</A> 
  </DD>
  <DD><IMG height=18 hspace=5 
  src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/for_friend.gif" width=18 
  vspace=2> </DD>
  <DD><A class=ulink href="http://www.eefocus.com/content/print.php">打印</A> 
</DD>
  <DD><IMG height=18 hspace=5 
  src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/for_print.gif" width=18 
  vspace=2> </DD>
  <DD><A class=ulink href="http://www.eefocus.com/content/favorite.php">加入收藏</A> 
  </DD>
  <DD><IMG height=18 hspace=5 
  src="第6节 Verilog常用程序示例 -与非网专题: FPGA开发实用教程.files/for_favorite.gif" width=18 
  vspace=2> </DD>
  <DD></DD>
  <DD style="FLOAT: left">更新于2008-05-28 04:40:25 </DD></DL></DIV>
<HR style="CLEAR: both" align=center width="98%">

<DIV id=tags><A 
href="http://www.eefocus.com/search/?keyword=Verilog基本模块&amp;searchselect=article" 
target=_blank>Verilog基本模块</A> <A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=同步RS触发器&amp;searchselect=article" 
target=_blank>同步RS触发器</A> <A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=同步T触发器&amp;searchselect=article" 
target=_blank>同步T触发器</A> <A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=同步D触发器&amp;searchselect=article" 
target=_blank>同步D触发器</A> <A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=同步JK触发器&amp;searchselect=article" 
target=_blank>同步JK触发器</A> <A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=&amp;searchselect=article" 
target=_blank></A><A 
href="http://www.eefocus.com/search/?keyword=基本时序处理模块&amp;searchselect=article" 
target=_blank>基本时序处理模块</A> </DIV>
<DIV id=nr>
<P><STRONG>2.6.1 Verilog基本模块</STRONG> <BR><BR>1.触发器的Verilog实现 
<BR><BR>时序电路是高速电路的主要应用类型,其特点是任意时刻电路产生的稳定输出不仅与当前的输入有关,而且还与电路过去时刻的输入有关。时序电路的基本单元就是触发器。下面介绍几种常见同步触发器的Verilog实现。 
</P>
<UL>
  <LI>同步RS触发器 </LI></UL>
<P>RS触发器分为同步触发器和异步触发器,二者的区别在于同步触发器有一个时钟端clk,只有在时钟端的信号上升(正触发)或下降(负触发)时,触发器的输出才会发生变化。下面以正触发为例,给出其Verilog代码实现。 
<BR><BR>例2-15 正触发型同步RS触发器的Verilog实现。<BR><BR>module sy_rs_ff (clk, r, s, q, qb); 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input clk, r, s; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output q, qb; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; reg q; 
<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; assign qb = ~ q; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; always @(posedge clk) begin 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
case({r, s}) 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
2'b00: q &lt;= 0; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
2'b01: q &lt;= 
1;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2'b10: 
q &lt;= 0; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 

⌨️ 快捷键说明

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