Professional Documents
Culture Documents
1a. A system consists of a five-step processor, ROM, RAM, and two I/O
devices. A 16-bit address space is used. ROM and RAM are each 16kbytes in
size. ROM is at address 0. RAM immediately follows the end of ROM. Each
I/O device reserves 16kbytes in the address space (even if the full range is
not used). Design the address decoding for this system and fill in the table.
1b. Write the simplest Boolean logic expressions for the device-select
signals for all four devices that are described in part (a).
1. movia r2,LIST
2. movia r4, N
3. movia r3,STATUS_REG
4. LOOP: ldw r5,0(r3) /*get status register data */
13. bne r4,r0, loop /*go back to start if all words aren't sent */
4b. Logic Diagram: An I/O device X is assigned bit 3 within the appropriate
registers in part (a). The device asserts a signal IRQx when it seeks to
obtain interrupt service. Describe the full logic path, beginning with how the
device generates IRQx and ending with the final signal to the internal
processor control logic.
4c. Show assembly language instructions for initializing the appropriate
registers in part (a) to properly support use of interrupts for device X in part
(b).
1. movi r3,0x8
2. wrctl ienable,r3 /*enable interrupts for device x*/
3. movi r3,0x1
4. wrctl status,r3 /*enable interrupts in processor*/
3. beq et,r0,end
4. call forX
5. forX: |
6. <code for device X interrupt>
7. |
8. end: eret
1. #include "nios2_control.h"
2. #define JTAG_UART_DATA (volatile unsigned int*) 0x00005800
3. #define JTAG_UART_STATUS (volatile unsigned int*) 0x00005804
18. *TIMER_START_LO=0x9680;
19. *TIMER_START_HI=0x0098;
20. *TIMER_STATUS=0;
21. *TIMER_CONTROL=7;
22. one_second=0;
23. count=0;
24. *OUTPORT=0x00;
25. NIOS2_WRITE_IENABLE(0x1);
26. NIOS2_WRITE_STATUS(0x1);
27. }
32. *TIMER_STATUS=0;
33. count=count+1;
34. if(count>=5) {
35. one_second=1;
36. count=0;
37. }
38. }
39. }
52. while(1) {
53. if(one_second) {
54. one_second=0;
55. second_count=second_count+1;
56. if(second_count>=256) {
57. second_count=0;
58. }
59. *OUTPORT=second_count;
60. }
63. input_character=*INPORT;
64. display_character_LO = (input_character & 0x0F);
65. display_character_HI = (input_character & 0xF0>>4);
70. PrintChar(display_character_HI);
71. PrintChar(display_character_LO);
72. PrintChar(NEWLINE);
73. }
74. }
75. }