SSD Firmware Development — Part 3 — Addressing

Lan D. Phan
Sep 3, 2018 · 3 min read

When it comes to digital storage devices, the write and read commands are the mandatory commands, for obvious reasons. The industry has developed a standard for such commands and we can break it down to its simplest core concept. In short, for each write or read command, the necessary input from the host to the device is “where” to read or write and how much. Additionally, for write, the host will supply the data to be written. Thus, we have an address, length, and buffer either containing the data to be written or to receive data from the device.

Addressing

The logical block address (LBA) is the standard used to specify the address for write and read commands. Each LBA defines a 512 bytes sector into the device’s storage space, although rarely there are variations of the sector size. LBA’s are addressed linearly, ranging from 0 to n-1 inclusively, where n is the maximum available sectors. With the Identify or Inquiry command, the storage device informs the host of the maximum available addressable capacity, and should properly reject requests accessing beyond such range.

Figure 1 — Host addressing space

So these simple prototypes define write and read commands:

Read: LBA, length, buffer

Write: LBA, length, buffer

From Host to NAND and Vice Versa

With what we know up to this point, how would we design an SSD such that data can be trafficked between host and NAND? Recall that the NAND arrangement within the SSD has its own addressing space, the rows and columns. For NAND write and read operations, the address space is the rows, which are physically and logically arranged into blocks and pages.

Figure 2 — Row addressing space
Figure 3 — Block-Page addressing space

Note that the (block, page) addressing scheme is only an alternative to the row-based addressing scheme. For example, if there are 256 pages in a block, then block-page (2, 5) is equivalent to row (2*256 + 5) or 517.

For the sake of this discussion, let’s assume the NAND we are using has the following specification:

Bytes per sector: 512

Sectors per page: 8

Pages per block: 256

Blocks per device: 256

Our device would have a maximum of 512K (K being 1024) sectors capacity. In a naïve way, our device would report 512K available LBA’s. If we arrange everything linearly and use direct-mapping, we can arrive at the simple formulas

row = LBA

block = row / pages-per-block

page = row % pages-per-block

Figure 4 — Direct-mapping

So now you have everything you need to develop SSD firmware right…? I’ll leave you to think a bit until the next part.

Solid State Drives: Ideas, Knowledge, and Development

To share ideas, knowledge, and development experiences related to solid state drives (SSD).

Lan D. Phan

Written by

Solid State Drives: Ideas, Knowledge, and Development

To share ideas, knowledge, and development experiences related to solid state drives (SSD).

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade