Edexcel GCSE in Computer Science lesson activities for ...
LESSON ACTIVITIES FORBlock 3: Compression & Encryption and Block 4: Computers & Assembly Language ProgrammingLesson 1 activitiesActivity 1.1Fill in this table to help you see what a difference compression makes to file size. File AFile BFile CHow many characters does the file contain?What type of content does the file contain?What is its file size before compression?What is its file size after compression?What is its compression ratio (decompressed size/compressed file size)?Which file compresses the most? Explain why.Activity 1.2Your teacher is going to read out a series of binary numbers. The first pair of binary numbers represents a colour code as follows:00 = blue01 = white10 = yellow11 = greenThe second set of binary numbers represents the run length of the colour. So, for example, 00, 1101 represents 13 blue pixels.Assuming each of the squares in the grid below represents one pixel, listen to the series of binary numbers and shade the squares. The first line of pixels has been done for you.Line 1: 00 0001 01 0011 00 1100Activity 1.3 (homework)Use four different colours to “draw” an image in the grid below.Now encode the image using a 2-bit binary number to represent the colour depth and a 4-bit binary number to specify the run length of the pixels to be filled with that colour.Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Line 10Line 11Line 12Line 13Line 14Line 15Line 16Lesson 2 activitiesActivity 2.1Use the image you encoded for your homework to complete these calculations.How many bytes are required to represent the uncompressed file?Remember: number of squares in grid x 2 / 8How many bytes are required to represent the RLE encoded file?Remember: number of codes x number of bits in each code / 8How much storage space have you saved?ExtensionImagine that an image:contains 1,024 pixels (a grid of 32 pixels by 32 pixels)contains 255 different colours (represented by 8 bits)The image has been encoded using RLE, producing 116 binary codes comprising 8 bits (to represent the 255 colours) and 5 bits (to represent the colour run length).Using this information, calculate:How many bytes are required to represent the uncompressed file?How many bytes are required to represent the RLE encoded file?How much storage space have you saved?Activity 2.2Use the Run Length Encoding Calculator to encode these text strings. Text stringAnswerAAAABBBBBBBBBCADDDDEEFFFFFFFFABCABCABCABCABCABCABCABCABCSBBGGYYAACCFFEEBBGGYYAACCFFEEWhich one compresses the most?Why is this?Describe in English the process the RLE calculator follows to encode a piece of text.Activity 2.3An RLE compression algorithm works by removing repeated data and replacing it with a number representing the run length of that item.Fill in the gaps to complete this algorithm.1. Start with the first character in the string.2. Write down the number 1.3. Compare the first character with the next character on the right.4. If they are the same, ___________________________________.5. If they are not the same, ________________________________.6. Move on to the next character on the right.7. Go back to step 2 and repeat until you reach the end of the string.8. _____________________________________________________.Test out the algorithm using these data strings: AAAABBBBBBBBBCADDDDEEFFFFFFFFABCABCABCABCABCABCABCABCABCSBBGGYYAACCFFEEBBGGYYAACCFFEEActivity 2.4 (homework)Write a program in Python to implement the RLE compression algorithm you completed in Activity 2.3.Activity 2.5 (extension)Write a program in Python to decode a file compressed using RLE compression.Lesson 3 activitiesActivity 3.1The wheels on the bus go round and round, round and round, round and round.The wheels on the bus go round and round all day long.How many characters, including spaces and punctuation marks, are there in this song? Assuming one byte is used to represent each character, what is its file size?Complete this table.WordNumber of times usedNumber of bytes in wordThe23wheels26on22the23busgo roundandalldaylongActivity 3.2Complete this lookup table of all the words used more than once in the song.Lookup table0. The1.wheels2.on3.the4.5.6.7.Use the lookup table you have completed to encode the song, replacing repeated words with the number representing their position in the table.Activity 3.3A lookup table has been used to encode this text:Encoded text0 1 2 3 generally more effective than 4 1 2 in reducing 5 size 6 7. However, whereas 4 2 allows 5 8 1 9 10 perfectly reconstructed from 5 compressed 1, 11 2 causes some 6 5 8 1 9 10 permanently lost. 0 1 2 3 most often 12 for media 7, i.e. music, pictures 13 videos. This type 6 1 3 intended 9 10 12 14 humans whose brains are capable 6 ‘filling in 5 gaps’ created 14 11 2.MP3 uses 11 1 2 9 compress audio 7 for use on portable media players where space 3 limited. PNG 13 GIF use 4 1 2 9 reduce 5 size 6 image 7. 0. Lossy1.pression3.is4.lossless5.the6.of7.files8.original9.to10.be11.lossy12.used13.and14.byDecode the text.‘Short and Sweet’Complete the worksheet activity ‘Short and Sweet’ from Computer Science Unplugged.‘Extra for Real Experts’Complete the worksheet activity ‘Extra for Real Experts’ from Computer Science Unplugged.Lesson 4 activitiesActivity 4.1Use an image editor, such as pixlr’s photo editor online, to experiment with compression. Start with an uncompressed BMP file. Fill in this table.Original BMP imageJPEG with 100% quality[Insert image here][Insert image here]File size:File size:Image quality:Image quality:JPEG with 50% qualityJPEG with 25% quality[Insert image here][Insert image here]File size:File size:Image quality:Image quality:Activity 4.2Use a media player such as iTunes to experiment with music compression by encoding a music file using different bit rates.Original uncompressed WAV fileHigher quality MP3 (around 192kbps)[Insert sound file here][Insert sound file here]Sound quality:Number of kbps:Number of kbps:File size:File size:High quality MP3 (around 160kbps)Good quality MP3 (around 128kbps)[Insert sound file here][Insert sound file here]Number of kbps:Number of kbps:File size:File size:Activity 4.3Lossless and lossy compression summary sheetExplain what is meant by lossless compression.What type of data can be compressed using a lossless compression algorithm?Describe how a lossless RLE algorithm works.Some lossless compression algorithms use a lookup table. Explain what the lookup table is for.Explain how lossy compression differs from lossless compression.Explain why lossy compression is usually used for media files.Outline the process of compressing an audio file using a lossy compression algorithm.Outline the process of compressing a bitmap image using a lossy compression algorithm.Lesson 5 activitiesActivity 5.1Crack this code!WKH WUHDVXUH LV KLGGHQ XQGHU WKH SDOP WUHH Hint: H = E and W = TActivity 5.2Who uses encryption and what do they use it for what?Users of encryptionWhat they use encryption forBusinessesIndividualsGovernmentsE-tradersThe militaryActivity 5.3 (homework)Create your own cipher and then use it to encrypt a secret message. Make sure you keep a note of the key to cracking your cipher, so that you (or someone else) can decode the message later!Lesson 6 activitiesActivity 6.1Use a Caesar cipher to decode and encode these messages.Plain textShiftEncrypted textTHE ENIGMA MACHINE WAS INVENTED BY THE GERMANS+3COLOSSUS WAS THE WORLD’S FIRST DIGITAL COMPUTER+4+5YMJ HFJXFW HNUMJW NX FS JCFRUQJ TK WTRFS NSLJSZNYD-3QEB HBV FP EFAABK RKABO QEB CILTBO MLQActivity 6.2With a partner, produce a step-by-step guide to using a Caesar cipher to produce an encoded message.Activity 6.3 (homework)Produce a step-by-step guide to decrypting messages that have been encoded using a Caesar cipher.Lesson 7 activitiesActivity 7.1A function caesar_cipher_encrypt has two arguments: a string ‘message’ and an integer ‘key’ and returns a string ‘encrypted_message’.All the characters that can be encrypted are stored in a list ‘letters’. Any characters in ‘message’ that are not in list ‘letters’ cannot be encrypted.Load and run the function to see for yourself what it does. First, open Activity7.1.py in IDLE, then click Run > Run Module. Once the Python shell has loaded remember that to run the function you need to call it and enter its arguments.Try different messages and different keys. What happens when a message includes a character that can’t be encrypted? What happens when the character to be encrypted is a ‘z’?Add comments to the Python code to explain how it works. You should add a comment after every # in the Python code.Amend the function so that the digits 1–9 can also be encrypted.Activity 7.2In pairs, make a new version of the function called caesar_cipher_decrypt that decrypts text encrypted using a Caesar cipher. Add comments to the Python code to explain how this function differs from the original.Hint: The inputs to the function should be the text to be decrypted and the shift to be applied. Hint: The function should return the decrypted message.Activity 7.3There is really no need to have separate functions to encrypt and decrypt messages. Produce a new function caesar_cipher that does both.Hint: The function will need a third argument: a string ‘action’ to determine whether the message has to be encrypted or decrypted.Activity 7.4Write a user interface for the caesar_cipher you produced in Activity 7.3. It should ask the user to select whether they want to encrypt a message, decrypt a message or exit the program.Lesson 9 activitiesActivity 9.1List as many different types of digital computers as you can. Look for computers both in the past as well as the present, and for objects that contain embedded computers.Activity 9.2Sort the things in this list according to whether they are hardware or software.MouseComputer programWeb browserMicrophoneCPUHard disk driveDigital cameraWindows operating systemDVD driveTouch screenWord processorSpeakersSpreadsheetPrinterMobile phone appAndroid operating systemSD memory cardHardwareSoftwareActivity 9.3 (homework)Answer these questions to summarise what you have learned in this lesson.What is a digital computer?Define computer hardware.Give an example of computer hardware.Define computer software.Give an example of computer software.Lesson 10 activitiesActivity 10.1Write a computer program that asks the user to type in three numbers, adds them up and then displays the answer on the screen.Explain your program using the input-process-output model.27797832207INPUTPROCESSOUTPUT00INPUTPROCESSOUTPUTActivity 10.2 (homework)Select two actions you complete regularly and describe them in terms of the input-process-output model.Examples could be:Running a mobile phone app Uploading an image to a social networking profile2549658890INPUTPROCESSOUTPUTINPUTPROCESSOUTPUT26319590805INPUTPROCESSOUTPUTINPUTPROCESSOUTPUTLesson 11 activitiesActivity 11.1Use the function to identify the hardware component.FunctionHardware componentA temporary storage area for data and program instructions while a program is runningA microprocessor which carries out the instructions in computer programs by performing arithmetic and logic operations, and controls inputs and outputsA persistent data storage area for data and program instructionsTo provide connections to the input and output peripherals such as printers, mouse, keyboard, touch screen, speakers, networks, and so onActivity 11.2This diagram represents the way in which buses connect the main hardware components in a digital computer. Copy and complete the diagram using these labels:CPUMemoryInput/output devicesData, control and address bus116682520320Activity 11.3From the function given, identify and insert the name of the correct bus.FunctionType of busSends and receives signals that control the CPU and other parts of the computer systemCarries the address of memory locations used to store data and program instructionsTransfers the binary data around the computerActivity 11.4Label the following on the picture of the Raspberry Pi:SD card (memory)CPU processor and RAM memoryEthernet network connection2 USB connectors (mouse and keyboard)HDMI connector for monitorAudioPower supplyLesson 12 activitiesActivity 12.1Windows is an example of an operating system. List as many other operating systems as you can. Aim for a list of at least five operating systems. Discuss with other class members or use an internet search if you need to. e.g. WindowsActivity 12.2Assuming that the user is the outer circle, use the labels ‘hardware’, ‘application software’ and ‘operating system’ for the other circles to show the role of the operating system.603254191000Activity 12.3Using a non-networked computer and the operating system of your choice, do the following:make a hierarchy of directories and filesremove files and directoriesrename files and directorieschange the current working directoriesview the current working directory.Here is a list of useful Raspbian (Unix) and Command Line Interpreter (LX Terminal) file and directory mandsFunctionpwdPrint working directory – display the current directorycd directoryChange directory mkdir directoryMake a new directory rm fileRemove a filetouch fileCreate a new empty filecat fileCatalogue a file – list the contents of a filels -lList the files in the current working directory displaying all the details about the filesActivity 12.4Bring up the task manager in whatever operating system you are using (in Windows, control/alt/del).Find the networking information within the task manager (in Windows, choose the networking tab).What happens when the user accesses the network, for example by opening a web page or accessing information on a server?Activity 12.5Bring up the task manager in whatever operating system you are using (in Windows, control/alt/del).Find the user information within the task manager (in Windows, choose the user tab).List the users who are using your computer. What information can you find out about them?Lesson 13 activitiesActivity 13.1Open up the operating system’s task manager (in Windows, control/alt/delete) and find the list of applications running (in Windows, choose the Applications tab).Now find the information on the processes running (in Windows, choose the Processes tab). Scroll up and down the list to see how many processes it takes to run the operating system and any applications you currently have open.Now open up a few applications, e.g. a web browser, word processor, spreadsheet software, a graphics package.Answer these questions:What happens to the list of applications?What happens to the number of processes running on the computer?Try to explain why there are more processes running than applications running.Activity 13.2Your teacher will run this activity. The instructions are here for information only.Process scheduling – an “unplugged” activity to simulate the scheduling of processesRequirementsLarge stick notesWhite boardTwo tablesArea for process queueStop watchPensTwo students who represent the operating system (“OS1” will allocate the process ID and time slots, “OS2” will send the next process to the CPU)One student who represents the “CPU”One student who represents the “user” who is running the programsSixteen other students who represent the programs and applications and who will be the “processes” (just add more programs/applications depending of number of students in group)Starting positionsThe “CPU” should sit at a table with a pen and stop watch.“OS1” needs a pen and an empty process table drawn on a whiteboard (add more rows as required:Process IDName of program or applicationAllocate a queue area where the “processes” will stand in order while they wait to be “executed” after they have been allocated a process ID.The “user” sits at table with a pen and sticky notes.Running the programsThe “user” starts by writing on a sticky note the name of a program or application, in the order given in the table below. The “user” must write program and application names in the same order as they appear in the table below.Word processorWeb browserSound programMyprog.pySort.pyWord processorMyprog.pySpreadsheetSort.pyWord processorSpreadsheetWeb browserSound programWeb browserSound programSort.pyThe “user” hands the sticky note on which he/she has written a program or application name to a student who will be that “process”.The “process” goes to “OS1” who allocates the next free process ID from the process table. “OS1” also allocates the correct number of time slots needed to complete the process, according to the table below:Type of processTime slots word processor1 2 3 myprog.py1 2 sort.py1 spreadsheet1 2 3 4 web browser1 2 3 sound program1 2 3 4 5 So, if the “process” hands “OS1” a sticky note that says “Word processor”, “OS1” adds a process ID and three time slots “1, 2, 3” to the stick note and hands it back to the “process”. “OS1” must also update the process table on the whiteboard.The “process” joins the back of the queue holding up their sticky note. “OS2” is constantly looking at the queue waiting for a process with a process ID. They send the “process” at the top of the queue to the “CPU” table.Each “process” gets 10 seconds to execute with the “CPU” – when the “process” arrive at the table, “CPU” starts the stop watch, crosses one time slot off the sticky note and then says “Time’s up” after 10 seconds. At this point, the “process” must return to the back of the queue.The “process” should check their sticky note. If all their time slots have been crossed off, they should shout their process ID and “Finished” and then sit down.When “OS1” hears that a process has finished, they should remove that process from the process table If the “process” still has time slots left they go to the back of the queue.Repeat until all the processes have finished.AlternativesChange the length of the time slice (make it more or less than 10 seconds)Add more or different programs/applicationsGive the processes a priority which alters their position in the queueLesson 14 activitiesActivity 14.1The speed of a computer system is measured in frequency (cycles per second) using the units hertz (Hz). One hertz is one cycle per second. This means that one instruction is executed per second.For many years computers were measured in megahertz (MHz).1 megahertz = 1,000 hertz or 1,000 instructions per second.Modern computers are so fast they are measured in gigahertz (GHz).1 gigahertz = 1,000,000,000 hertz or 1,000,000,000 instructions per second.Find the speed of the processor in the computer systems you use and calculate how many instructions they can process each second.Type of computerClock speedInstructions per secondActivity 14.2Your teacher will run this activity. The instructions are here for information only.ResourcesA class of pupilsA room such as a hall or an open spaceOn/off cardExplain that the class is going to act out the role of transistors in a CPU. When they are on they stand up (show ON) and when they are off they sit down (show OFF). (This works best if they are on the floor not on seats). The pupils should stand apart from each other (stretch arms out so they cannot touch each other). Show the ON and OFF cards slowly to start with, then speed up. Ask how warm the class is feeling (they should be getting warmer just like a CPU).Then explain that more and more transistors are being placed closer together to make computers faster and able to perform more calculations.Get the class to stand closer to each other. Then repeat the process getting faster and faster. Ask how warm the class is feeling now.This demonstrates how CPUs generate heat from the switching of thousands of transistors. Activity 14.3 (homework)Watch all of the Royal Institution lecture ‘Breaking the speed limit’: and then answer these questions.What is a semi-conductor?What is a transistor?Why are “bunny suits” used when manufacturing microprocessors?What is meant by parallel processing?Lesson 15 activitiesActivity 15.1Check the system settings or search online for the technical specifications of the digital computers that you use. Note down the name and speed of the CPU in each device, as well as whether the CPU is a single core or multi-core processor.Type of computerName of CPUSpeed (Hertz)Single core or multi-core?Activity 15.2Take a screen shot showing the CPU usage. (On Windows 7 select Task Manager (control-alt-del) and select the Performance tab then click on the “Resource Monitor…” button then click on CPU). Label the number of cores and the amount of CPU usage.Lesson 16 activitiesActivity 16.1The main memory (or RAM) is made up of memory locations. Each memory location has a unique address assigned to it. Data and instructions are stored in memory when programs and applications run.Place the following data and instructions into the memory location at the correct address:At address 0011 store the ASCII binary for ‘c’At address 0100 store the ASCII binary for ‘a’At address 0101 store the ASCII binary for ‘t’At address 1001 store the binary value for 4At address 1100 store the binary value for 65At address 1110 store the binary value for 201Store the first three letters of your name starting at address 0000AddressMemory location1111111011011100101110101001100001110110010101000011001000010000Activity 16.2Calculating the maximum capacity of main memory:A processor with a 4 bit address bus can create 24 (or 16) addressable memory locationsA processor with an 8 bit address bus can create 28 (or 256) addressable memory locationsCalculate the maximum number of addressable memory locations for address buses of the following sizes.Size of address busMaximum number of addressable memory locations4 bit168 bit25616 bit32 bit64 bitActivity 16.3This activity gives you an opportunity to find out how much memory there is in the computers you use.Either check the system settings or search online for the technical specifications of your computers and complete the table below. Add more rows if you need to.Type of computerMain memoryActivity 16.4Sort the stages of a memory read into the correct order:Processor sets the read line on the control busContents of the memory location are conveyed along the data bus into the processorProcessor places the address of the required memory location on the address busStep 1Step 2Step 3Sort the stages of a memory write into the correct order:Processor places the data to be written to memory on the data busProcessor places the address of the required memory location on the address busThe data is conveyed along the data bus to the memory locationProcessor sets the write line on the control busStep 1Step 2Step 3Step 4Activity 16.5 Type of computerType of secondary storage deviceMaximum capacityActivity 16.6 (homework)Search online for companies that sell memory (such as ). Find three further facts about memory that you can share with the class.Fact 1Fact 2Fact 3Lesson 17 activitiesActivity 17.1Sort the following devices according to whether they are input or output devices.MouseSpeakersMonitorTouch screenKeyboardLEDSensorMicrophoneScannerPrinterWeb camDigital cameraInput devicesOutput devicesActivity 17.2In your group, identify all the input devices found on the digital computer you have been assigned.Digital computer you have been assigned:Activity 17.3Complete the table below to create a reference sheet for yourself.Input deviceHow does it work? (2 or 3 sentences)ImageOptical mouseThe optical mouse uses a light emitting diode (LED) as a light source, a small camera and a small processor. The light from the LED illuminates the surface and the camera takes pictures, which are compared by the program in the processor to determine how far the mouse has travelled. This information is then conveyed to the main CPU.KeyboardThe computer keyboard uses an arrangement of keys to input characters to the computer. Keyboards use a range of different switching technologies to send a code which represents the key that has been pressed to the CPU.Touch screenWeb camScannerSensorsMicrophoneLesson 18 activitiesActivity 18.1In your group, identify all the output devices found on the digital computer you have been assigned.Digital computer you have been assigned:Activity 18.2Complete the table below to create a reference sheet for yourself.Output deviceHow does it work? (2 or 3 sentences)ImageLCD screenSpeakersProjectorInkjet printerLaser printerLesson 19 activitiesActivity 19.1Check the system settings of your digital computers or search online for their technical specifications to find out the type of storage you are using.Type of computerType of storage deviceMaximum storage capacityMagnetic, optical or solid state?Activity 19.2Do the following:Save a file onto the magnetic hard disk drive.Burn a file on to a CD or DVD.Save a file on to a solid state drive or a memory stick.Now describe in your own words how the data in the file was stored on each of these types of storage.Magnetic storage, e.g. hard disk driveOptical storage, e.g. CD / DVD driveSolid state storage, e.g. memory stickLesson 20 activitiesActivity 20.1Use the labels below to complete the diagram.MemoryControl unitArithmetic and logic unit (ALU)Registers0106045PROCESSORControl busAddress busData busPROCESSORControl busAddress busData busDraw lines to match the parts of the processor with the correct function.Accumulator registerSends out signals to other parts of the computer system and fetches, decodes and executes instructionsControl unitCarries out arithmetic and logic operationsRegistersIndividual storage locations which hold an instruction, data or address of a memory locationArithmetic and logic unit (ALU)Holds the instruction that is currently being executed by the processorProgram counter registerHolds the accumulated total of results performed in the ALUInstruction registerHolds the address of the main memory location storing the next instructionLesson 21 activitiesActivity 21.1The first column of the table contains some assembler instructions for the ARM1176JZ-S processor. Match each assembler instruction with the correct action and underline the part of the action that helped you know which assemble instruction it relates to. One has been done for you.Assembler instructionAction193852887375ADDLoad from memory address into a registerSUBBranch to a marked position in the programMULMove data to a registerMOVStore values in a registerCMPSubtract data in registersLDRCompare values in registersBMultiply data in registersSTRAdd data in registersActivity 21.2Use the labels below to complete the diagram on the next page. The diagram shows how high level programs are translated into machine code so that they can be run by the CPU.LabelsPython (high level language)Machine codeCompilerAssembly language (low level language)Assembler-73153099MOV R1, #50MOV R2, #60ADDS R0, R1, R2MOV R7, #111110000111100001011100011100010101001001001010000MOV R1, #50MOV R2, #60ADDS R0, R1, R2MOV R7, #1111100001111000010111000111000101010010010010100Lesson 22 activitiesActivity 22.1Complete this diagram of the fetch-decode execute cycle using the labels below.LabelsFETCHDECODEEXECUTEFetches the next instruction from memory and increments program counterDecodes the bit pattern (machine code) into the instruction to be executedExecutes the instruction and stores the results in memory or registers219456312318Activity 22.2Guess how many fetch-decode-execute cycles are happening in the classroom at this moment! Write your guess here:Now you’re going to do a proper estimate!Estimate the number of digital computers (desktops, laptops, tablets, mobile phones, etc.) in the room:Assuming a clock speed of 1 GHz for each digital computer and that each fetch-decode-execute cycle takes 10 instructions, calculate the number of fetch-decode-execute cycles taking place per second.Activity 22.3Sort these stages of the fetch-decode-execute cycle into the correct order:Increment the program counter to point to the next instructionDecode the instructionStore results in a registerIf the instruction uses data from memory, identify the memory addresses and fetch the data from memoryFetch the next instruction from main memory using the memory address in the program counter registerExecute the instruction0324968FETCHDECODEEXECUTEFETCHDECODEEXECUTELesson 23 activitiesActivity 23.1Label or colour code this assembly language instruction to show the opcode, and the destination and input operands.SUB R0, R1, R2What does this instruction ask the processor to do? What is an immediate value?Write the instruction to add the immediate value 8 to the contents of register R2 and store the result in register R4.Write the instruction to multiply the contents of register R1 by the contents of register R2 and store the result in register R0.What does this instruction ask the processor to do? MOV R5, #1Activity 23.2ADD R0, R1, R2In this instruction there are three operands: registers R0, R1 and R2.Explain how a register differs from memory.How many general-purpose registers does the ARM11 processor have?Show the contents of the registers as each instruction is executed. Hint: the MOV command actually puts a copy of the data in the specified register. The original stays where it is.R0R1R2053MOV R0, R1553MOV R1, R2533MOV R2, R0R0R1R2953MOV R0, #0053ADD R0, R0, R1SUB R0, R0, R2MUL R0, R1, R2R0R1R2422MUL R0, R1, R2MUL R1, R0, R2MUL R0, R1, R2R0R1R2075SUB R0, R1, #3ADD R2, R2, #1SUB R0, R1, R2Write an assembly language program to compute 3x + 6x. Assume that the value of x is stored in register R5. Add comments to your code to make it easier to understand.Hint: the MUL command can only have registers as operands so you will need to store the immediate values 3 and 6 in registers.Activity 23.3 (homework)Summarise what you have learnt so far.List five different types of computer devices that use an ARM processor.ARM processors are designed to keep energy consumption to a minimum. Explain why this is desirable.Explain why every processor type has its own instruction set.Explain how machine code differs from assembly language.What is a mnemonic?List three assembly language mnemonics and state what they do.Each assembly language instruction consists of an opcode and one or more operands.Operands can be one of two sorts. What are they?The ARM11 has a 32-bit address bus.Describe the function of the address bus. How many unique memory locations does a 32 bit address bus provide?Explain what this command does.MUL R1, R0, R3What do these mnemonics stand for?CMPMOVLDRBSUBMULThe ARM11 instruction set has three groups of instructions: ‘data manipulation’, ‘load and store’ and ‘branch’. Put these instructions into the correct group:ADDLDRBSUBMULCMPSTRBLMOVData manipulationLoad and storeBranch Which component of the processor carries out data manipulation instructions?Load and store instructions are used to access memory. How is data transferred between memory and the registers?Lesson 24 activitiesActivity 24.1 Write comments for these two lines of code.ADD R0, R1, R2ADDEQ R0, R1, R2Explain what this piece of code does.CMP R0, R1MOVGT R2, R0Write comments for each line of this program.MOV R0, #5MOV R2, #6CMP R0, R2MOVEQ R3, R0MOVNE R3, R2What will be the outcome of executing this piece of code if register R0 holds the value 9 and register R1 holds the value 15?CMP R0, R1SUBGT R0, R0, R1SUBLT R1, R1, R0What will be the outcome of executing this piece of code if register R0 held the value 3 and register R1 held the value 3?CMP R0, R1ADDGT R0, R0, R1ADDLT R1, R1, R0Write an assembly language program to swap the contents of register R1 and register R2 if the value in R1 is greater than the value in R2. Add comments to your code to make it easier to understand.Write an assembly language program to set the contents of register R1 to #1 if the contents of register R5 is less than or equal to 100. Add comments to your code to make it easier to understand.Activity 24.2ARM processors have a load-store architecture. Explain what this means.Explain what this piece of code does.LDA R0, [R2]LDA R1, [R3]ADD R0, R0, R1STR R0 [R2]Activity 24.3 (homework)Draw a flowchart to illustrate what this piece of code does.startMOV R0, #0MOV R1, #10loop ADD R0, R0, R1SUB R1, Rl, #1CMP R1, #0BNE loopSTR R0, [R3]stopB stopDraw a flowchart to illustrate what this piece of code does.start LDA R0, [R3]LDA R1, [R4]loopCMP R0, R1SUBGT R0, R0, R1SUBLT R1, R1, R0BNE loopstopB stopWrite an assembly language program to implement this algorithm. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related searches
- science lesson plans for preschool
- phd in computer science jobs
- doctorate in computer science salary
- phd in computer science salary
- science sensory activities for preschoolers
- science lesson plans for kindergarten
- free science lesson plans for 4th grade
- science sensory activities for toddlers
- phd in computer science india
- science ocean activities for preschoolers
- science sensory activities for infants
- phd in computer science usa