README.erc32 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. 1. MEC and ERC32 emulation
  2. The file 'erc32.c' contains a model of the MEC, 512 K rom and 4 M ram.
  3. The following paragraphs outline the implemented MEC functions.
  4. 1.1 UARTs
  5. The UARTs are connected to two pseudo-devices, /dev/ttypc and /dev/ttypd.
  6. The following registers are implemeted:
  7. - UART A RX and TX register (0x01f800e0)
  8. - UART B RX and TX register (0x01f800e4)
  9. - UART status register (0x01f800e8)
  10. To speed up simulation, the UARTs operate at approximately 115200 baud.
  11. The UARTs generate interrupt 4 and 5 after each received or transmitted
  12. character. The error interrupt is generated if overflow occurs - other
  13. errors cannot occure.
  14. 1.2 Real-time clock and general pupose timer A
  15. The following registers are implemeted:
  16. - Real-time clock timer (0x01f80080, read-only)
  17. - Real-time clock scaler program register (0x01f80084, write-only)
  18. - Real-time clock counter program register (0x01f80080, write-only)
  19. - Genearl pupose timer (0x01f80088, read-only)
  20. - Real-time clock scaler program register (0x01f8008c, write-only)
  21. - General purpose timer counter prog. register (0x01f80088, write-only)
  22. - Timer control register (0x01f80098, write-only)
  23. 1.3 Interrupt controller
  24. The interrupt controller is implemented as in the MEC specification with
  25. the exception of the interrupt shape register. Since external interrupts
  26. are not possible, the interrupt shape register is not implemented. The
  27. only internal interrupts that are generated are the real-time clock,
  28. the general purpose timer and UARTs. However, all 15 interrupts
  29. can be tested via the interrupt force register.
  30. The following registers are implemeted:
  31. - Interrupt pending register (0x01f80048, read-only)
  32. - Interrupt mask register (0x01f8004c, read-write)
  33. - Interrupt clear register (0x01f80050, write-only)
  34. - Interrupt force register (0x01f80054, read-write)
  35. 1.4 Breakpoint and watchpoint register
  36. The breakpoint and watchpoint functions are implemented as in the MEC
  37. specification. Traps are correctly generated, and the system fault status
  38. register is updated accordingly. Implemeted registers are:
  39. - Debug control register (0x01f800c0, read-write)
  40. - Breakpoint register (0x01f800c4, write-only)
  41. - Watchpoint register (0x01f800c8, write-only)
  42. - System fault status register (0x01f800a0, read-write)
  43. - Firts failing address register (0x01f800a4, read-write)
  44. 1.5 Memory interface
  45. The following memory areas are valid for the ERC32 simulator:
  46. 0x00000000 - 0x00080000 ROM (512 Kbyte, loaded at start-up)
  47. 0x02000000 - 0x02400000 RAM (4 Mbyte, initialised to 0x0)
  48. 0x01f80000 - 0x01f800ff MEC registers
  49. Access to unimplemented MEC registers or non-existing memory will result
  50. in a memory exception trap. However, access to unimplemented MEC registers
  51. in the area 0x01f80000 - 0x01f80100 will not cause a memory exception trap.
  52. The written value will be stored in a register and can be read back. It
  53. does however not affect the function in any way.
  54. The memory configuartion register is used to define available memory
  55. in the system. The fields RSIZ and PSIZ are used to set RAM and ROM
  56. size, the remaining fields are not used. NOTE: after reset, the MEC
  57. is set to decode 4 Kbyte of ROM and 256 Kbyte of RAM. The memory
  58. configuration register has to be updated to reflect the available memory.
  59. The waitstate configuration register is used to generate waitstates.
  60. This register must also be updated with the correct configuration after
  61. reset.
  62. The memory protection scheme is implemented - it is enabled through bit 3
  63. in the MEC control register.
  64. The following registers are implemeted:
  65. - MEC control register (bit 3 only) (0x01f80000, read-write)
  66. - Memory control register (0x01f80010, read-write)
  67. - Waitstate configuration register (0x01f80018, read-write)
  68. - Memory access register 0 (0x01f80020, read-write)
  69. - Memory access register 1 (0x01f80024, read-write)
  70. 1.6 Watchdog
  71. The watchdog is implemented as in the specification. The input clock is
  72. always the system clock regardsless of WDCS bit in mec configuration
  73. register.
  74. The following registers are implemeted:
  75. - Watchdog program and acknowledge register (0x01f80060, write-only)
  76. - Watchdog trap door set register (0x01f80064, write-only)
  77. 1.7 Software reset register
  78. Implemented as in the specification (0x01f800004, write-only).
  79. 1.8 Power-down mode
  80. The power-down register (0x01f800008) is implemented as in the specification.
  81. However, if the simulator event queue is empty, power-down mode is not
  82. entered since no interrupt would be generated to exit from the mode. A
  83. Ctrl-C in the simulator window will exit the power-down mode.
  84. 1.9 MEC control register
  85. The following bits are implemented in the MEC control register:
  86. Bit Name Function
  87. 0 PRD Power-down mode enable
  88. 1 SWR Soft reset enable
  89. 3 APR Access protection enable