TWI684915B - 記憶體區塊大小判定方法 - Google Patents

記憶體區塊大小判定方法 Download PDF

Info

Publication number
TWI684915B
TWI684915B TW107142347A TW107142347A TWI684915B TW I684915 B TWI684915 B TW I684915B TW 107142347 A TW107142347 A TW 107142347A TW 107142347 A TW107142347 A TW 107142347A TW I684915 B TWI684915 B TW I684915B
Authority
TW
Taiwan
Prior art keywords
memory
range
size
reading
magic
Prior art date
Application number
TW107142347A
Other languages
English (en)
Other versions
TW202020658A (zh
Inventor
吳承桓
Original Assignee
智微科技股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 智微科技股份有限公司 filed Critical 智微科技股份有限公司
Priority to TW107142347A priority Critical patent/TWI684915B/zh
Priority to US16/276,546 priority patent/US10740014B2/en
Application granted granted Critical
Publication of TWI684915B publication Critical patent/TWI684915B/zh
Publication of TW202020658A publication Critical patent/TW202020658A/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • G06F3/0607Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1008Correctness of operation, e.g. memory ordering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • G06F2212/1024Latency reduction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1041Resource optimization
    • G06F2212/1044Space efficiency improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1056Simplification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7204Capacity control, e.g. partitioning, end-of-life degradation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7206Reconfiguration of flash memory system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Read Only Memory (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

一種記憶體區塊大小判定方法,包含:將一魔術字串寫入到一記憶體的記憶空間的起始位置;以第一範圍對該記憶體進行第一次讀取,並於該第一次讀取未找到該魔術字串的情況下,以第二範圍對該記憶體進行第二次讀取,直到找出該魔術字串為止;以及當魔術字串係於第N次讀取中被找到時,將對應於該第N次讀取的第N範圍判定為該記憶體的區塊大小,其中N係為大於或等於1的正整數。

Description

記憶體區塊大小判定方法
本發明係關於記憶體裝置之領域,尤其關於一種記憶體區塊大小判定方法。
序列周邊介面(SPI)為在兩個裝置之間提供相對簡單連接之通信介面,其用以作為主裝置與一或多個附屬裝置進行通信的介面。資料經由SPI同時傳輸及接收,從而使其成為全雙工協定(full duplexed protocol)。
由於市面上串列週邊介面快閃記憶體(flash memory)的種類繁多且每種快閃記憶體的大小可能不一致,當燒入資料大於快閃記憶體大小時可能造成不可預期的錯誤。因此,要如何妥善預防將過大的資料燒入串列週邊介面快閃記憶體是本領域人士必須解決的問題。
相關技術中提及透過將每顆快閃記憶體的讀取辨識碼(RDID)以及將記憶體大小記錄於資料表(datasheet)中,之後要對快閃記憶體進行讀取的時候則透過查表的方式找出RDID以及對應的記憶體大小。換言之,習知作法必須不斷地查表,而這樣的查表動作除了耗費時間,也影響到維護上的便利性,舉例來說,每當使用新的快閃記憶體時,開發者就必須去研究其規格,並且修改程式碼以及資料表。
有鑑於上述相關技術會遭遇的問題,本發明的目的在於提供一種記憶體區塊大小判定方法,以在不用事先記錄所要讀取的記憶體的規格以及進行查表的情況下取得記憶體大小,以利後續之各種操作。
本發明的至少一實施例提供了一種記憶體區塊大小判定方法,該方法包含以下步驟:將一魔術字串(magic string)寫入到一記憶體的記憶空間的起始位置;以第一範圍對該記憶體進行第一次讀取,並於該第一次讀取未找到該魔術字串的情況下,以第二範圍對該記憶體進行第二次讀取,直到找出該魔術字串為止;以及當魔術字串係於第N次讀取中被找到時,將對應於該第N次讀取的第N範圍判定為該記憶體的區塊大小,其中N係為大於或等於1的正整數。
透過以上本發明的方法,可快速且確實地得知記憶體的區塊大小。另外,依據本發明之實施例來實施不需要額外設置硬體架構,亦即,並不會造成成本的增加。相較於相關技術,本發明能在沒有副作用或較不可能帶來副作用之狀況下實現記憶裝置的讀取。
202~222‧‧‧步驟
第1圖係為串列週邊介面快閃記憶體的操作示意圖。
第2圖係為根據本發明實施例的記憶體區塊大小判定方法的示意圖。
在說明書及後續的申請專利範圍當中使用了某些詞彙來指稱特定的元件。所屬領域中具有通常知識者應可理解,硬體製造商可能會用不同的名詞 來稱呼同樣的元件。本說明書及後續的申請專利範圍並不以名稱的差異來作為區分元件的方式,而是以元件在功能上的差異來作為區分的準則。在通篇說明書及後續的請求項當中所提及的「包含」係為一開放式的用語,故應解釋成「包含但不限定於」。
請參考第1圖,第1圖係為串列週邊介面(SPI)快閃記憶體的操作示意圖,如第1圖所示,共有兩條控制線及兩條資料線,控制線包含序列時脈(serial clock)線SCLK及晶片選擇(chip select)線CS #,其中序列時脈線SCLK用以提供數位時脈信號,晶片選擇線CS用以選取所要操作的裝置。資料線包含訊號輸出線SO以及訊號輸入線SI,用以傳遞資料。
在本範例中,係使用長度為24 bit的讀取指令來讀取SPI快閃記憶體的內容,而該讀取指令係透過訊號輸入線SI來傳送,之後第一個記憶體位置有三個(A23~A0)待讀取。在本實施例中,只有最大有效位元AMSB(most significant bit)至A0會被解碼,其餘的位元(A23~AMSB)則被忽略。
有別於習知技術必須繁瑣地於資料表中記錄每顆快閃記憶體的RDID和記憶體大小,並且於之後讀取時再搭配查表的方式來確認對應當下的快閃記憶體的RDID以及記憶體大小,取而代之地,本發明係即時(real-time)偵測或運算出記憶體大小,除了省時也省下不少的記憶體空間,以下將對實施細節作詳細的介紹。需注意的是,習知技術必須根據RDID來找出快閃記憶體在查找表(look-up table)中的對應位置。
首先將一魔術字串(magic string)寫入到一記憶體的記憶空間的起 始位置,接著透過尋找該魔術字串來判定記憶體大小,其中該起始位置可為address 0。在計算機的用語中,魔術字串係指程式開發者認為不會來自於外部、且能夠激活(activate)隱藏功能的一種輸入。通常,使用者在設計輸入的時候都會期望這些輸入能有預期的響應,然而,若使用者無意間使預先定義的輸入引發內部的某些功能,這樣的程式響應通常超出使用者的預期,因而有「魔術」之稱。以上是偏重學術上的定義,簡單來說,可以將魔術字串理解為一特定的字串,大小依使用者而定,但字串內容不重複於其他字串的內容。
首先,將一長度未定的魔術字串寫入快閃記憶體起始位置,並由位置64KB作為第一次讀取長度。假設SPI快閃記憶體的實際大小為64Kbyte(KB),A15~A0為可解析的位元,且A23~A16為無效位元,當讀取位置64KB(0x010000)時,因A15~A0皆為0,讀到的SPI快閃記憶體位置相當於0x000000,因此第一次讀到魔術字串的位置即為SPI快閃記憶體大小。其中,上述24個位元中實際上只使用到16個位元,另外8個位元相當於預設位元。以上是探討在第一次讀取中就找到魔術字串的情況,若在第一次讀取中即讀到魔術字串,則將該第一次讀取長度視為快閃記憶體大小。
當第一次讀取未能找到魔術字串的情況下,本發明會繼續以第二範圍對該記憶體進行第二次讀取,以此類推,直到找出魔術字串為止。當魔術字串係於第N次讀取中被找到時,即判定對應於該第N次讀取的第N範圍判定為該記憶體的區塊大小,其中N係為大於或等於1的正整數。舉例來說,在第二次讀取時可採用第一次讀取長度的兩倍進行讀取(即採用128KB),以此類推,第三次讀取則採用256KB進行讀取。換言之,本發明可採用以2的冪次方為倍數的範圍成長速度來讀取魔術字串長度,其中若2X位置沒有讀到魔術字串但2X+1位置卻 有讀取到魔術字串,則快閃記憶體大小為64KB*2X+1,以此類推。
需注意的是,以上僅為舉例之目的,並不用以限縮本發明的範疇,舉例來說,本發明不受限於上述數值,起始的64KB區間以及24位元的讀取指令皆可調整為其他數值,而在後續迭代中所使用的倍數亦不限定為必須呈現2的冪次方關係,而可以是其他數值的的冪次方關係。
請參考第2圖,第2圖係為根據本發明實施例的記憶體區塊大小判定方法的示意圖。請注意,假若可獲得實質上相同的結果,則這些步驟並不一定要完全遵照第2圖所示的執行次序來執行,且本流程亦不排除可插入其它相關步驟的可能性。第2圖所示之步驟可與以上所介紹的本發明概念結合,並可簡單歸納如下:步驟202:開始。
步驟204:將魔術字串寫入到快閃記憶體位址0x000000。
步驟206:將魔術字串的大小從位址0x010000讀取到緩衝記憶體。
步驟208:判斷是否找到魔術字串(若魔術字串相同於緩衝記憶體,則判定已找到),若是,則進入步驟210;若否,則進入步驟212。
步驟210:判定串列週邊介面快閃記憶體的大小為0x010000位元組(Byte)。
步驟212:將魔術字串的大小從位址0x020000讀取到緩衝記憶體。
步驟214:判斷是否找到魔術字串(若魔術字串相同於緩衝記憶體,則判定已找到),若是,則進入步驟216;若否,則進入步驟218。
步驟216:判定串列週邊介面快閃記憶體的大小為0x020000位元組。
步驟218:將魔術字串的大小從位址0x040000讀取到緩衝記憶體。
步驟220:判斷是否找到魔術字串(若魔術字串相同於緩衝記憶體,則判定已找到),若是,則進入步驟222;若否,則繼續進入下一次迭代。
步驟222:判定串列週邊介面快閃記憶體的大小為0x040000位元組。
透過以上本發明的方法,可快速且確實地得知記憶體的區塊大小。另外,依據本發明之實施例來實施不需要額外設置硬體架構,亦即,並不會造成成本的增加。相較於相關技術,本發明能在沒有副作用或較不可能帶來副作用之狀況下實現記憶裝置的讀取。以上所述僅為本發明之較佳實施例,凡依本發明申請專利範圍所做之均等變化與修飾,皆應屬本發明之涵蓋範圍。
202~222‧‧‧步驟

Claims (5)

  1. 一種記憶體區塊大小判定方法,該方法包含以下步驟:將一魔術字串(magic string)寫入到一記憶體的記憶空間的起始位置;以第一範圍對該記憶體進行第一次讀取,並於該第一次讀取未找到該魔術字串的情況下,以第二範圍對該記憶體進行第二次讀取,直到找出該魔術字串為止,其中該第二範圍大於該第一範圍;以及當魔術字串係於第N次讀取中被找到時,將對應於該第N次讀取的第N範圍判定為該記憶體的區塊大小,其中N係為大於或等於1的正整數。
  2. 如請求項1所述的記憶體區塊大小判別方法,其中該記憶體係為一序列邊介面(Serial Peripheral Interface,SPI)快閃記憶體。
  3. 如請求項1所述的記憶體區塊大小判別方法,其中該第一範圍為64K。
  4. 如請求項1所述的記憶體區塊大小判別方法,其中該第二範圍與該第一範圍呈倍數關係。
  5. 如請求項4所述的記憶體區塊大小判別方法,其中該第二範圍與該第一範圍呈2的冪次方關係。
TW107142347A 2018-11-28 2018-11-28 記憶體區塊大小判定方法 TWI684915B (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
TW107142347A TWI684915B (zh) 2018-11-28 2018-11-28 記憶體區塊大小判定方法
US16/276,546 US10740014B2 (en) 2018-11-28 2019-02-14 Memory size determining method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW107142347A TWI684915B (zh) 2018-11-28 2018-11-28 記憶體區塊大小判定方法

Publications (2)

Publication Number Publication Date
TWI684915B true TWI684915B (zh) 2020-02-11
TW202020658A TW202020658A (zh) 2020-06-01

Family

ID=70413563

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107142347A TWI684915B (zh) 2018-11-28 2018-11-28 記憶體區塊大小判定方法

Country Status (2)

Country Link
US (1) US10740014B2 (zh)
TW (1) TWI684915B (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080288715A1 (en) * 2007-05-14 2008-11-20 Qualcomm Incorporated Memory Page Size Auto Detection
US8375173B2 (en) * 2009-10-09 2013-02-12 Qualcomm Incorporated Accessing a multi-channel memory system having non-uniform page sizes
US20140379991A1 (en) * 2013-06-22 2014-12-25 Microsoft Corporation Latch-free, log-structured storage for multiple access methods

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7805460B2 (en) * 2006-10-26 2010-09-28 Polytechnic Institute Of New York University Generating a hierarchical data structure associated with a plurality of known arbitrary-length bit strings used for detecting whether an arbitrary-length bit string input matches one of a plurality of known arbitrary-length bit string
WO2008086237A2 (en) 2007-01-05 2008-07-17 California Institute Of Technology Codes for limited magnitude asymmetric errors in flash memories

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080288715A1 (en) * 2007-05-14 2008-11-20 Qualcomm Incorporated Memory Page Size Auto Detection
US8375173B2 (en) * 2009-10-09 2013-02-12 Qualcomm Incorporated Accessing a multi-channel memory system having non-uniform page sizes
US20140379991A1 (en) * 2013-06-22 2014-12-25 Microsoft Corporation Latch-free, log-structured storage for multiple access methods

Also Published As

Publication number Publication date
TW202020658A (zh) 2020-06-01
US10740014B2 (en) 2020-08-11
US20200167077A1 (en) 2020-05-28

Similar Documents

Publication Publication Date Title
JP5532268B2 (ja) 装置のエンディアンモードを管理するためのシステムおよび方法
US7882331B2 (en) Method and system for simultaneously supporting different block sizes on a single hard drive
US6122683A (en) Handshake minimizing serial-to-parallel interface with shift register coupled by parallel bus to address logic and control logic
US6618773B1 (en) Receiving a particular identification file among an analog identification file and a digital identification file in response to a request to a dual-interface monitor
CN111737173B (zh) I2c总线通信控制方法、装置、系统及可读存储介质
US7069350B2 (en) Data transfer control system, electronic instrument, and data transfer control method
US6434633B1 (en) Method and apparatus for facilitating AC-link communications between a controller and a slow peripheral of a codec
US20160092118A1 (en) Memory write management in a computer system
JP2005122725A (ja) スマートメモリパススルー通信のための方法及び装置
US8902683B2 (en) Memory access alignment in a double data rate (‘DDR’) system
US7779174B2 (en) Method and apparatus for dynamically changing burst length using direct memory access control
CN114174973A (zh) 串行存储器设备i/o模式选择
US10387361B2 (en) Serial device with configuration mode for changing device behavior
US20060136900A1 (en) Devices and methods for updating program code via a serial ata interface
CN109992556B (zh) 一种i2c驱动方法和装置
WO2020206879A1 (zh) Pcie宽度自动适配方法、装置及电子设备和存储介质
TWI684915B (zh) 記憶體區塊大小判定方法
TW201810058A (zh) 周邊介面電路與周邊記憶體系統
WO2019000456A1 (zh) 传输数据掩码的方法、内存控制器、内存芯片和计算机系统
JP5341198B2 (ja) 通信インタフェースにおけるビット反転
TW201508487A (zh) 調整sas擴展器位址的系統及方法
CN111273852A (zh) 存储器区块大小判定方法
JP2004118825A (ja) メモリバスインタフェース
US7506133B2 (en) Method and apparatus for high speed addressing of a memory space from a relatively small address space
TWI814655B (zh) 記憶裝置、快閃記憶體控制器及其控制方法