Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
10 years ago

Write to SD card using Altera DE1 and Verilog

I'm using an Altera DE1 to implement a snake game on it. I developed a 4-bit counter, on my verilog code, to count the times the snake eats a dot. How can I save this 4-bit digit into the SD card?

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You could, but if you wrote all the code yourself it might be bigger than the snake game. How about the 7 segment display, or the serial port?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You could, but if you wrote all the code yourself it might be bigger than the snake game. How about the 7 segment display, or the serial port?

    --- Quote End ---

    I'm using the 7 segment display to display the score of the user. But here is the thing, every time the user press reset the system should show the top 3 highest scores. I was thinking on saving these scores into the SD card and load them from it to display the scores on the 7 segment. Can I save the data displayed on the 7 segment to the SD card or is there a better option, other than the SD card, to save the scores?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    The SD card and the FLASH are your only non-volotile on-board options. I'd suggest the SD card could be considered easier to implement.

    This page; "how to use mmc/sdc (http://elm-chan.org/docs/mmc/mmc_e.html)" covers basic access of an SD card. I'd suggest it need not be very big. An SPI host is something an FPGA will easily accommodate.

    Cheers,

    Alex
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I was assuming it was to be written to a file on the SD card. Correctly handling a file system would be hard.

    If you just want to use the SD card for raw data that doesn't need to be read by anything else, then it isn't that hard to read/write a block of data. If you have NAND flash or EEPROM, on your board, that might be easier than the SD card.