Accounts Analysis

 

 

; 1. Code the following IF-THEN statement:
;
; if (r2 != r7)
; r2 = r2 – r7;
; else
; r2 = r2 + r4;
;
; Your code have to work with any numbers in R2, R7 and R4
; (5, 25(0x19))
;
MOVW R2, #10
MOVW R7, #5
MOVW R4, #15
;
; MOVW R2, #10
; MOVW R7, #10
; MOVW R4, #15
;
;– Your instructions here —
;– Approx. 3 instructions —

———————————————————————————————————————

; 2. Write a program that converts a hexadecimal value between 0x0 and 0xf in register
; R0 into its ASCII representation. Store ASCII representation into R1.
;
; Digits ‘0’ through ‘9’ are represented with the ASCII codes 0x30 to 0x39. The digits
; ‘A’ through ‘F’ are coded as 0x41 through 0x46. (See ‘ascii.pdf’ file)
;
; Test your code with R0 = 15, 0 and 9
; (0x46, 0x30, 0x39)
;
MOV R0, #15
; MOV R0, #0
; MOV R0, #9

;– Your instructions here —

———————————————————————————————————————

;
; 3. Modify the code you did for task #2 to check for valid number (0..15) in R0.
; Store ‘*’ (0x2a) into R1 if R0 is out of valid range. Store ASCII representation
; for valid numbers (from 0 to 15 inclusive).
;
; Test your code with R0 = 255, 15, 0, 9, 12 and 16
; (0x2a, 0x46, 0x30, 0x39, 0x43, 0x2a)
;
MOV R0, #255
; MOV R0, #15
; MOV R0, #0
; MOV R0, #9
; MOV R0, #12
; MOV R0, #16

;– Your instructions here —

———————————————————————————————————————

;
; 4. Write a program that counts number of binary ‘1’s and number of binary ‘0’s in R0.
; Save number of ‘1’s into R1, number of ‘0’s in R2. You may use any other register(s) and
; do not need to preserve the value of R0 register.
;
; Your code have to work with any number in R0
;
; Debug your program with tets values R0 = 0xAAAAAAAA and R0 = 0x55555555. Both should give
; you 16 1’s and 16 0’s
;
; Then run your progarm with R0 = 0x708. Is your result correct? (use online converter to check)

MOV R0, #0xAAAAAAAA
; MOV R0, #0x55555555
; MOVW R0, #0x708

;– Your instructions here —

———————————————————————————————————————

;
; 5. Write a “shift, test and restore” division algorithm (See “Binary Division.pdf” for details).
;
; For i = 1 to 32 do { we’re using 32-bit representations }
; {
; Left Shift the RQ pair
; Subtract the Divisor from R
; If R is positive then
; Set the low order (right most) bit in Q to 1
; Else
; Restore R by Adding back the Divisor
; }
;
; R0 = remainder (R)
; R1 = divident/quotient (Q)
; R2 = divisor (D)
;
; R1,R0 = R1/R2
;
; Do not use UDIV and SDIV ARM commands!
;
; Your code have to work with any valid numbers in R0. You may use any other register(s). Check your
; code with given values first. Then try some another numbers in R1 and R2.

MOVW R1, #163 ; 163/10 = 16, 3
MOVW R2, #10

;– Your instructions here —

———————————————————————————————————————

;
; 6. Write a small program to compare two 64-bit values. Set R0 to 0 if two values
; are equal, set R0 to 1 if two values are not equal. First 64-bit number placed into
; R1(HI bits) and R2(LO bits), second number is in R3(HI bits) and R4(LO bits). Use only
; 4 ARM instructions!
;
; Your code have to work with any numbers in R1-R4
;
; Check your code with all test sets below
;
MOV R1, #0xAAAAAAAA
MOV R2, #0x55555555
MOV R3, #0xAAAAAAAA
MOV R4, #0x55555555
; —-
; MOV R3, #0x55555555
; MOV R4, #0xAAAAAAAA
; —-
; MOV R3, #0xAAAAAAAA
; MOV R4, #0xAAAAAAAA
; —-
; MOV R3, #0x55555555
; MOV R4, #0x55555555

;– Your 4 instructions here —

———————————————————————————————————————

