Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. To get the result exponents, add the exponents together and 16 to them (add 8 because of shifting right by 8 positions) 4. Normalize

image text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

3. To get the result exponents, add the exponents together and 16 to them (add 8 because of shifting right by 8 positions) 4. Normalize the result by shifting the mantissa left and decrementing the exponent. Do this till the first bit of the exponent is non zero. Notice that since you started with normalized numbers, the number of positions to shift will be 0 or 1; either the most significant bit (bit 15) of the resulting mantissa is already I or it is zero but the next bit (bit 14) is 1. [Note: The above algorithm is designed with project simplicity in mind. Therefore, it may not have the best utilization of bits to achieve the best accuracy.] Supplying input data In all of your programs, store the input values starting at location 2048. Clearly use labels to indicate your input variables. You should follow the format described in this section strictly as input will be supplied to your program using this format for testing. Your data should be organized as follows in the given order): 1. Pointers to input and output values 2. Input values 3. Output value 4. Other variables if needed Figure I shows and example of data organization. Notice that the values of A and B provided in Figure 1 are 20 and 3, respectively. ORG 2048 APTR, Dec 2048 BPTR, Dec 2050 CPTR, Dec 2052 DPTR, Dec 2054 A, Dec 40960 Dec 5 B Dec 49152 Dec 2 C, Dec 0 Dec 0 D Dec 0 Dec 0 Figure 1: Input Format Assembler ORG ADR set the memory origin. Examples: ORG 50 ; start at address 50 ORG +5 ; start at address after 5 locations ORG -5; start at address before 5 locations gets the address of a label. Examples: 0: LDA A_ADR ; This will load 1 1: A, 5 2: A_ADR, ADR A declare the end of the program. store a string of characters. store a character. store a decimal number. store a hexadecimal number. store a binary number. END STR CHR DEC HEX BIN Registers: AR: Address Register PC: Program Counter DR: Data Register AC: Accumulator IR: Instruction Register TR: Temporary Register INPR: Input Register OUTR: Output Register SC: Sequence Counter E: Extended AC S: Start Flag R: Interrupt IEN: Interrupt Enabled FGI: Input Flag FGO: Output Flag Instruction Set: AND: Logical AND memory with AC ADD: Arithmetic ADD memory with AC LDA: Load from memory to AC STA: Store AC to memory BUN: Branch unconditional BSA: Branch and save return address ISZ: Increment and skip if zero CLA: Clear AC CLE: Clear E : Complement AC CME: Complement E CIR: Circulate right (AC and E) CIL: Circulate left (AC and E) INC: Increment AC SPA: Skip if positive AC SNA: Skip if negative AC SZA: Skip if zero AC SZE: Skip if zero E HLT: Halt INP: Input a character to AC OUT: Output a character from AC SKI: Skip if input flag SKO: Skip if output flag ION: Interrupt on IOF: Interrupt off NOP: No operation Ben's Computer Even simpler computer built by Ben Eater on a breadboard. https://www.youtube.com/user/eaterbo Word size: Memory size: 8 bits 16 words Registers: A: Register A B: Register B ALU: ALU Register OUT: Output Register PC: Program Counter IR: Instruction Register MAR: Memory Address Register CF: Carry Flag ZF: Zero Flag SC: Sequence Counter S: Start Flag Instruction Set: NOP: No operation LDA: Load from memory to A ADD: Add from memory to A SUB: Subtract memory from A STA: Store A to memory LDI: Load immediate JMP : Jump JC: Jump if carry JZ: Jump if A is zero OUT: Copy to output register HLT: Halt 3. To get the result exponents, add the exponents together and 16 to them (add 8 because of shifting right by 8 positions) 4. Normalize the result by shifting the mantissa left and decrementing the exponent. Do this till the first bit of the exponent is non zero. Notice that since you started with normalized numbers, the number of positions to shift will be 0 or 1; either the most significant bit (bit 15) of the resulting mantissa is already I or it is zero but the next bit (bit 14) is 1. [Note: The above algorithm is designed with project simplicity in mind. Therefore, it may not have the best utilization of bits to achieve the best accuracy.] Supplying input data In all of your programs, store the input values starting at location 2048. Clearly use labels to indicate your input variables. You should follow the format described in this section strictly as input will be supplied to your program using this format for testing. Your data should be organized as follows in the given order): 1. Pointers to input and output values 2. Input values 3. Output value 4. Other variables if needed Figure I shows and example of data organization. Notice that the values of A and B provided in Figure 1 are 20 and 3, respectively. ORG 2048 APTR, Dec 2048 BPTR, Dec 2050 CPTR, Dec 2052 DPTR, Dec 2054 A, Dec 40960 Dec 5 B Dec 49152 Dec 2 C, Dec 0 Dec 0 D Dec 0 Dec 0 Figure 1: Input Format Assembler ORG ADR set the memory origin. Examples: ORG 50 ; start at address 50 ORG +5 ; start at address after 5 locations ORG -5; start at address before 5 locations gets the address of a label. Examples: 0: LDA A_ADR ; This will load 1 1: A, 5 2: A_ADR, ADR A declare the end of the program. store a string of characters. store a character. store a decimal number. store a hexadecimal number. store a binary number. END STR CHR DEC HEX BIN Registers: AR: Address Register PC: Program Counter DR: Data Register AC: Accumulator IR: Instruction Register TR: Temporary Register INPR: Input Register OUTR: Output Register SC: Sequence Counter E: Extended AC S: Start Flag R: Interrupt IEN: Interrupt Enabled FGI: Input Flag FGO: Output Flag Instruction Set: AND: Logical AND memory with AC ADD: Arithmetic ADD memory with AC LDA: Load from memory to AC STA: Store AC to memory BUN: Branch unconditional BSA: Branch and save return address ISZ: Increment and skip if zero CLA: Clear AC CLE: Clear E : Complement AC CME: Complement E CIR: Circulate right (AC and E) CIL: Circulate left (AC and E) INC: Increment AC SPA: Skip if positive AC SNA: Skip if negative AC SZA: Skip if zero AC SZE: Skip if zero E HLT: Halt INP: Input a character to AC OUT: Output a character from AC SKI: Skip if input flag SKO: Skip if output flag ION: Interrupt on IOF: Interrupt off NOP: No operation Ben's Computer Even simpler computer built by Ben Eater on a breadboard. https://www.youtube.com/user/eaterbo Word size: Memory size: 8 bits 16 words Registers: A: Register A B: Register B ALU: ALU Register OUT: Output Register PC: Program Counter IR: Instruction Register MAR: Memory Address Register CF: Carry Flag ZF: Zero Flag SC: Sequence Counter S: Start Flag Instruction Set: NOP: No operation LDA: Load from memory to A ADD: Add from memory to A SUB: Subtract memory from A STA: Store A to memory LDI: Load immediate JMP : Jump JC: Jump if carry JZ: Jump if A is zero OUT: Copy to output register HLT: Halt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions