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

📄 ch14.1.htm

📁 Verilog DHL教程
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML EXPERIMENTAL 970324//EN"><HTML><HEAD><META NAME="GENERATOR" CONTENT="Adobe FrameMaker 5.5/HTML Export Filter"><LINK REL="STYLESHEET" HREF="ch14.css"><TITLE> 14.1	Display system tasks</TITLE></HEAD><BODY BGCOLOR="#ffffff"><DIV><HR><P><A HREF="ch14.htm">Chapter&nbsp;&nbsp;start</A>&nbsp;&nbsp;&nbsp;<A HREF="ch14.htm">Previous&nbsp;&nbsp;page</A>&nbsp;&nbsp;<A HREF="ch14.2.htm">Next&nbsp;&nbsp;page</A></P></DIV><H1 CLASS="Section"><A NAME="pgfId=1200"> </A>14.1	<A NAME="71682"> </A>Display system tasks</H1><P CLASS="Body"><A NAME="pgfId=1225"> </A>The display group of system tasks are divided into three categories: the display and write tasks, strobed monitoring tasks, and continuous monitoring tasks.</P><P CLASS="SubSection"><A NAME="pgfId=844"> </A><A NAME="18128"> </A><A NAME="marker=26"> </A><A NAME="marker=27"> </A>The display and write tasks </P><DIV><H2 CLASS="Syntax"><A NAME="pgfId=846"> </A></H2><P CLASS="Body"><A NAME="pgfId=1254"> </A></P><DIV><IMG SRC="ch14-2.gif"></DIV><P CLASS="BNFCapBody"><A NAME="pgfId=849"> </A>Syntax&nbsp;14-1: Syntax for $display and $write system asks</P><P CLASS="Body"><A NAME="pgfId=768"> </A>These are the main system task routines for displaying information. The two sets of tasks are identical except that <A NAME="marker=34"> </A><B CLASS="Keyword">$display</B> automatically adds a newline character to the end of its output, whereas <A NAME="marker=35"> </A>the <B CLASS="Keyword">$write</B> task does not. </P><P CLASS="Body"><A NAME="pgfId=835"> </A>The <B CLASS="Keyword">$display</B> and <B CLASS="Keyword">$write</B> tasks display their arguments in the same order they appear in the argument list. Each argument can be a quoted string, an expression that returns a value, or a null argument.</P><P CLASS="Body"><A NAME="pgfId=851"> </A>The contents of string arguments are output literally except when certain <A NAME="marker=36"> </A>escape sequences are inserted to display special characters or specify the display format for a subsequent expression.</P><P CLASS="Body"><A NAME="pgfId=852"> </A>Escape sequences are inserted into a string in three ways: </P><UL><LI CLASS="DashedList"><A NAME="pgfId=853"> </A>The special character <A NAME="marker=37"> </A>\ indicates that the character to follow is a literal or non-printable character (see <A HREF="ch14.1.htm#11706" CLASS="XRef">See : Escape sequences for printing special characters</A>). </LI><LI CLASS="DashedList"><A NAME="pgfId=854"> </A>The special character <A NAME="marker=41"> </A><CODE CLASS="code">%</CODE> indicates that the next character should be interpreted as a format specification that establishes the display format for a subsequent expression argument (<A HREF="ch14.1.htm#30946" CLASS="XRef">See : Escape sequences for format specifications</A>). For each <CODE CLASS="code">%</CODE> character that appears in a string, a corresponding expression argument must be supplied after the string<A NAME="marker=45"> </A>.</LI><LI CLASS="DashedList"><A NAME="pgfId=855"> </A>The special character string <CODE CLASS="code">%%</CODE> indicates the display of the percent sign character <CODE CLASS="code">%</CODE> (see <A HREF="ch14.1.htm#11706" CLASS="XRef">See : Escape sequences for printing special characters</A>). </LI></UL><P CLASS="Body"><A NAME="pgfId=856"> </A>Any <A NAME="marker=49"> </A>null argument produces a single space character in the display. (A null argument is characterized by two adjacent commas<A NAME="marker=50"> </A> in the argument list.)</P><P CLASS="Body"><A NAME="pgfId=857"> </A>The <B CLASS="Keyword">$display</B> task, when invoked without arguments, simply prints a newline character. A <B CLASS="Keyword">$write</B> task supplied without parameters prints nothing at all.</P><P CLASS="SubSubSect"><A NAME="pgfId=859"> </A><A NAME="marker=51"> </A><A NAME="marker=52"> </A>E<A NAME="marker=53"> </A>scape sequences for special characters</P><P CLASS="Body"><A NAME="pgfId=861"> </A>The following escape sequences, when included in a string argument, cause special characters to be displayed:</P><TABLE><CAPTION><P CLASS="TableTitle"><A NAME="pgfId=845"> </A>Table&nbsp;14-1<A NAME="11706"> </A>:   Escape sequences for printing special characters</P></CAPTION><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1274"> </A>\n</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=804"> </A>is the <A NAME="marker=400"> </A>newline character</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1276"> </A>\t</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1228"> </A>is the tab character</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1278"> </A>\\</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1229"> </A>is the \ character</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1280"> </A>\&quot;</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1230"> </A>is the &quot; character</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1282"> </A>\o</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1231"> </A>is a character specified in 1-3 octal digits </P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1260"> </A>%%</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1271"> </A>is the % character</P></TD></TR></TABLE></DIV><DIV><H2 CLASS="Example"><A NAME="pgfId=865"> </A></H2><P CLASS="Body"><A NAME="pgfId=864"> </A></P><DIV><IMG SRC="ch14-3.gif"></DIV><P CLASS="SubSubSect"><A NAME="pgfId=868"> </A><A NAME="marker=61"> </A><A NAME="marker=62"> </A>F<A NAME="marker=63"> </A>ormat specifications </P><P CLASS="Body"><A NAME="pgfId=869"> </A><A HREF="ch14.1.htm#30946" CLASS="XRef">See : Escape sequences for format specifications</A> shows the escape sequences used for format specifications. Each escape sequence, when included in a string argument, specifies the display format for a subsequent expression. For each <CODE CLASS="code">%</CODE> character (except <CODE CLASS="code">%m</CODE>) that appears in a string, a corresponding expression must follow the string in the argument list. The value of the expression replaces the format specification when the string is displayed.</P><P CLASS="Body"><A NAME="pgfId=690"> </A>Any expression argument that has no corresponding format specification is displayed using the default decimal format in <B CLASS="Keyword">$display</B> and <B CLASS="Keyword">$write</B>, binary format in <B CLASS="Keyword">$displayb</B> and <B CLASS="Keyword">$writeb</B>, octal format in <B CLASS="Keyword">$displayo</B> and <B CLASS="Keyword">$writeo</B>, and hexadecimal format in <B CLASS="Keyword">$displayh</B> and <B CLASS="Keyword">$writeh</B>. </P><TABLE><CAPTION><P CLASS="TableTitle"><A NAME="pgfId=693"> </A>Table&nbsp;14-2<A NAME="30946"> </A>:   Escape sequences for format specifications</P></CAPTION><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=822"> </A>%<A NAME="marker=68"> </A><A NAME="marker=69"> </A>h or %H</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=823"> </A>display in hexadecimal format</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=824"> </A>%<A NAME="marker=70"> </A><A NAME="marker=401"> </A>d or %D</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=825"> </A>display in decimal format</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=826"> </A>%<A NAME="marker=402"> </A><A NAME="marker=403"> </A>o or %O</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=862"> </A>display in octal format</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=863"> </A>%<A NAME="marker=404"> </A><A NAME="marker=405"> </A>b or %B</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=867"> </A>display in binary format</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=870"> </A>%<A NAME="marker=406"> </A><A NAME="marker=407"> </A>c or %C</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=871"> </A>display in ASCII character format</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=872"> </A>%<A NAME="marker=408"> </A><A NAME="marker=409"> </A>v or %V</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=873"> </A>display net signal strength</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1232"> </A>%<A NAME="marker=410"> </A><A NAME="marker=411"> </A>m or %M</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1244"> </A>display <A NAME="marker=412"> </A>hierarchical name</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1245"> </A>%<A NAME="marker=413"> </A><A NAME="marker=414"> </A>s or %S</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1246"> </A>display as <A NAME="marker=415"> </A>a string</P></TD></TR><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1247"> </A>%<A NAME="marker=416"> </A><A NAME="marker=417"> </A>t or %T</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=1248"> </A>display in current time format</P></TD></TR></TABLE><P CLASS="Body"><A NAME="pgfId=706"> </A><A NAME="marker=56"> </A>The format specifications in <A HREF="ch14.1.htm#22396" CLASS="XRef">See : Format specifications for real numbers</A> are used with real numbers and have the full formatting capabilities available in the C language. For example, the format specification <CODE CLASS="code">%10.3g</CODE> specifies a minimum field width of 10 with 3 fractional digits. </P><TABLE><CAPTION><P CLASS="TableTitle"><A NAME="pgfId=803"> </A>Table&nbsp;14-3:   <A NAME="22396"> </A>Format specifications for real numbers</P></CAPTION><TR><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=875"> </A>%e or %E</P></TD><TD ROWSPAN="1" COLSPAN="1"><P CLASS="CellBody"><A NAME="pgfId=876"> </A>

⌨️ 快捷键说明

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