;
; 7. (Bonus). Write a code that allows you to rotate 64-bit values in registers
; R0 and R1. The code should shift value left…
;
; +——————–+ +——————–+
; +<-! R0 !<–! R1 !<–+
; ! +——————–+ +——————–+ !
; ! !
; +–>———————->————————->+
;
; …then right by one bit.
;
; +——————–+ +——————–+
; +->! R0 !–>! R1 !–>+
; ! +——————–+ +——————–+ !
; ! !
; +<————————<———————–<–+
;
; – Do not use any other registers.
;
; – Make sure that after two shifts the final value is equal to original one.
;
; Tip: Left shift is tricky. You may remember: a << 1 = a * 2; a * 2 = ???
; … and take care of LSB…
;
; Check your code with all 3 test sets below:
;
MOVW R0, #0x0001
MOVT R0, #0x8000
MOVW R1, #0x0001
MOVT R1, #0x8000
; —-
; MOVW R0, #0xAAAA
; MOVT R0, #0x8555
; MOVW R1, #0x0F0F
; MOVT R1, #0xF0F0
; —-
; MOV R0, #0x00000001
; MOV R1, #0x00000001
;
; — left —
;– Your instructions here —
;– May be done in 3 instructions —

; — right —
;– Your instructions here —
;– May be done in 3 instructions —

———————————————————————————————————————

; 8. (Bonus++). Write a program that check if the binary pattern 2_11001010 are presented at least once
; somewhere in the number R0. The program should set R1 to 1 if the pattern is found, and clear R1 to 0
; if no pattern in the R0.
;
; Your code have to work with any number in R0
;
; Your code have to preserve (do not change) the value in R0
;
; You may use any other registers
;
; Examples: the number 2_11001101100100101111001010101100 (0xCD92F2AC) has the pattern inside
; ——–
; 2_11001100110011001100110110010100 (0xCCCCCD94) has the pattern inside
; ——–
; 2_11011010101101110011100111010101 (0xDAB739D5) – no pattern
;
MOVW R0, #0xF2AC
MOVT R0, #0xCD92
;—
; MOVW R0, #0xCD94
; MOVT R0, #0xCCCC
;—
; MOVW R0, #0x39D5
; MOVT R0, #0xDAB7

;– Your instructions here —

Sample Solution

f species requires a global response, which can only be achieved through increased collaboration. To improve cross-border cooperation at a wider level, the Liaison Group of Biodiversity-related Conventions was created. The secretariats of each convention meet regularly to collaborate in implementing actions at national and international level. The group ensures that the common aims of conservation and sustainable use are being met. A single convention is unable to confront such great challenges, therefore requiring “all hands on deck.” The establishment of this Group demonstrates the necessity of collaboration in achieving the vast aims of biological diversity, not just between states regarding CITES itself, but also within the authorities. Further, the involvement of CITES, a wildlife related convention, in this Group demonstrates the success it has had in largely contributing to realising broader instruments of biological diversity. d. Non-Compliance: Non-compliance with CITES is dealt with both at international and national levels. When Parties fail to comply, the issue is handled by the Convention. Instead, when individuals breach trade regulations, national legislation is used, as Parties implement regulations through domestic law. i. Non-Compliance with CITES: Overtime, a unique compliance system has evolved under the Convention. The Standing Committee is the main responsible body for issuing specific measures in cases of non-compliance. This usually concerns Parties either failing to implement national legislation that transposes the desired effects of the Convention or not complying with reporting requirements. The obvious method used to increase enforcement is sanctions, of which the most severe form consists of a recommended suspension of trade in all species listed under CITES. However, this is the most extreme measure, only used when Parties continuously fail to comply. The most supported method for addressing non-compliance consists of the Standing Committee providing a service of assisting Parties in finding solutions for effective compliance. Relying on this proactive method of implementation, rather than uniquely on a punitive mechanism, enhances the effectiveness of compliance. Although sanctions are ultimately more forceful, most situations of non-compliance stem from the country’s inability to nationally implement CITES. Therefore, providing assistance results in a better outcome, both internationally and domestically, as the number of compliant parties is steadily rising. Even though compliance procedures may be more effective in theory than in actual practice, there is evidence of a positive trend in domestic enforcement.

This question has been answered.

Get Answer