📄 http:^^www.cs.wisc.edu^~cs354-2^cs354^homeworks^a1hw.html
字号:
Date: Tue, 05 Nov 1996 00:31:58 GMTServer: NCSA/1.5Content-type: text/htmlLast-modified: Sat, 07 Sep 1996 23:25:08 GMTContent-length: 2313<!--This file created 9/6/96 3:18 PM by Claris Home Page version 1.0b1--><HTML><HEAD> <TITLE>a1hw.html</TITLE> <X-SAS-WINDOW TOP=12 BOTTOM=367 LEFT=-675 RIGHT=-145></HEAD><BODY><H1 ALIGN=CENTER><FONT SIZE=5>CS354, Fall 1996</FONT></H1><H1 ALIGN=CENTER><FONT SIZE=5>Homework 1, due Wednesday September 18at the start of class.</FONT></H1><H3><TABLE BORDER=1 CELLPADDING=1 WIDTH="100%" HEIGHT=35> <TR> <TD> <P><B><FONT SIZE=4 COLOR="#AF0000">Name (printed):</FONT></B> </TD><TD> <P><B><FONT SIZE=4 COLOR="#AF0000">Name (signed):</FONT></B> </TD></TR></TABLE></H3><P>(1) T/F, 10 points, 1 point each</P><BLOCKQUOTE><P>Note: The complete SAL instruction set is given inAppendix A of the textbook, page 386.</P><P>(a) all variables in SAL programs are global</P><P>(b) the SAL statement "get x" works the same for all types of "x"</P><P>(c) the label "b" could be used for a variable in a SAL program</P><P>(d) variables must be declared before they are used in SALprograms</P><P>(e) when executed, the SAL statement "b (ret)" will cause a branchto the SAL statement labeled by "ret:"</P><P>(f) when executed, the SAL statement "j ret" will cause a branchto the SAL statement labeled by "ret:"</P><P>(g) every SAL program must have a "__start:" label in it somewhere</P><P>(h) "done" is part of the SAL instruction set</P><P>(i) "rem" is used to put a remark or comment in a SAL program</P><P>(j) type declarations are made in SAL programs so that typechecking can be done by the assembler</P></BLOCKQUOTE><P> </P><P>(2) 2 points</P><BLOCKQUOTE><P>In a single sentence, explain what "computerarchitecture" means.</P></BLOCKQUOTE><P> </P><P> </P><P>(3) 8 points</P><BLOCKQUOTE><P>Translate the following C code into the equivalent SALstatements. Assume that all variables are of C type "int."</P><P><FONT COLOR="#0000AF">if ((A > 0 ) || ( B == 1 )) {</FONT></P><BLOCKQUOTE><P><FONT COLOR="#0000AF">C = A + B * 5;</FONT></P></BLOCKQUOTE><P><FONT COLOR="#0000AF">} else {</FONT></P><BLOCKQUOTE><P><FONT COLOR="#0000AF">A++;</FONT></P><P><FONT COLOR="#0000AF">B = ( A / B ) % C;</FONT></P></BLOCKQUOTE><P><FONT COLOR="#0000AF">}</FONT></P></BLOCKQUOTE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -