合肥生活安徽新聞合肥交通合肥房產(chǎn)生活服務(wù)合肥教育合肥招聘合肥旅游文化藝術(shù)合肥美食合肥地圖合肥社保合肥醫(yī)院企業(yè)服務(wù)合肥法律

        CS 61程序代做、代寫C/C++編程設(shè)計

        時間:2024-02-08  來源:合肥網(wǎng)hfw.cc  作者:hfw.cc 我要糾錯



        CS 61 - Programming Assignment 3
        Objective
        The purpose of this assignment is to give you more practice with I/O, and with left-shifting, aka
        multiplying by 2, and useful 2’s complement logic.
        High Level Description
        Store a number to the memory address specified in your assn 3 template. In your program, load
        that number to a register, and display it to the console as a 16-bit two's complement binary (i.e.
        display the binary value stored in the register, as a sequence of 16 ascii '1' and '0' characters).
        Note: Valid numbers are [#-**768, #**767] (decimal) or [x0000, xFFFF] (hex)
        Your Tasks
        You do not yet know how to take a multi-digit decimal number from user ascii input and convert it
        to binary, so for this assignment you are going to let the assembler do that part for you:
        you will use the .FILL pseudo-op to take a literal (decimal or hex, as you wish) and translate it into a
        16-bit two's complement binary, which will be stored in the indicated memory location; and then
        you will Load that value from memory into a register.
        You MUST use the provided assn3.asm template to set this up: it ensures that the number to be
        converted is always stored in the same location (the memory address specified in your template)
        so we can test your work; make sure you fully understand the code fragment we provide.
        At this point, your value will be stored in, say, R1: it is now your job to identify the 1’s and 0’s from
        the number and print them out to the console one by one, from left (the leading bit, aka the
        leftmost bit, aka bit 15, aka the most significant bit) to right (the trailing bit, aka the rightmost bit,
        aka bit 0, aka the least significant bit).
        Important things to consider:
        ● Recall the difference between a positive number and a negative number in 2’s complement
        binary: if the most significant bit (MSB) is 0, the number is considered positive (or zero);
        if it is 1, the number is negative.
        ● The BRanch instruction has parameters (n, z, p) which tell it to check whether the LMR (Last
        Modified Register) is negative, zero, or positive (or any combination of such tests).
        Hint: what can you say about the msb of the LMR if the n branch is taken?
        Review the workings of the NZP condition codes and the BR instruction here .
        ● Once you are done inspecting the MSB and printing the corresponding ascii '0' or '1', how would
        you shift the next bit into its place so you could perform the next iteration?
        Hint: the answer is in the objectives!
        Pseudocode:
        for(i = 15 downto 0):
        if (msb is a 1):
        print a 1
        else:
        print a 0
        shift left
        Note on creating LC-3 "control structures"
        See here for tips on creating LC-3 versions of the branch and loop control structures you are familiar
        with from C++ (Resources -> LC-3 Resources -> LC3 Assembly Language -> Control Structures in LC3)
        Expected/ Sample output
        In this assignment, your output will simply be the contents of R1, printed out as 16 ascii 1's and 0's,
        grouped into packets of 4, separated by spaces (as always, newline terminated, but with NO
        terminating space!)
        So if the hard coded value was xABCD, your output will be:
        1010 1011 1100 1101
        (The value stored to memory with .FILL was xABCD)
        Note:
        1. There are spaces after the first three "packets" of 4 bits (but no space character at end!)
        2. There is a newline after the output - again, there is NO space before the newline
        3. You must use the memory address specified in your template to hold the value to be output
        Your code will obviously be tested with a range of different values: Make sure you test your code
        likewise!
        Uh…help?
        ● MSB
        ○ Stands for Most Significant Bit
        ■ aka “left most bit” or “leading bit” or bit 15
        ○ When MSB is 0:
        ■ Means that the number is Not Negative (Positive or Zero)
        ○ When MSB is 1:
        ■ Means that the number is Negative
        ○ Further Reading
        ■ https://en.wikipedia.org/wiki/Most_significant_bit
        ● Left Shifting
        Left shifting means that you shift all the bits to the left by 1: so the MSB is lost, and is replaced
        by the bit on its right. A 0 is "shifted in" on the right to replace the previous LSB.
        4-bit Example:
        0101 ; #5
        When Left Shifted, with 0 shifted in to LSB:
        1010 <---- 0101
        1010 ; #10
        What happened when we left shifted? How did the number change?
        When left shifting, the number gets multiplied by 2? Why 2?
        Well, what happens when you shift a decimal number one place to the left? Why?
        (Practical differences between decimal and binary numbers are that we don't usually limit
        decimal numbers to a specific number of places, nor do we usually pad them with leading zeros).
        Further Reading
        ● https://en.wikipedia.org/wiki/Logical_shift
        Submission Instructions
        Submit ("Upload") your assignment3.asm file (and ONLY that file!) to the Programming Assignment 3
        folder in Gradescope: the Autograder will run & report your grade within a minute or so.
        You may submit as many times as you like - your assignment grade will normally be that of your last
        submission.
        If you wish to set your grade to a previous submission with a higher score, you may open your
        "Submission history" and "Activate" any other submission - that's the one we will see.
        Rubric
        ● To pass the assignment, you need a score of >= 80%.
        The autograder will run several tests on your code, and assign a grade for each.
        But certain errors (run-time errors, incorrect usage of I/O routines, missing newlines, etc.) may
        cause ALL tests to fail => 0/100! So submit early and study the autograder report carefully!!
        ● You must use the template we provide - if you make any changes to the provided starter code,
        the autograder may not be able to interpret the output, resulting in a grade of 0.
        如有需要,請加QQ:99515681 或WX:codehelp

        掃一掃在手機(jī)打開當(dāng)前頁
      1. 上一篇:CISC3025代做、代寫Java,c++設(shè)計編程
      2. 下一篇:代寫Computer Security and Networks編程
      3. 無相關(guān)信息
        合肥生活資訊

        合肥圖文信息
        出評 開團(tuán)工具
        出評 開團(tuán)工具
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        挖掘機(jī)濾芯提升發(fā)動機(jī)性能
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)400(全國服務(wù)熱線)
        戴納斯帝壁掛爐全國售后服務(wù)電話24小時官網(wǎng)
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話24小時服務(wù)熱線
        菲斯曼壁掛爐全國統(tǒng)一400售后維修服務(wù)電話2
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時客服熱線
        美的熱水器售后服務(wù)技術(shù)咨詢電話全國24小時
        海信羅馬假日洗衣機(jī)亮相AWE  復(fù)古美學(xué)與現(xiàn)代科技完美結(jié)合
        海信羅馬假日洗衣機(jī)亮相AWE 復(fù)古美學(xué)與現(xiàn)代
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士4號線
        合肥機(jī)場巴士3號線
        合肥機(jī)場巴士3號線
      4. 上海廠房出租 短信驗(yàn)證碼 酒店vi設(shè)計

        主站蜘蛛池模板: 国产A∨国片精品一区二区| 亚洲一区二区三区在线网站| 中文乱码字幕高清一区二区| 精品91一区二区三区| 亚洲老妈激情一区二区三区| 多人伦精品一区二区三区视频| 99精品高清视频一区二区| 国产福利一区二区三区视频在线| 国产精品一区二区资源| 91久久精品午夜一区二区| 久久精品国产一区二区三区| 亚洲色精品三区二区一区| 色狠狠AV一区二区三区| 99精品久久精品一区二区| 精品福利一区3d动漫| 国产精品无码一区二区三区毛片| 午夜天堂一区人妻| 国产乱码精品一区二区三区中文 | 日韩美女视频一区| 2021国产精品一区二区在线 | 欧美成人aaa片一区国产精品| 国产日韩AV免费无码一区二区| 国产免费私拍一区二区三区| 精品人妻一区二区三区浪潮在线| 中文字幕日本一区| 日本精品一区二区三区四区| 国产一区二区三区乱码在线观看| 日韩精品无码一区二区中文字幕 | 欧美激情一区二区三区成人| 人妻天天爽夜夜爽一区二区| 精品乱人伦一区二区三区| 日本精品一区二区三区四区| 国产成人一区二区三区免费视频 | 亚洲国产AV一区二区三区四区| 国产成人一区二区三区视频免费 | 天堂不卡一区二区视频在线观看| 久久中文字幕无码一区二区| 国产精品一区二区久久精品| 亚洲一区二区电影| 亚洲一区二区三区在线观看蜜桃| 久久精品国产第一区二区三区|