📄 http:^^www.cs.cornell.edu^info^courses^spring-95^cs314^hw^proj2.html
字号:
MIME-Version: 1.0
Server: CERN/3.0
Date: Monday, 16-Dec-96 23:18:18 GMT
Content-Type: text/html
Content-Length: 5480
Last-Modified: Monday, 13-Mar-95 14:33:35 GMT
<html><head><title>PS314 Instruction Set Simulator</title></head><body>[<!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><!WA0><a href="http://www.cs.cornell.edu/Info/Courses/Spring-95/CS314/home.html">Back to CS314 Home Page</a>]<h1> Project 2: PS314 Instruction Set Simulator </h1><B>Date Assigned</B>: March 2, 1995<p><B>Date Due</B>: March 16, 1995<p>Before a new processor is built, the architects usually implement aninstruction-set simulator. This simulator runs programs written forthe new architecture so that the instruction set can be fine-tuned forusability and work on software can be started before the hardware isavailable.<p>This assignment involves the implementation of a PS314 instruction-setsimulator in M68K assembly language.We will give you an <!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><!WA1><a href="http://www.cs.cornell.edu/Info/Courses/Spring-95/CS314/hw/proj2.asm">M68K assembly language program</a>which accomplishespart of this task, and you will add whatever assembly language code is necessaryto make the simulator fully functional.<p>This project is due <b>Thursday, March 16</b> at the start of class.You are encouraged to work in groups of at most two in building thisprogram.<p>The completed program should simulate PS314 machine languageinstructions stored in a simulated PS314 memory. The simulatorshould:<ol><li>Actually only implement PS314 physical memory address <i>0</i> through<i>2^8 - 1</i>. An attempt by a (simulated) PS314 instruction to fetch or storea memory address in the range <i>2^8</i> through <i>2^15 - 1</i> should cause anexception.<li>Memory fetches and stores to addresses in the range <i>2^15</i> through<i>2^16 - 1</i> should cause input or output to occur. A memory fetch toan address <i>A</i> in this range should cause <i>A</i> to be printed out inhexadecimal, followed by a question mark, "?". The simulator shouldthen accept a 16-bit hexadecimal constant to be input from thekeyboard and should return that input as the fetched word. A memorystore to an address <i>A</i> in this range should cause <i>A</i> to be printedout in hexadecimal, followed by a colon, ":", and the value to bestored, also printed in hexadecimal.<li>When started, your PS314 simulator should enter an input loopwhich allows values to be entered into the simulated PS314 memory.The input loop should behave as follows:<blockquote>Read 2 16-bit hexadecimal constants, one per line. The first will bea count <i>L</i> (in words), the second will be a legal PS314 memoryaddress <i>A</i>. Your simulator should then read <i>L</i> hexadecimal 16-bitconstants---one per line---storing the first at memory location <i>A</i>,the second at <i>A + 1, ...</i> and the last at <i>A + ( L - 1 )</i>.</blockquote>This should be repeated until a count (<i>L</i>) of 0 is input.<li>The simulator should then start executing instructions from location <i>0</i>.<li>Once the simulated PS314 processor has executed a HALT instruction,the simulator should print, in hexadecimal, the contents of registers<i>D0, ..., D15, PC</i>, status register bits <i>N, Z, V, C</i>, and the contents of its memory addresses <i>0</i> through <i>2^8 - 1</i>.<li>Since there is no mechanism for creating a reset or I/O deviceinterrupt in the software simulator, these interrupts need not beaddressed.</ol><h2> What to Modify</h2>Make the following modifications to the PS314 instruction set simulator.<ol><li> Remove any bugs which might be lurking in the top-level fetch/execute loop.<li> Complete the implementation of any PS314 opcodes which are missing or not fully implemented.<li> Complete the implementation of any Bcc cases which are missing or not fully implemented.<li> Implement the I/O cases in LOAD and STORE.<li> Make HALT compliant with the PS314 specification.<li> Make sure that the simulator reads from/writes to valid M68k memory locations in all cases. In particular, look at the implementation of RTI and at the interruption handler. When could these routines make invalid memory accesses? Fix any problems that you find. If a bad memory access of this sort occurs in the interruption handler or in the RTI implementation, print an error message and halt the simulator.<li> Make any other modifications necessary to bring the simulator into compliance with the PS314 specification.</ol>Mark your modifications in the simulator source code with highly visiblecomments. Rows of asterisks accompanied by a word or two explanation of thetype of modification are recommended. A reader should be able to easily distinguishyour modifications from the original source code. Examples:<quote><pre> move.l a4,d4 ;***begin: insertion************************************* move.l d4,d5 ;***end: insertion*************************************** rts</pre></quote>and<quote><pre> move.l a4,d4 ;***deletion*********************************************</pre></quote><h2> What to Hand In</h2>Please hand in the following in a single envelope marked clearly with yourname(s):<ol><li> a hardcopy of the full source of the completed simulator program.<li>a hardcopy of the ouput produced by the <b>Listing/Run</b> option for thesimulator run on the example given in the PS314 Specification.<li>a hardcopy of the output produced by the <b>Run</b> option for the simulatorrun on your own additional test cases.<li>a disk containing the assembly language for your PS314 instruction-setsimulator (clearly named).</ol>[<!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><!WA2><a href="http://www.cs.cornell.edu/Info/Courses/Spring-95/CS314/home.html">Back to CS314 Home Page</a>]</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -