mycontroller – DMA
November 1, 2007 Leave a comment
This is part of a project to build a complete, functional, extremely basic microcontroller. It is built using multimedia logic.
This section is a simulated very simplified DMA.
The test of writing back and forth bytes seems to work.
Also, the example from the lab specification seems to work. Namely:
- Select head 1, track 2, sector 3, block 4 on the disk.
- Select address AB on the RAM.
- Select 6 bytes to transfer.
- Select download.
- Disable the master clear.
- Hit the transfer button. The yellow download LED should illuminate.
- Hit the clock at least 7 times. Your transfer should stop after the 6th cycle, illuminate the green completion LED, and deactivate the yellow download LED.
- You should see 6 different bytes transfer from disk blocks 4 through 9 from head 1, track 2, sector 3 to RAM addresses AB through B0, respectively. The particular bytes depend on how you organized the address space on your â€œdisk.â€
- Select head 2, track 3, sector 4, block 5 on the disk.
- Select address AC on the RAM.
- Select 2 bytes to transfer.
- Select upload.
- Hit the transfer button. The yellow upload LED should illuminate.
- Hit the clock at least 3 times. Your transfer should stop after the 2nd cycle, illuminate the green completion LED, and deactivate the yellow upload LED.
- You should see 2 bytes transfer from RAM addresses AC and AD to disk blocks 5 and 6 on head 2, track 3, sector 4.
- These should be the second and third bytes you saw in the download example.
You can’t have reads/writes across different tracks or heads, which will produce (perhaps to the user) unexpected results, overwriting the same sectors rather than proceeding to the next track. In short, reading/writing across tracks requires multiple reads/writes.
I made a conscious decision to not worry about the clock wrapping around at this point. If the clock does wrap around, it may screw stuff up.
Here is a link to the source.