我正在尝试匹配以下行之间的字体:reg [8:0] data_saved [0:3]; //内存声明
以及 lstlisting 中的其余行。我得到的结果如下:
我的代码如下:
\documentclass [11pt] {article}
\usepackage{epsfig}
\usepackage{enumitem}
\usepackage{url}
\usepackage{epstopdf}
\usepackage{listings}
\input std-defs
\input EECE2323-header
\begin{document}
\noindent
\lab{3}{LAB3 - Arithmetic and Logic Unit Part II and Register File}
\texttt{reg [8:0] data\_saved [0:3]; // memory declaration }
and then initialize its values with the \texttt{initial} declaration:
\begin{lstlisting}[xleftmargin=10em]
// Initialize Inputs Stimulus
initial
begin
data_saved[0] = 9'b000000001;
data_saved[1] = 9'b000000010;
data_saved[2] = 9'b000000011;
data_saved[3] = 9'b000000100;
end
\end{lstlisting}
\textbf{Use alu\_reg\_file\_tb.v as your Testbench template.}
\end{document}
但如果我尝试添加\texttt
到列表,我只会\texttt
在文本中看到该单词。
有什么想法吗?谢谢!
答案1
你应该\lstset
在序言中有一个指示:
\documentclass [11pt] {article}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{url}
\usepackage{epstopdf}
\usepackage{listings}
%\input std-defs
%\input EECE2323-header
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
}
\begin{document}
%\noindent
%\lab{3}{LAB3 - Arithmetic and Logic Unit Part II and Register File}
\texttt{reg [8:0] data\_saved [0:3]; // memory declaration }
and then initialize its values with the \texttt{initial} declaration:
\begin{lstlisting}[xleftmargin=10em]
// Initialize Inputs Stimulus
initial
begin
data_saved[0] = 9'b000000001;
data_saved[1] = 9'b000000010;
data_saved[2] = 9'b000000011;
data_saved[3] = 9'b000000100;
end
\end{lstlisting}
\textbf{Use alu\_reg\_file\_tb.v as your Testbench template.}
\end{document}
我已注释掉无法使用的部分(两个\input
指令和带有宏的行),但除了将对 的调用更改为对 的调用\lab
外,其余部分我没有触及文件。前一个包已过时,不应在新文档中使用。epsfig
graphicx