99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

COP 3402 代做、代寫 c/c++,Python 程序
COP 3402 代做、代寫 c/c++,Python 程序

時間:2025-02-01  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



Homework 1: P-Machine
COP 3402: Systems Software
Spring 2025
See Webcourses  for due dates.
 
Purpose
In this homework you will form a team and implement a virtual machine called the P-machine.
Teams must be either 1 person team or 2 people team.
Directions
(100 points) Implement and submit the P-machine as described in the rest of this document.
 
For the implementation, your code must be written in ANSI standard C and must compile with gcc and run correctly on Eustis. We recommend using the flag -Wall and fixing all warnings.
What to Read
Our recommended book is Systems Software: Essential Concepts (by Montagne) in which we recommend reading chapters 1-3.
 
In this assignment, you will implement a virtual machine (VM) known as the P-machine (PM/0). 
 
P-Machine Architecture
The P-machine is a stack machine that conceptually has one memory area called the process address space (PAS). The process address space is divided into three contiguous segments: The first 10 locations, called “unused”, the “text”, which contains the instructions for the VM to execute and the “stack,” which is organized as a data-stack to be used by the PM/0 CPU.
Registers
The PM/0 has a few built-in registers used for its execution: The registers are named:
• base pointer (BP), which points to the base of the current activation record
• stack pointer (SP), which points to the current top of the stack. The stack grows downwards., 
• program counter (PC), which points to the next instruction to be executed.
• Instruction Register (IR), which store the instruction to be executed
The use of these registers will be explained in detail below. The stack grows downwards.
Instruction Format
The Instruction Set Architecture (ISA) of the PM/0 hasinstructions that each have three components, which are integers (i.e., they have the C type int) named as follows.
OP​is the operation code.
    L​indicates the lexicographical level (We will give more details on L below)
M​depending of the operators it indicates:
​- A number (when OP is LIT or INC).
​- A program address (when OP is JMP, JPC, or CAL).
​- A data address (when OP is LOD, STO)
​- The identity of the arithmetic/relational operation associated to the OPR op-code. 
    (e.g. OPR 0 2 (ADD) or OPR 0 4 (MUL))
    
The list of instructions for the ISA can be found in Appendix A and B.
P-Machine Cycles
The PM/0 instruction cycle conceptually does the following for each instruction: 
 
The PM/0 instruction cycle is carried out in two steps. The first step is the fetch cycle, where the instruction pointed to by the program counter (PC) is fetched from the “text” segment, placed in the instruction register (IR) and the PC is incremented to point to the next instruction in the code list. In the second stepthe instruction in the IR is executed using the “stack” segment. (This does not mean that the instruction is stored in the “stack segment.”)
Fetch Cycle:
1.- IR.OP ß pas[pc]
​IR.L   ß pas[pc + 1]  
​IR.M  ß pas[pc + 2]
​(note that each instruction need 3 entries in array “TEXT”. 
2.- (PCß PC + 3). 
 
Execute Cycle:
The op-code (OP) component in the IR register (IR.OP) indicates the operation to be executed. For example, if IRencodes the instruction “2 0 2”, then the machine adds the top two elements of the stack, popping them off the stack in the process, and stores the result in the top of the stack (so in the end sp is one less than it was at the start). Note that arithmetic overflows and underflows happen as in C int arithmetic.  ​​​​
PM/0 initial/Default Values
When the PM/0 starts execution. 
 
BP == 499, SP == 500, and PC == 10; 
 
This means that execution starts with the “text segment” element 10. Similarly, the initial “stack” segment values are all zero (BP=499 and SP = BP + 1).
 
The figure bellow illustrates the process address space:
 
 
                                  ​ ​ Last instruction    ​​ ​​​               BP   SP
     0              10                                                    
PAS    UNUSED              TEXT    OP    L    M                      STACK              ??? 
                                                                 499    500     
                    PC                                                            
 
Size Limits
 
Initial values for PM/0 CPU registers are:
BP = 499 
SP = BP + 1; 
PC = 10;
Initial process address space values are all zero:  
pas[0] =0, pas[1] =0, pas[3] =0…..[n-1] = 0. 
Constant Values:
ARRAY_SIZE is 500
 
 
Note: Be aware that in PM/0 the stack is growing downwards
Assignment Instructions and Guidelines: 
1. The VM must be written in C and must run on Eustis3. If it runs in your PC but not on Eustis, for us it does not run.
2. The input file name should be read as a command line argument at runtime, for example: $ ./a.out input.txt (A deduction of 5 points will be applied to submissions that do not implement this).
3. Program output should be printed to the screen, and should follow the formatting of the example in Appendix C. A deduction of 5 points will be applied to submissions that do not implement this.
4. Submit to Webcourses:
a) A readme text file indicating how to compile and run the VM
b) The source code of your PM/0 VM which should be named “vm.c”
c) A signed sheet indicating the contribution of each team member to the project.
d) Student names should be written in the header comment of each source code file, in the readme, and in the comments of the submission
e) Do not change the ISA. Do not add instructions or combine instructions. Do not change the format of the input. If you do so, your grade will be zero.
f) Include comments in your program. If you do not comments, your grade will be zero.
g) Do not implement each VM instruction with a function. If you do, a penalty of -100 will be applied to your grade. You should only have functions: main, base, auxiliary functions to print but you must not use functions to implement instructions or FETCH. (Appendix D).
h) The team member(s) must be the same for all projects. In case of problems within the team. The team will be split and each member must continue working as a one-member team for all other projects.
i) On late submissions:
o One day late 10% off.
o Two days late 20% off.
o Submissions will not be accepted after two days.
o Resubmissions are not accepted after two days.
o Your latest submission is the one that will be graded.
 
We will be using a bash script to test your programs. This means your program should follow the output guidelines listed (see Appendix C for an example). You don’t need to be concerned about whitespace beyond newline characters. We use diff -w.
 
 
 
 
 
 
Rubric:
If you submit a program from another semester or we detect plagiarism your grade is F for this course. 
Using functions to implement instructions even if only one is implemented that way, means that your grade will be “zero”.
Pointers and handling of dynamic data structures is not allowed. If you do your grade is “zero”.  Only file pointer is allowed.
-100 – Does not compile
10 – Compiles
25 – Produces lines of meaningful execution before segfaulting or looping infinitely
5 – Follows IO specifications (takes command line argument for input file name and prints output to console)
10 – README.txt containing author names
5 – Fetch cycle is implemented correctly
10 – Well commented source code
5 – Arithmetic instructions are implemented correctly
5 – Read and write instructions are implemented correctly
10 – Load and store instructions are implemented correctly
10 – Call and return instructions are implemented correctly
5 – Follows formatting guidelines correctly, source code is named vm.c
Appendix A 
 
Instruction Set Architecture (ISA) – (eventually we will use “stack” to refer to the    stack segment in PAS)
 
In the following tables, italicized names (such as p) are meta-variables that refer to integers.  If an instruction’s field is notated as “-“, then its value does not matter (we use 0 as a placeholder for such values in examples).
 
ISA:
01   – ​LIT​0, M​​Pushes a constant value (literal) M onto the stack
 
02   – ​OPR​0, M​​Operation to be performed on the data at the top of the stack.​​​ ​​(orreturn from function)
 
03   – ​LOD​L, M​​Load value to top of stack from the stack location at  offset M from L lexicographical levels down
​​​
04   – ​STO​L, M​​Store value at top of stack in the stack location at offset M 
  from L lexicographical levels down
 
05   – ​CAL​L, M​​Call procedure at code index M (generates new 
   Activation Record and PC ß M)
 
06   – ​INC​0, M​​Allocate M memory words (increment SP by M). First three​​​​​are reserved to   Static Link (SL), Dynamic Link (DL),                    ​​​​​and Return Address (RA)
 
07   – ​JMP​0, M​​Jump to instruction M (PC ßM)
 
08   – ​JPC 0, M​​Jump to instruction M if top stack element is 0
 
09   – ​SYS 0, 1​​Write the top stack element to the screen
 
  ​SYS 0, 2​​Read in input from the user and store it on top of the stack 
 
  SYS 0, 3​​End of program (Set “eop” flag to zero)
   
   
   
 
 
 
OP Code Number    OP Mnemonic    L    M    Comment (Explanation)
01    LIT    0    n    Literal push: sp ß sp- 1; pas[sp] ßn 
02    RTN    0    0    Returns from a subroutine is encoded 0 0 0 and restores the caller’s AR:
sp ← bp + 1; bp ← pas[sp - 2];  pc ← pas[sp -3];
03    LOD    n    a    Load value to top of stack from the stack location at offset o from n lexicographical levels down
sp ß sp - 1;
pas[sp] ß pas[base(bp, n) - o];
04    STO    n    o    Store value at top of stack in the stack location at offset o from n lexicographical levels down
pas[base(bp, n) - o] ß pas[sp];
sp = sp +1;
05    CAL    n    a    Call the procedure at code address a, generating a new activation record and setting PC to a:
pas[sp - 1]  ß  base(bp, n); /* static link (SL)
pas[sp - 2]  ß bp;​/* dynamic link (DL)
pas[sp - 3]  ß pc;​ /*return address (RA)​
bp ß sp - 1;
pc ß a;
06    INC    0    n    Allocate n locals on the stack
sp ß sp - n;
07    JMP    0    a    Jump to address a:
PC ← a
08    JPC    0    a    Jump conditionally: if the value in stack[sp] is 0, then jump to a and pop the stack:if (stack[SP] == 0) then { pc (← a; } sp ← sp+1
09    SYS    0    1    Output of the value in stack[SP] to standard output as a character and pop:putc(stack[sp]); sp ← sp+1
(You can use printf if you wish) 
     SYS    0    2    Read an integer, as character value, from standard input (stdin) and store it on the top of the stack.sp ← sp-1; stack[sp] ← getc(); 
(You can use fscanf if you wish)
     SYS    0    3    Halt the program (Set “eop” flag to zero)
 
Appendix B (Arithmetic/Logical Instructions)
 
ISA Pseudo Code
   
 
02 – OPR  0, #​​(1 <= # <= 10)
    
 
​​​​1​ADD​​pas[sp + 1] ß pas[sp + 1] + pas[sp]
​​​​​​​sp ß sp + 1;
 
  2​SUB​​pas[sp + 1] ß pas[sp + 1] - pas[sp]
​​​​​​​sp ß sp + 1;
 
  3​MUL​​pas[sp + 1] ß pas[sp + 1] * pas[sp]
​​​​​​​sp ß sp + 1;
 
  4​DIV​​pas[sp + 1] ß pas[sp + 1] / pas[sp]
​​​​​​​sp ß sp + 1;
 
  5​EQL​​pas[sp + 1] ß pas[sp + 1] == pas[sp]
​​​​​​​sp ß sp + 1;
 
  6​NEQ​​pas[sp + 1] ß pas[sp + 1] != pas[sp]
​​​​​​​sp ß sp + 1;
 
  7​LSS​​pas[sp + 1] ß pas[sp + 1] < pas[sp]
​​​​​​​sp ß sp + 1;
 
  8​LEQ​​pas[sp + 1] ß pas[sp + 1] <= pas[sp]
​​​​​​​sp ß sp + 1;
 
  9​GTR​​pas[sp + 1] ß pas[sp + 1] > pas[sp]
​​​​​​​sp ß sp + 1;
 
  10​GEQ​​pas[sp + 1] ß pas[sp + 1] >= pas[sp]
​​​​​​​sp ß sp + 1;
 
   
 
 
 
 
Appendix C
Example of Execution
 
This example shows how to print the stack after the execution of each instruction.
 
INPUT FILE (In this example the program was stored at memory address zero)
For every line, there must be 3 values representing OP, Land M.
 
7 0 45
7 0 6
6 0 4
1 0 4
1 0 3
2 0 3
4 1 4
1 0 14
3 1 4
2 0 7
8 0 39
1 0 7
7 0 42
1 0 5
2 0 0
6 0 5
9 0 2
5 0 6
9 0 1
9 0 3
 
When the input file (program) is read in to be stored in the text segment starting at location 10 in the process address space, each instruction will need three memory locations to be stored. Therefore, the PC must be incremented by 3 in the fetch cycle.
 
10              13              16              19              22              25              …
7    0    45    7    0    6    6    0    4    1    0    4    1    0    3    2    0    4    etc
 
 
The initial CPU register values for the example in this appendix are:
SP = 500;
BP = SP - 1; 
PC = 10;
IR  = 0 0 0; (a struct or a linear array can be used to implement IR) 
Hint: Each instruction uses 3 array elements and each data value just uses 1 array element. 
 
 
OUTPUT FILE (In this example the program was storedat memory address zero)
Print out the execution of the program in the virtual machine, showing the stack and pc, bp, and sp.
 
NOTE: It is necessary to separate each Activation Record with a bar “|”.  
 
​​​​PC​BP​SP​stack
Initial values:​10​499​500
 
​JMP​0​45​45​499​500​
​INC​0​5​48​499​495​0 0 0 0 0 
Please Enter an Integer: 3
​SYS​0​2​51​499​494​0 0 0 0 0 3 
​CAL​0​6​6​493​494​0 0 0 0 0 3 
​INC​0​4​9​493​490​0 0 0 0 0 3 | 499 499 54 0 
​LIT​0​4​12​493​489​0 0 0 0 0 3 | 499 499 54 0 4 
​LIT​0​3​15​493​488​0 0 0 0 0 3 | 499 499 54 0 4 3 
​MUL​0​3​18​493​489​0 0 0 0 0 3 | 499 499 54 0 12 
​STO​1​4​21​493​490​0 0 0 0 12 3 | 499 499 54 0 
​LIT​0​14​24​493​489​0 0 0 0 12 3 | 499 499 54 0 14 
​LOD​1​4​27​493​488​0 0 0 0 12 3 | 499 499 54 0 14 12 
​LSS​0​7​30​493​489​0 0 0 0 12 3 | 499 499 54 0 0 
​JPC​0​39​39​493​490​0 0 0 0 12 3 | 499 499 54 0 
​LIT​0​5​42​493​489​0 0 0 0 12 3 | 499 499 54 0 5 
​RTN​0​0​54​499​494​0 0 0 0 12 3 
Output result is: 3
​SYS​0​1​57​499​495​0 0 0 0 12 
​SYS​0​3​60​499​495​0 0 0 0 12 
 
 
 
 
Appendix D
 
Helpful Tips
 
This function will be helpful to find a variable in a different Activation Record some L levels down:
 
/**********************************************/
/*​​Find base L levels down​​ */
/*​​​​​​​ */
/**********************************************/
 
int base( int BP, int L)
{
​int arb = BP;​// arb = activation record base
​while ( L > 0)     //find base L levels down
​{
​​arb = pas[arb];
​​L--;
​}
​return arb;
}
 
For example in the instruction:
 
STO L, M  - You can do stack [base (IR.L) +  IR.M]= pas[SP] to store the content of  the top of the stack into an AR in the stack,  located L levels down from the current AR.
 
Note1: we are working at the CPU level therefore the instruction format must have only 3 fields. Any program whose number of fields in the instruction format is graterthan 3 will get a zero.
 
Note2: If your program does not follow the specifications, your grade will get a zero.
 
Note3: if any of the instructions is implemented by calling a function, your grade will be zero.
 
Note4: If you use dynamic memory handling, your grade will be zero.
 
Note5: Pointers are not allowed, except to read a file.

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp




​​​​​​​

掃一掃在手機打開當前頁
  • 上一篇:代寫指標 通達信【備戰龍妖】副圖指標
  • 下一篇:代寫 CMU 18-879、代做 Python 編程語言
  • ·CIV6782代做、代寫Python程序語言
  • ·CS305程序代做、代寫Python程序語言
  • ·代寫FN6806、代做c/c++,Python程序語言
  • ·代寫CS-UY 4563、Python程序語言代做
  • ·CE235編程代寫、代做python程序設計
  • ·COMP2010J代做、代寫c/c++,Python程序
  • ·COMP09110代做、代寫Python程序設計
  • ·&#160;COMP338編程代做、代寫Python程序語言
  • ·代寫MATH36031、Python程序設計代做
  • ·CDS523編程代寫、代做Python程序語言
  • 合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                亚洲国产综合在线| 91精品中文字幕一区二区三区| 九一久久久久久| 欧美精品丝袜中出| 麻豆国产精品一区二区三区| 欧美老女人在线| 一区二区三区欧美久久| 97精品视频在线观看自产线路二| 国产精品传媒视频| 欧美中文字幕一区二区三区| 亚洲电影在线免费观看| 日韩视频一区二区三区在线播放 | 日韩精品一区二区三区四区 | 久久精品欧美日韩精品| 高清在线观看日韩| 亚洲国产欧美日韩另类综合| 日韩你懂的在线观看| 成人手机电影网| 免费在线观看精品| 最新成人av在线| 欧美一区二区三区四区视频| 成人永久aaa| 美女在线视频一区| 亚洲女人****多毛耸耸8| 欧美不卡一区二区三区四区| 91视视频在线观看入口直接观看www | 久久99久久精品欧美| 中文乱码免费一区二区| 精品污污网站免费看| 国产不卡视频一区| 奇米精品一区二区三区在线观看一| 久久久99精品免费观看| 欧美四级电影网| 成人一级视频在线观看| 亚洲第一福利视频在线| 亚洲同性gay激情无套| 欧美大片在线观看一区| 欧美性生活大片视频| 91蜜桃在线免费视频| 粗大黑人巨茎大战欧美成人| 蜜臀av一区二区在线免费观看 | 日韩一级片在线播放| 色综合 综合色| 成人小视频在线| 韩国理伦片一区二区三区在线播放| 亚洲国产sm捆绑调教视频 | 精品国产91久久久久久久妲己| 91国产福利在线| 91原创在线视频| 成人深夜视频在线观看| 成人小视频免费在线观看| 国内外精品视频| 久久99国产精品麻豆| 乱一区二区av| 国模娜娜一区二区三区| 久久99国产乱子伦精品免费| 久久精品99国产精品| 久久国产精品色婷婷| 狠狠色丁香久久婷婷综合_中 | 欧美一区二区三区的| 91精品久久久久久久91蜜桃| 欧美蜜桃一区二区三区| 欧美伦理影视网| 欧美xfplay| 久久久国产精品不卡| 国产精品女上位| 亚洲男人天堂av| 午夜精品福利在线| 狠狠色伊人亚洲综合成人| 国产成人在线视频播放| 91网站最新地址| 欧美人与性动xxxx| 亚洲精品一区二区三区在线观看| 2020日本不卡一区二区视频| 国产精品久久久久久久久免费桃花| 一区二区三区加勒比av| 日本美女视频一区二区| 免费精品视频最新在线| 婷婷丁香激情综合| 国产一区二区三区视频在线播放| 成人激情免费视频| 欧洲在线/亚洲| 欧美一卡二卡在线| 日本一区二区综合亚洲| 亚洲高清视频在线| 国产精品正在播放| 欧美亚洲尤物久久| 精品欧美一区二区三区精品久久 | 97精品久久久久中文字幕| 欧美日韩一卡二卡三卡| 久久综合精品国产一区二区三区| 亚洲区小说区图片区qvod| 秋霞午夜鲁丝一区二区老狼| 白白色 亚洲乱淫| 日韩欧美国产wwwww| 一级女性全黄久久生活片免费| 美女一区二区视频| 91香蕉视频污| 国产亚洲欧美日韩在线一区| 亚洲国产一区二区三区青草影视| 国产一区二区视频在线| 欧美日韩午夜影院| 亚洲色图19p| 国产精品一区免费视频| 日韩视频免费直播| 亚洲第一电影网| 99riav一区二区三区| 亚洲精品一区二区三区福利| 亚洲一二三四在线| 91视频在线看| 国产人伦精品一区二区| 久久99最新地址| 欧美一区二区三区免费观看视频| 亚洲国产乱码最新视频| av成人动漫在线观看| 国产欧美精品区一区二区三区 | 国产一区二区看久久| 91精品国产全国免费观看| 亚洲国产人成综合网站| 在线观看亚洲a| 亚洲蜜臀av乱码久久精品| 高清国产一区二区三区| 国产亚洲婷婷免费| 国产精品18久久久久久久久 | 欧美一区二区三区在线视频 | 国产精品高潮久久久久无| 秋霞电影一区二区| 日韩免费观看高清完整版| 蜜臀91精品一区二区三区| 在线日韩一区二区| 午夜a成v人精品| 在线综合+亚洲+欧美中文字幕| 中文字幕在线不卡一区| 大胆亚洲人体视频| 国产精品系列在线| 成人免费看片app下载| 国产精品久久久久精k8 | 成人三级伦理片| 国产视频一区在线播放| 国产福利一区二区三区在线视频| 久久久噜噜噜久久中文字幕色伊伊 | 精品久久久三级丝袜| 日韩一区精品字幕| 欧美人动与zoxxxx乱| 天堂成人国产精品一区| 4438成人网| 久久99精品久久久久久| 蜜桃久久久久久| 日韩欧美国产成人一区二区| 免费高清在线视频一区·| 日韩欧美国产麻豆| 成人免费视频caoporn| 亚洲日穴在线视频| 欧美日韩成人综合天天影院| 午夜一区二区三区在线观看| 欧美日韩色综合| 国产乱码精品一区二区三区忘忧草 | 成人永久aaa| 亚洲一区在线电影| 欧美一区二区三区免费视频 | 日韩中文字幕区一区有砖一区 | eeuss影院一区二区三区 | 国产风韵犹存在线视精品| **性色生活片久久毛片| 欧美极品美女视频| 在线视频一区二区免费| 免费看日韩a级影片| 久久蜜桃av一区二区天堂| 91色porny在线视频| 97久久超碰国产精品| 欧美精品第一页| 秋霞电影一区二区| 日韩欧美二区三区| 轻轻草成人在线| 国产欧美在线观看一区| 色婷婷一区二区| 国产伦精品一区二区三区免费迷 | 成人黄色小视频| 日本一区二区三区久久久久久久久不 | 国产老妇另类xxxxx| 亚洲卡通动漫在线| 精品久久一区二区| 欧美三级电影在线看| 丁香网亚洲国际| 免费在线观看一区二区三区| 亚洲欧美中日韩| 91精品国产日韩91久久久久久| 91亚洲精品乱码久久久久久蜜桃| 美女诱惑一区二区| 性感美女久久精品| 中文字幕综合网| 中日韩av电影| 久久久亚洲综合| 日韩一区二区三区四区 | 精品国产91乱码一区二区三区 | 欧美丝袜第三区| 色国产综合视频| www.日本不卡| 久久国产精品72免费观看| 天堂久久一区二区三区|