home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 12 / Commodore_Free_Issue_12_2007_Commodore_Computer_Club.d64 / t.minimig < prev    next >
Text File  |  2023-02-26  |  11KB  |  343 lines

  1. u
  2. -Minimig
  3. An Amiga in an FPGA
  4.  
  5. What is Minimig?
  6. Minimig stands for Mini Amiga. Minimig
  7. is an FPGA-based reimplementation of
  8. the original Amiga 500 hardware. In
  9. it's current form, Minimig is a single
  10. PCB measuring only 12*12cm which makes
  11. it the smallest "Amiga" ever made & the
  12. first new "Amiga" in almost 14  years!
  13.  
  14. Minimig is available for download as
  15. an open-source/open-hardware design
  16. under the GNU public license. This
  17. page describes the architecture and
  18. the inner working of the Minimig. All
  19. design files can be downloaded from
  20. the download section.
  21.  
  22. History
  23. The idea to make Minimig started
  24. around january 2005. The C64DTV had
  25. just been released and the Amiga
  26. forums were buzzing disccussing the
  27. possibility of putting a complete
  28. Amiga with games inside a single
  29. joystick. Things like ASIC's, FPGA's
  30. and VHDL were discussed and being a
  31. hardware engineer, they immediately
  32. caught my attention. I remember that
  33. the discussions ended with the
  34. conclusion that it should be possible
  35. to put an Amiga in a joystick but that
  36. it would be a very difficult task. The
  37. first step of such an undertaking
  38. would be to reverse engineer the Amiga
  39. chipset & run it inside an FPGA.
  40.  
  41. The following weeks I discussed this
  42. idea with a collaegue who also
  43. happened to be an Amiga enthusiast. He
  44. did some FPGA programming during his
  45. previous job.The more he told me about
  46. FPGA's and the more I dug into my old
  47. Amiga literature, the more I became
  48. convinced that it could indeed be done
  49. And so it started, I learned Verilog,
  50. bought an FPGA board and started
  51. coding! It took me almost a year to
  52. get the Minimig to boot it's first
  53. game (which was Lemmings, by the way).
  54. It was and is the largest hobby
  55. project I have ever started.
  56.  
  57. The first version of Minimig was
  58. built around a Digilent Spartan-3 FPGA
  59. starter board, which I expanded with a
  60. real 68000, an upgraded vga output and
  61. a PIC- controller based floppy
  62. emulator. That version can be seen in
  63. the picture to the left. Later I moved
  64. the design to it's own custom-designed
  65. PCB which I called rev1.0. That is the
  66. version that is described here.
  67.  
  68. Minimig rev1.0 technical description
  69. The Minimig rev1.0 is built on  a
  70. single 12*12cm PCB that contains all
  71. components to make up a complete Amiga
  72. It has no floppy drive or harddisk.
  73. Instead it is equipped with a MMC
  74. flash card slot and a microcontroller
  75. based floppy emulator.
  76.  
  77. The flash card holds the disk-images
  78. which can be "loaded" into the Minimig
  79. using a convenient on-screen-display.
  80.  
  81. The (physical) hardware of the
  82. Minimig consists of 4 major parts:
  83.  
  84. The FPGA
  85. The 68000
  86. The RAM
  87. The PIC controller
  88. The FPGA
  89. The FPGA is the heart of the Minimig.
  90. The FPGA used is a 400Kgate Spartan-3
  91. byXilinx. All the other major
  92. components (RAM and 68000) connect
  93. directly to the FPGA. The FPGA
  94. implements the Amiga custom chips
  95. Denise, Agnus, Paula and Gary as well
  96. as both 8520 CIA's. It also implements
  97. a simple version of Amber so that VGA
  98. monitors can be connected. Besides
  99. this, the FPGA also acts as an
  100. automatic joystick-mouse-switcher, a
  101. PS2-to- Amiga-keyboard converter,
  102. PS2-to- Amiga-mouse converter and as
  103. an OSD (on-screen display) generator.
  104. All of these function were not present
  105. in the original Amiga, but make life
  106. much easier now that we are living in
  107. the 21th century! The Spartan-3 is a
  108. ram-based FPGA and must be loaded with
  109. a "core" upon startup. This is done by
  110. the PIC controller described below.
  111.  
  112. The 68000
  113. The 68000 is the Minimig's main
  114. processor. The Minimig uses a special
  115. version of the 68000: the MC68SEC000.
  116. This version runs at 3.3V and is
  117. completely static (so it can run at
  118. any frequency between 0 and Fmax).
  119. This makes it an excellent companion
  120. for the Spartan-3 FPGA as there is no
  121. need for level-shifting between 3.3V
  122. and 5V levels. The MC68SEC000 connects
  123. directly to the FPGA.
  124.  
  125. The RAM
  126. The Minimig rev1.0 board contains
  127. 2Mbyte of 70ns static ram. The RAM is
  128. organised as 2 524288*16 banks. Each
  129. bank has seperate enables for the
  130. upper and lower byte. The RAM is used
  131. to implement the 3 types of memory
  132. needed by the Minimig, namely:
  133. kickstart rom area, chip ram and
  134. (ranger) fast ram. As the Minimig has
  135. no kickstart socket, the kickstart
  136. image must be loaded upon startup.
  137. This is done by the PIC controller
  138. described below. Once loaded, writes
  139. to that area of the RAM are disabled
  140. and the area acts like a read-only
  141. memory. The remaining part of the RAM
  142. (1.5Mbyte) is divided up between chip
  143. and fast ram. NOTICE: The ST RAM chips
  144. used in Minimig rev1.0 are obsolete.If
  145. you want to build a Minimig rev1.0,
  146. please check the availability of all
  147. used parts first. A suitable
  148. replacement for the ST type is the
  149. ISSI IS62WV51216BLL-55TLI. These chips
  150. can still be bought from Digikey
  151. (part number 706-1048-ND)
  152.  
  153. The PIC controller
  154. The PIC controller fullfills the role
  155. of "bios". It is a single chip 8-bit
  156. microcontroller from Microchip. The
  157. PIC controller configures the FPGA
  158. (by loading a core into it), loads the
  159. kickstart image into the kickstart ram
  160. area and acts as an Amiga floppy
  161. emulator. Thus, the PIC controller
  162. really starts the system up as soon as
  163. power is applied, hence the "bios"like
  164. function. The Minimig uses a PIC
  165. controller type 18LF252/SP.
  166.  
  167. FPGA general internal architecture
  168. Besides the physical hardware, there
  169. is the "programmed" hardware inside
  170. the FPGA.This hardware is described in
  171. Verilog. To keep the project
  172. manageable  have kept the same
  173. organization as a real Amiga. That is,
  174. I have kept the Denise functions in a
  175. Denise module, Agnus functions in an
  176. Agnus module etc.I have even kept a
  177. lot af the signal names the same, so
  178. there is a dmal signal(as well as an
  179. extra dmas signal), an int2 signal,
  180. an ovl signal and so on. Besides these
  181. standard modules, there are also 2
  182. bridge modules to connect the FPGA
  183. hardware to the RAM and 68000 chips.
  184. The code for the FPGA has been
  185. synthesized using the free webpack
  186. tool V9.1i from Xilinx. FPGA internal
  187. bus structure and clocking scheme
  188. This needs some explanation as it is
  189. quite different from a real Amiga 500.
  190. Whereas the Amiga 500 had a seperate
  191. chipram bus and fastram bus, the
  192. Minimig has only a single, synchronous
  193. multiplexed bus. To compensate for
  194. this, this bus is clocked at
  195. 7.09379MHz or twice the speed of an
  196. PAL Amiga 500 bus. This clock
  197. is the Minimig's main clock (called
  198. "clk" in the code). It is the clock
  199. far ALL Minimig sub-systems, including
  200. the CIA's. As the CIA's are normally
  201. run at the so-called E clock
  202. (709379Hz), special circuitry has been
  203. added to Gary to slow down CPU
  204. accesses to the CIA's to approximately
  205. E clock speed. Clk is also used as the
  206. Minimig's pixel clock. For hires
  207. screen-modes clk is "double pumped",
  208. with new pixels put out at both the
  209. rising edge and the falling edge of
  210. clk giving an effective pixel rate of
  211. 14.18758MHz. Besides clk, two other
  212. clocks are generated; qclk and vgaclk.
  213. Qclk is clk shifted by 90 degrees.Qclk
  214. is used by the SRAM bridge to control
  215. read/write timing. Vgaclk is used as
  216. the pixelclock for the Amber
  217. scandoubler module. All clocks are
  218. derived from a single 4.433619MHz PAL
  219. crystal using the FPGA's DCM module
  220. (Digital Clock Manager)
  221.  
  222. The Minimig internal bus is used as
  223. both the chipram bus and fastram bus.
  224. All modules (including kickstart area
  225. and CIA's) connect to this bus. This
  226. bus is time-multiplexed between
  227. chipram and fastram/kickstart/CIA's.
  228. The mulitplexing is controlled by
  229. Agnus and the horizontal pixel counter
  230. "horbeam" The lower 2 bits of horbeam
  231. define 4 types of bus "slots" :
  232. slot 2'b00: fastram (68000)
  233. slot 2'b01: chipram (disk, bitplanes,
  234. copper, blitter and 68000)
  235. slot 2'b10: fastram and blitter (non
  236. standard, gives cpu some more cycles
  237. in chipram to fix some compability
  238. problems) slot 2'b11: chipram (disk,
  239. bitplanes, sprites, audio and 68000)
  240.  
  241. The Agnus module passes the signals
  242. dma,dmapri and dmawr to the Gary
  243. module to indicate the type of bus
  244. slot. Dma indicates that Agnus is
  245. doing a bus cycle
  246. (read or write) and dmawr indicates
  247. that that cycle is a write cycle.
  248. Dmapri indicates that Agnus only holds
  249. the bus bus does not write or read it
  250. (Agnus does a "dummy cycle). If both
  251. dma and dmawr are inactive, the CPU
  252. can use the bus if it wants to.
  253.  
  254. Because the FPGA does not supports
  255. internal tri-state busses, all
  256. devices are connected together using
  257. 'or" gates. The convention is thus as
  258. follows; when  a device is not
  259. selected, it drives it's outputs low.
  260. When the device is selected,
  261. it drives it's outputs with the data
  262. it wants to write.
  263.  
  264. Boot sequence
  265. The boot sequence is a 2-step
  266. process. The first step is to
  267. configure the FPGA.
  268. Like said, this is done by the PIC
  269. controller. The second step is to
  270. load the Kickstart image. This is done
  271. as follows;
  272.  
  273. Once the FPGA is configured, the
  274. system is booted in a special state.
  275. In this state, a small bootrom is
  276. overlayed at addresss #0. This bootrom
  277. loads the kickstart through the floppy
  278. emulator. Once the kickstart has been
  279. loaded, the bootrom resets the system.
  280. The bootrom then disappears from
  281. address #0 and the system boots as if
  282. it were a normal Amiga. The code from
  283. the bootrom is written in 68000
  284. assembly. I have used the freeware
  285. AS32 assembler from the Freescale
  286. website. I have made it available for
  287. download here as I can't find it
  288. anymore on their (again...) redesigned
  289. website. PIC controller firmware and
  290. FPGA to PIC communication
  291.  
  292. The PIC's firmware is written in Hi-
  293. Tech Ansi C. The firmware contains
  294. MMC (Multi Media Card) and FAT16
  295. drivers to control the flash card. The
  296. firmware also handles the user-
  297. interface and on-screen-display. The
  298. PIC communicates with the FPGA through
  299. an SPI interface. The MMC card is also
  300. connected to this SPI bus. In it's
  301. current form, the FPGA has 2 SPI
  302. "addresses". Address #0 is selected by
  303. the fpga_sel0 signal and control the
  304. floppy emulator. fpga_sel1
  305. controls the on-screen-display.
  306. fpga_sel2 is currently unused.
  307.  
  308. Disclaimer 1: About the Kickstart
  309. To function, Minimig needs  a
  310. kickstart rom image. The Kickstart is
  311. a copyrighted piece of software.
  312. Therefore, you are not allowed to just
  313. download it anywhere from the web. You
  314. must own the original kickstart ROMs &
  315. make an image of them using the method
  316. described in the UAE archives.
  317.  
  318. Disclaimer 2: If you decide to built
  319. it. Do so completely at your own risk.
  320. This is not a beginners project.
  321.  
  322. What does the future hold for
  323. Minimig? I don't know. My hope is
  324. that due to the GNU public license
  325. people will debug it, expand it and
  326. generally make it better.
  327. What I would like to see first is the
  328. implementation of some form of
  329. harddisk support, ethernet support and
  330. offcourse a debugged sprite engine
  331. :-). It would also be nice if the
  332. verilog sources of Minimig would make
  333. it into a sourceforge project. I could
  334. really need some help there. And the
  335. rest? Only time will tell!
  336.  
  337. Reprinted with the Copyright holders
  338. permission information taken from
  339. http://home.hetnet.nl/{$de}weeren001/
  340. Commodore Free would like to thank
  341. Dennis van Weeren for allowing the
  342. reprint of the article
  343.