?? ch03.a.htm
字號:
<HTML><HEAD> <META NAME="GENERATOR" CONTENT="Adobe PageMill 2.0 Mac"> <LINK REL="STYLESHEET" HREF="ch03.css"> <TITLE> 3.10 Parameters </TITLE></HEAD><BODY BGCOLOR="#ffffff"><P><A NAME="pgfId=588"></A><HR ALIGN=LEFT></P><P><A HREF="ch03.htm">Chapter start</A> <A HREF="ch03.9.htm">Previous page</A> <A HREF="ch03.b.htm">Next page</A></P><H1>3.10 Parameters</H1><P><P CLASS="Body"><A NAME="pgfId=591"></A>Verilog HDL parameters do notbelong to either the register or the net group. Parameters are not variables,they are constants.</P><P><P CLASS="Body"><A NAME="pgfId=626"></A>The syntax for parameter declarationsis as follows:</P><PRE><A NAME="pgfId=1413"></A> parameter_declaration ::= <B>parameter</B> list_of_param_assignments <B>;</B><A NAME="pgfId=1414"></A> list_of_param_assignments ::= param_assignment { <B>,</B> param_assignment }<A NAME="pgfId=1415"></A> param_assignment ::= parameter_identifier <B>=</B> constant_expression</PRE><P><P CLASS="BNFCapBody"><A NAME="pgfId=593"></A>Syntax 3-4: Syntaxfor parameter_declaration</P><P><P CLASS="Body"><A NAME="pgfId=594"></A>The list of param assignmentsshall be a comma-separated list of assignments, where the right-hand sideof the assignment shall be a constant expression, that is, an expressioncontaining only constant numbers and previously defined parameters.</P><P><P CLASS="Body"><A NAME="pgfId=634"></A>Parameters represent constants,hence it is illegal to modify their value at runtime. However, parameterscan be modified at compilation time to have values that are different fromthose specified in the declaration assignment. This allows customizationof module instances. A parameter can be modified with the <B>defparam</B>statement, or in the module instance statement. Typical uses of parametersare to specify delays and width of variables. See Section 12, for detailson parameter value assignment.</P><P><P CLASS="Body"><A NAME="pgfId=545"></A>Examples:</P><PRE><A NAME="pgfId=635"></A> <B> parameter</B> msb = 7; // defines msb as a constant value 7<B> parameter</B> e = 25, f = 9; // defines two constant numbers<B> parameter</B> r = 5.7; // declares r as a real parameter<B> parameter</B> byte_size = 8, byte_mask = byte_size - 1;<B> parameter</B> average_delay = (r + f) / 2;</PRE><P><HR ALIGN=LEFT></P><P><A HREF="ch03.htm">Chapter start</A> <A HREF="ch03.9.htm">Previous page</A> <A HREF="ch03.b.htm">Next page</A></BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -