TW200530920A - Microcontroller instruction set - Google Patents
Microcontroller instruction set Download PDFInfo
- Publication number
- TW200530920A TW200530920A TW093132265A TW93132265A TW200530920A TW 200530920 A TW200530920 A TW 200530920A TW 093132265 A TW093132265 A TW 093132265A TW 93132265 A TW93132265 A TW 93132265A TW 200530920 A TW200530920 A TW 200530920A
- Authority
- TW
- Taiwan
- Prior art keywords
- instruction
- register
- bit
- text
- value
- Prior art date
Links
- 230000006870 function Effects 0.000 claims abstract description 34
- 238000000034 method Methods 0.000 claims description 46
- 230000008569 process Effects 0.000 claims description 39
- 238000012545 processing Methods 0.000 claims description 33
- 238000003860 storage Methods 0.000 claims description 13
- 239000000463 material Substances 0.000 claims description 9
- 230000008901 benefit Effects 0.000 claims description 2
- 230000006399 behavior Effects 0.000 abstract description 2
- 230000003247 decreasing effect Effects 0.000 abstract description 2
- 230000000694 effects Effects 0.000 description 79
- 238000010586 diagram Methods 0.000 description 38
- 230000000295 complement effect Effects 0.000 description 22
- 101100013509 Gibberella fujikuroi (strain CBS 195.34 / IMI 58289 / NRRL A-6831) FSR2 gene Proteins 0.000 description 19
- 101100290377 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) MCD4 gene Proteins 0.000 description 19
- 238000012360 testing method Methods 0.000 description 16
- 230000008859 change Effects 0.000 description 15
- 238000013507 mapping Methods 0.000 description 12
- 102100028772 Proline dehydrogenase 1, mitochondrial Human genes 0.000 description 11
- 108020004930 proline dehydrogenase Proteins 0.000 description 11
- 238000004088 simulation Methods 0.000 description 9
- 239000004575 stone Substances 0.000 description 9
- 101100496108 Mus musculus Clec2h gene Proteins 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 5
- 230000002093 peripheral effect Effects 0.000 description 5
- 235000013399 edible fruits Nutrition 0.000 description 4
- 108700012361 REG2 Proteins 0.000 description 3
- 101150108637 REG2 gene Proteins 0.000 description 3
- 101100120298 Rattus norvegicus Flot1 gene Proteins 0.000 description 3
- 101100412403 Rattus norvegicus Reg3b gene Proteins 0.000 description 3
- 230000004913 activation Effects 0.000 description 3
- 238000012790 confirmation Methods 0.000 description 3
- 230000009849 deactivation Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000009940 knitting Methods 0.000 description 2
- 239000003550 marker Substances 0.000 description 2
- 239000000047 product Substances 0.000 description 2
- 239000002689 soil Substances 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 102100023882 Endoribonuclease ZC3H12A Human genes 0.000 description 1
- 101710112715 Endoribonuclease ZC3H12A Proteins 0.000 description 1
- 241000283086 Equidae Species 0.000 description 1
- 102100023116 Sodium/nucleoside cotransporter 1 Human genes 0.000 description 1
- 101710123675 Sodium/nucleoside cotransporter 1 Proteins 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- QGVYYLZOAMMKAH-UHFFFAOYSA-N pegnivacogin Chemical compound COCCOC(=O)NCCCCC(NC(=O)OCCOC)C(=O)NCCCCCCOP(=O)(O)O QGVYYLZOAMMKAH-UHFFFAOYSA-N 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 210000000952 spleen Anatomy 0.000 description 1
- 210000002784 stomach Anatomy 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- WJCNZQLZVWNLKY-UHFFFAOYSA-N thiabendazole Chemical compound S1C=NC(C=2NC3=CC=CC=C3N=2)=C1 WJCNZQLZVWNLKY-UHFFFAOYSA-N 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/34—Addressing or accessing the instruction operand or the result ; Formation of operand address; Addressing modes
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Executing Machine-Instructions (AREA)
Abstract
Description
200530920 九、發明說明: 【發明所屬之技術領域】 本發明係關於微控器,更明確言之,本發明係關於集合 在一指令集中並用於操控該微控器之行為的操作碼指令。 【先前技術】 微控器單元(MCU)用於製造與電子產業已有許多年。圖1 顯示用於中型MCU裝置之一典型核心記憶體匯流排組態。 在許多情形下,微控器利用精簡指令集計算(RISC)微處理 器。部分此等裝置之高性能可歸因於RISC微處理器中常見 的若干架構性特徵。此等特徵包括:200530920 IX. Description of the invention: [Technical field to which the invention belongs] The present invention relates to a microcontroller, more specifically, the present invention relates to an operation code instruction that is assembled in an instruction set and used to control the behavior of the microcontroller. [Previous Technology] Microcontroller units (MCUs) have been used in the manufacturing and electronics industries for many years. Figure 1 shows a typical core memory bus configuration for a mid-range MCU device. In many cases, microcontrollers use reduced instruction set computing (RISC) microprocessors. The high performance of some of these devices can be attributed to several architectural features commonly found in RISC microprocessors. These characteristics include:
Harvard 架構 長字指令 單字指令 單週期指令 指令管線操作 精簡指令集 暫存器檔案架構 正交(對稱)指令 Harvard架構: 如圖2所示,Harvard架構具有程式記憶體26與資料記憶 體22,此等記憶體係分開的記憶體,並且可藉由CPU 24從 分開的匯流排予以存取。此使得頻寬相對於傳統的von Neumann架構(如圖3所示)有所改善,在von Neumann架構 中,CPU 34使用相同的匯流排從相同的記憶體36擷取程式 96779.doc 200530920 ^貝料為了執行一指令,v〇n Neumann機器必須穿過8位 兀=机排進仃一或多次(一般為多次)存取,以擷取該指令。 接著可i ㈣取、操作及可能寫人資料。從此說明中 可看出,匯流排可變得極其擁擠。 與·心聰_機器相反,在Harvard架構之下,在單個 :令週期中擷取該指令的所有14個位元。因此,在 架構下,正在存取程式記《時,資料記憶體係在-獨立 的[机排上’亚且可進行讀取與寫人。此等分開的匯流排 旎夠在執行一指令的同時擷取下一指令。 長字指令: 長字指令的指令匯流排寬於8位元資料記憶體匯流排(前 者的位元更多)。因為兩個匯流排是分開的,故可實現此特 徵。此進一步使得指令的尺寸不同於8位元寬資料字,從而 可更有效地使用程式記憶體,因為程式記憶體的寬度係針 對架構要求加以最佳化。 單字指令: 一早字指令操作碼係14位元寬,從而可具有所有的單字指 令。一 14位元寬的程式記憶體存取匯流排可在單個週期中 擷取一 14位元指令。若使用單字指令,則程式記憶體位置 的字數目等於裝置的指令數目。此表示所有的位置皆係有 效指令。典型地,在von Neumann架構(如圖3所示)中,大 多數指令為多位兀組。然而,一般而言,具有4尺位元組程 式記憶體之裝置將允許大約2K的指令。此2:1的比率係一般 化的,並且取決於應用碼。因為每個指令要採用多個位元 96779.doc 200530920 組,故不能保證每個位置均係一有效的指令。 指令管線: 該指令管線係-使指令之擷取與執行重疊的二級管線。 指令的擷取耗用-機器週期(rTCY」),而指令的執行則 耗用另"一 TCY。然而,由於g益扣八从❿ 於目則私令的擷取與先前指令的 執行係重疊的,故在每個單—的TCY期間,掏取一指令, 並且執行另一指令。 7 單週期指令: 如果程式記憶體匯流排係14位元寬’故可在單個心中 掏取整個指令。該指令包含所有所需要的資訊,並且係在 单個週期中加以執行。如果指令的結果修改了程式計數哭 的内容,則執行中可能會延遲一週期。此要 並且擷取一新的指令。 戎 精簡指令集: 當一指令集係經過精心設計並 僅需較少的指令即可執行二::…父(對稱)時, ,丨、日, 卩了執仃王部必要的任務。如果指令較 少,則可更快地學習整個指令集。 暫存器檔案架構·· ::接或間接地定址該暫存器播案/資料記憶體 的特殊功能暫存哭 ^ , 有 中。 匕括程式計數器’映射於資料記憶體 正交(對稱)指令: /] γ I使传可能使用任何定址模式在任何暫存3|上勃 行任何操作。肤 j㈢仔為上執 此_的性質’加之不存在「特殊的指令, 96779.doc 200530920 使程式設計既簡單又高效。此外,可大幅簡化學習曲線。 σ玄中型才曰令集僅使用兩個非暫存器導向的指令,其係用於 兩個核心特徵。其中一個係SLEEP指令,其將裝置置於最 低功率使用模式。另一個係CLRWDT指令,其藉由防止晶 片上監視計時器(WDT)上溢並重設裝置來保證晶片正確操 作0 時脈方案/指令週期:Harvard architecture long word instruction single word instruction single cycle instruction instruction pipeline operation streamlined instruction set register file structure orthogonal (symmetric) instruction Harvard architecture: As shown in Figure 2, Harvard architecture has program memory 26 and data memory 22, this The memory is separated from the memory system and can be accessed by the CPU 24 from a separate bus. This improves the bandwidth compared to the traditional von Neumann architecture (shown in Figure 3). In the von Neumann architecture, the CPU 34 uses the same bus to retrieve programs from the same memory 36. 96779.doc 200530920 ^ Bay In order to execute an instruction, a Von Neumann machine must pass through an 8-bit unit to access one or more (usually multiple) accesses to retrieve the instruction. Then i can retrieve, manipulate and possibly write the profile information. It can be seen from this description that the bus can become extremely crowded. Contrary to Xincong_machine, under the Harvard architecture, all 14 bits of the instruction are fetched in a single: order cycle. Therefore, under the framework, when the program memory is being accessed, the data memory system is in an independent [machine platoon] and can be read and written. These separate buses are not enough to fetch the next instruction while executing one instruction. Longword instruction: The instruction bus of the longword instruction is wider than the 8-bit data memory bus (the former has more bits). This feature is achieved because the two busbars are separate. This further makes the instruction size different from an 8-bit wide data word, which allows more efficient use of program memory because the width of program memory is optimized for architectural requirements. Single-word instructions: An early-word instruction opcode is 14 bits wide, so it can have all single-word instructions. A 14-bit wide program memory access bus can fetch a 14-bit instruction in a single cycle. If a single word command is used, the number of words in the program memory location is equal to the number of commands for the device. This means that all positions are valid instructions. Typically, in the von Neumann architecture (shown in Figure 3), most instructions are multi-bit groups. However, in general, a device with 4-byte program memory will allow approximately 2K instructions. This 2: 1 ratio is general and depends on the application code. Because each instruction uses multiple groups of 96779.doc 200530920, there is no guarantee that each position is a valid instruction. Instruction pipeline: This instruction pipeline is a secondary pipeline that overlaps the fetch and execution of instructions. The fetch of instructions consumes-machine cycle (rTCY), and the execution of instructions consumes another "TCY". However, since the extraction of the private order from ❿ 目 目 overlaps with the execution of the previous instruction, during each TCY period, one instruction is taken and another instruction is executed. 7 Single-cycle instruction: If the program memory bus is 14 bits wide, it can take the entire instruction in a single heart. The instruction contains all the required information and is executed in a single cycle. If the result of the instruction modifies the contents of the program counter, the execution may be delayed by one cycle. This requires and retrieves a new instruction. Rong streamlined instruction set: When an instruction set is carefully designed and requires fewer instructions to perform two :: ... parent (symmetric),, 丨, Japanese, and 必要, necessary tasks for the executive king. If there are fewer instructions, the entire instruction set can be learned faster. Temporary file file structure ··: The special function of addressing or registering the register broadcast / data memory temporarily or temporarily ^, there is. The program counter ’is mapped to data memory. Orthogonal (symmetric) instructions: /] γ I makes it possible to perform any operation on any temporary storage 3 | using any addressing mode. The nature of the skin is the same as the nature of the implementation of this "in addition to the" special instructions, 96779.doc 200530920 makes programming simple and efficient. In addition, the learning curve can be greatly simplified. Σ Xuanzhong only uses two Non-register-oriented instructions, which are used for two core features. One is the SLEEP instruction, which puts the device in the lowest power usage mode. The other is the CLRWDT instruction, which prevents the on-chip watchdog timer (WDT) ) Overflow and reset the device to ensure the correct operation of the chip. 0 clock scheme / instruction cycle:
在内部將時脈輸入(自〇scl)—分為四,以產生非重疊的 四重日π脈’即Ql、Q2、Q3與Q4。在内部,於每個^遞增 私式4數$ (PC) ’且於q4巾從程式記憶體擷取指令並將其 ㈣於指令暫存器中°纟後續的Qi與Q4期間解碼並執行指 令。圖4與5說明時脈與指令執行流。 指令流/管線操作·· 曰π 」由圖4所示之四個Q週期(Q1、Q2、q Q4)所組成,該等Q週期包含如圖4與5所示的ay。應注The clock input (from 0scl) is internally divided into four to generate a non-overlapping quadruple sun pi pulse ', namely Ql, Q2, Q3, and Q4. Internally, increment the private 4 digits of $ (PC) at each ^ and fetch the instruction from program memory at q4 and store it in the instruction register. 纟 Decode and execute the instruction during subsequent Qi and Q4 . Figures 4 and 5 illustrate the clock and instruction execution flow. Instruction flow / pipeline operation ... "π" is composed of four Q cycles (Q1, Q2, q Q4) shown in Fig. 4, and these Q cycles include ay as shown in Figs. Should note
㈣5中,除任何程式分支之外,在單個週期中執行所; y程式分W週期,因為從管線「清除」榻耳 々,同時擷取新的指令然後加以執行。 擷取耗用一指令週期,而站1 t ^而解碼與執行則耗用另一指令 J。然而,由於管線操作, 地執行。如果一指令 :”在可在-週期中有 目… 使耘式叶數器發生變化(例如_ 則為要一額外的週期來完成 ^ L (圖5)。该指令擷取問 於程式計數器在Qlt遞增 '貞取開 π也 在執仃週期中,於週期01中 所擷取的指令鎖存入「指 抑中 仔杰(IR)」中。然後在如 96779.doc -10- 200530920 Q3⑽週期期間解碼並執行此指令。在Q2期間讀取(運算 及在Q4期間寫入(目的地寫入)資料記憶體。圖5 ’、”員不用於所不指令序列之二級管線之操作。在時間TCY0, ㈣式記憶體操取第一指令。在丁⑺期間,執行第一指令 ㈣取第二指令。在TCY2期間’執行第二指令同時擷取 第二指令。在TCY3期間,擷取第四指令同時執行第三指令 (CALL SUB_1)。當第三指令完成執行時,強制指令四 的位址進入堆g ’然後將程式計數器(pc)變為犯B」的位 址。此表示需要從管線「清除」在TCY3期間所㈣的指令。 在TCY4期間’清除指令四(作為—卿來執行)並且摘取位 址SUBJ的指令。最後在町5期間,執行指令五並榻取位 址SUB—1 + 1的指令。 雖然先前技術之微控器係有用的,但無法模擬各種模 組。而且,如圖1所示的微控器類型無法線性化位址空間。 最後,先4技術之微控器易受編譯器錯誤問題之影響。所 需要者係一種用於微控器之設備、方法與系統,其能夠線 性化位址空間以便實現模組化模擬。本技術中亦存在減少 編譯器錯誤之需要。 【發明内容】 本發明藉由提供一微控器指令集而克服了上述問題以及 現有技術的其他缺陷與不足,該微控器指令集可消除先前 技術中所碰到的許多編譯器錯誤。而且,提供一設備與系 統用來實現一線性化位址空間,其使模組化模擬成為可能。 本發明可直接或間接地定址其暫存器播案或資料記憶 96779.doc -11 - 200530920 體。將所有特殊功能暫存器, 暫存器〇v)映射㈣資料^ ^程式計數器(PC)與工作 稱)指令集,其使得可使用任本發明具有一正交(對 行任何操作。此對稱的性質,::模式在任何暫存器上執 況」,使本發明的喊設計既^以存在「特殊的最佳情 化用於寫入軟體應用程式的學效太此外,可大幅簡 處改進係,使兩個槽案暫存器可用於某些二 連ΤΓΓ 70指令中。此使得:奢祖 便仟貝枓可在兩個暫存器之間直接移 動=不必經過W暫存器,因而可提高性能,並降低程式 3己憶體之使用。 本發明之較佳具體實施例包括-ALU/W暫存器、一 PLA 8位兀乘法益、一具有堆疊之程式計數器(ρ。)、一 表格鎖存器/表格指標、—R〇M鎖存器/ir鎖存$、fsr、中 斷定向電路以及最常見的狀態暫存器。與先前技術不同, 本發明之設計不需要—單獨模組中的計時器、所有的重設 產生電路(娜丁、撤、嫩等)、+斷旗標、致動旗標、 CON暫存器、RC⑽暫存器、組態位元、裝置⑴字元、 ID位置與時脈驅動器。 熟習此項技術者參考詳細說明與附圖之後將會明白額外 的具體實施例。 【實施方式】 本發明係一種用於在數項具體實施例中提供一微控器指 令集與微控裔架構的設備、方法與系統,該微控器架構包 括一線性化的位址空間,其可實現模組化模擬。 96779.doc -12- 200530920 本發明之較佳具體實施例之設備架構以四相内部時脈方 案修改先前技術的Harvard架構,使資料路徑為8位元,而 指令長度為16位元。而且,該較佳具體實施例具有一線性 化的記憶體定址方案,其消除對分頁與分庫的需要。本發 月之。己隐體疋址方案允許程式記憶體定址能力高達位 元組。本發明亦支援模組的模擬。 本發明藉由提供一微控器指令集而克服了上述問題以及 現有技術的其他缺陷與不足,該微控器指令集可消除先前 技術中所碰到的許多編譯器錯誤。而且,提供一設備與系 統用來實現一線性化位址空間,其使模組化模擬成為可能。 本發明可直接或間接地定址其暫存器檔案或資料記憶 體。將所有特殊功能暫存器,包括程式計數器(pc)與工作 暫存器(W)映射於該資料記憶體中。本發明具有一正交(對 稱)指令集,其使得可使用任何定址模式在任何暫存器上執 行任何操作。此對稱的性質,加之不存在「特殊的最佳情 況」’使本發明的程式設計既簡單又高效。此外,可大幅簡 化學習曲線。本發明相對於先前技術的一系列架構改進之 一係’使兩個檔案暫存器可用於某些二運算元指令中。此 使得資料可在兩個暫存器之間直接移動,而不必經過W暫 存器’因而可提高性能,並降低程式記憶體之使用。圖6 顯示本發明之微控器核心之方塊圖。 圖6中說明本發明之微控器核心丨〇〇。按照習慣做法,圖6 中的連接信號線可包含一斜線,該斜線旁邊的數字指示俨 旒線的頻寬(以位元為單位)。參考圖6的右上角,有一資料 96779.doc •13- 200530920 記憶體104,其制於儲存資料以及傳輸資料至—中央處理 單元(下述)並從該中央處理單元傳輸資料。該資料記憶體 购系由―複數餘址位置組成。在本發明之較佳具體實施例 中,該貧料記憶體104係-線性化4K記憶體,其係被分成複 數個部分,其中每個部分有十六個頁面或儲存庫。典型地, 每個儲存庫具有256位址位置。在該較佳具體實施例中,複 數個储存庫令的其中一個儲存庫係專門用於通用與專用暫 存器,在此情形中係最高的儲存庫,即儲存庫〇。 經由一位址鎖存器102將一選擇電路1〇8耦合至資料記憶 體H該選擇電路⑽係用於選擇複數個供應儲存庫位址 值至資料記憶體104之來源之一。 本發明之較佳具體實施例包括一 ALUU〇與工作(w)暫存 σσ 136,一 PLA,一 8位元乘法器;一程式計數器(pc)168與 堆:£ 170 , —表格鎖存器124 ;表格指標148 ; — ROM鎖存器 152與IR鎖存器126 FSH120、121、122;中斷定向電路以 及最常見的狀態暫存器。與先前技術不同,本發明之設計 不而要一單獨模組中的計時器、所有的重設產生電路 (WDT、P〇R、B〇R等)、中斷旗標、致動旗標、intc〇n暫 存器、RCON暫存器、組態位元、裝置ID字元、ID位置與時 脈驅動器。 I/O列表: 使用本發明可獲得一大張輸入/輸出(I/O)命令列表,表i 中顯示該I/O列表。 96779.doc •14- 200530920 表1 I/O列表 名 稱 計數 I/O 正常操作 操作測試 模組 程式 模組 模擬 模組 addr<21:0> 22/0 程式記憶體位址 nqbank<3:0> 4/0 活動低RAM儲存庫 選擇 d<15:0> 16/1 程式記憶體資料 db<7:0> 8/1/0 資料匯流排 forcext 1/1 強制外部指 令測試模式 irp<7:0> 8/0 周邊位址 irp9 I/O 指令暫存器位元9 ncodeprt 1/1 活動低碼保護 neprtim 1/1 活動低EPROM寫入 結束 nhalt 1/1 活動低 暫停 nintake 1/1 活動低中斷確認提前 以及從睡眠中醒來 np<7:0> 8/0 表格鎖存資料 npcmux I/O 活動低PC多工 npchold I/O 活動低PC保持 nprtchg 1/1 活動低埠改變中斷 nq4clrwdt I/O 活動低清除wdt nq4sleep I/O 活動低睡眠 nqrd I/O 活動低讀取檔案 nreset 1/1 活動低重設 nwrf I/O 活動低寫入檔案 ql:q4 4/1 4相Q時脈 ql3 1/1 Q時脈之組合 q23 1/1 Q時脈之組合 q41 1/1 Q時脈之組合 testO 1/1 測試模式0 tsthvdet 1/1 高電壓偵測 wreprom I/O 胃入eprom writem I/O 寫入記憶體 wrtbl I/O 表格寫入指令 nintakd 1/1 中斷確認延遲 intak 1/1 中斷確認 96779.doc -15- 200530920 時脈方案/指令週期 如圖7所示,在内部將時脈輸入(自〇scl)_分為四,以產 生非重疊的四重時脈,即Q卜Q2、Q3與Q4。在内部’於每 =Qi遞增程式計數器㈣,且使用Q4從程式記憶體擁取指 ?亚將其鎖存於指令暫存11中。在後續的Q1師期間解碍 並執=指令。在㈣間完成PLA解碼。在以師週期期 間’從記憶體或周邊元件讀取運算元並且ALU執行計算。 間’將結果寫人目的地位置。圖8說明時脈與指令執 行流。In ㈣5, except for any program branch, the program is executed in a single cycle; the y program is divided into W cycles, because "tear" is "cleared" from the pipeline, and new instructions are fetched and then executed. Fetching takes one instruction cycle, while station 1 t ^ and decoding and execution consumes another instruction J. However, due to pipeline operations, ground is performed. If an instruction: "is available in the-cycle ... to change the number of blades (such as _, it takes an extra cycle to complete ^ L (Figure 5). The instruction is retrieved from the program counter at Qlt is incremented. The fetch is also executed during the execution cycle. The instruction fetched in cycle 01 is latched into the "sniffing" (IR). Then, as in 96779.doc -10- 200530920 Q3 cycle This instruction is decoded and executed during the period. Read (calculate and write (destination write) data memory during Q2. Figure 5 ', "is not used for the operation of the secondary pipeline of the instruction sequence. At time TCY0, the traditional memory gymnastics fetches the first instruction. During Ding Yi, execute the first instruction to fetch the second instruction. During TCY2 'execute the second instruction and fetch the second instruction. During TCY3, fetch the fourth The instruction executes the third instruction (CALL SUB_1) at the same time. When the third instruction finishes executing, the address of the instruction four is forced into the heap g 'and then the program counter (pc) is changed to the address of the crime B ". This means that the pipeline needs to be removed "Clear" instructions during TCY3. During TCY4 ' Divide instruction four (executed as -Qing) and extract the instruction at address SUBJ. Finally, during Mach 5, execute instruction five and fetch the instruction at address SUB-1 + 1. Although the microcontroller of the prior art is useful , But can not simulate various modules. Moreover, the microcontroller type shown in Figure 1 cannot linearize the address space. Finally, the microcontrollers of the first 4 technologies are susceptible to compiler error problems. The need is A device, method and system for a microcontroller, which can linearize the address space in order to achieve modular simulation. There is also a need in the art to reduce compiler errors. [Summary of the Invention] The present invention provides a microcomputer Controller instruction set to overcome the above problems and other defects and shortcomings of the prior art, the microcontroller instruction set can eliminate many compiler errors encountered in the prior art. Moreover, a device and system are provided to implement a linearity Address space, which makes modular simulation possible. The invention can directly or indirectly address its register broadcast or data memory 96779.doc -11-200530920. All special functions Register, register 0v) maps data ^ ^ program counter (PC) and work scale) instruction set, which makes it possible to use any of the present invention with an orthogonal (any operation on the line. This symmetrical nature, :: The mode is executed on any register ", so that the shout design of the present invention not only has the" special optimization situation for writing software applications, but the learning effect is too great. In addition, the system can be greatly simplified and improved. The slot register can be used in some two consecutive TΓΓ 70 instructions. This makes: the ancestor can move directly between the two registers = does not have to go through the W register, thus improving performance, It also reduces the use of memory of program 3. The preferred embodiment of the present invention includes an ALU / W register, a PLA 8-bit multiplier, and a program counter (ρ with stacking). ), A table latch / table index, —ROM latch / ir latch $, fsr, interrupt directional circuit, and the most common status register. Different from the prior art, the design of the present invention does not need—the timer in a separate module, all the reset generating circuits (Nadine, Cancel, Tender, etc.), + break flag, actuation flag, CON register , RC⑽ register, configuration bit, device⑴ character, ID position and clock driver. Those skilled in the art will appreciate additional specific embodiments after referring to the detailed description and drawings. [Embodiment] The present invention is a device, method, and system for providing a microcontroller instruction set and a microcontroller architecture in several specific embodiments. The microcontroller architecture includes a linearized address space. It can realize modular simulation. 96779.doc -12- 200530920 The device architecture of the preferred embodiment of the present invention modifies the Harvard architecture of the prior art with a four-phase internal clock scheme so that the data path is 8 bits and the instruction length is 16 bits. Moreover, the preferred embodiment has a linearized memory addressing scheme, which eliminates the need for paging and fetching. This month. The hidden addressing scheme allows program memory addressing capabilities up to bytes. The invention also supports the simulation of modules. The present invention overcomes the above problems and other shortcomings and deficiencies of the prior art by providing a microcontroller instruction set, which can eliminate many compiler errors encountered in the prior art. Moreover, a device and system are provided to implement a linearized address space, which makes modular simulation possible. The invention can directly or indirectly address its register file or data memory. All special function registers, including program counter (pc) and work register (W), are mapped in the data memory. The present invention has an orthogonal (symmetric) instruction set that enables any operation to be performed on any register using any addressing mode. This symmetrical nature, coupled with the absence of a "special best case", makes the programming of the present invention simple and efficient. In addition, the learning curve can be greatly simplified. One of a series of architectural improvements of the present invention over the prior art 'allows two file registers to be used in certain binary operand instructions. This allows data to be moved directly between the two registers without having to pass through the W register ', thus improving performance and reducing program memory usage. FIG. 6 shows a block diagram of the microcontroller core of the present invention. Figure 6 illustrates the microcontroller core of the present invention. According to common practice, the connection signal line in FIG. 6 may include a slash, and the number next to the slash indicates the bandwidth (in bits) of the (旒 line. Referring to the upper right corner of Figure 6, there is a data 96779.doc • 13-200530920 memory 104, which is used to store data and transmit data to a central processing unit (described below) and transmit data from the central processing unit. The data memory purchase is made up of ― plural residual locations. In a preferred embodiment of the present invention, the lean memory 104 is a linearized 4K memory, which is divided into a plurality of sections, each of which has sixteen pages or repositories. Typically, each repository has 256 address locations. In the preferred embodiment, one of the plurality of storage orders is dedicated to general purpose and special purpose registers, in this case the highest storage level, namely storage level 0. A selection circuit 108 is coupled to the data memory H via an address latch 102. The selection circuit is used to select one of a plurality of sources for supplying a bank address value to the data memory 104. The preferred embodiment of the present invention includes an ALUU0 and a working (w) temporary storage σσ 136, a PLA, an 8-bit multiplier; a program counter (pc) 168 and a heap: £ 170,-table latch 124; table index 148; — ROM latch 152 and IR latch 126 FSH120, 121, 122; interrupt orientation circuit and the most common status register. Different from the prior art, the design of the present invention requires not only a timer in a separate module, all reset generating circuits (WDT, POR, BOR, etc.), interrupt flags, activation flags, intc 〇n register, RCON register, configuration bit, device ID character, ID position and clock driver. I / O list: A large list of input / output (I / O) commands can be obtained by using the present invention, and the I / O list is shown in Table i. 96779.doc • 14- 200530920 Table 1 I / O List Name Count I / O Normal Operation Operation Test Module Program Module Simulation Module addr < 21: 0 > 22/0 Program Memory Address nqbank < 3: 0 > 4 / 0 Active low RAM bank selection d &15; 15: 0 > 16/1 program memory data db < 7: 0 > 8/1/0 data bus forcext 1/1 forced external command test mode irp < 7: 0 > 8/0 peripheral address irp9 I / O instruction register bit 9 ncodeprt 1/1 active low code protection neprtim 1/1 active low EPROM write end nhalt 1/1 active low pause nintake 1/1 active low interrupt confirmation Wake up early and from sleep np < 7: 0 > 8/0 Table latch data npcmux I / O activity low PC multiplexing npchold I / O activity low PC hold nprtchg 1/1 activity low port change interrupt nq4clrwdt I / O Active low clear wdt nq4sleep I / O Active low sleep nqrd I / O Active low read file nreset 1/1 Active low reset nwrf I / O Active low write file ql: q4 4/1 4-phase Q clock ql3 1 / 1 Q clock combination q23 1/1 Q Pulse combination q41 1/1 Q clock combination testO 1/1 Test mode 0 tsthvdet 1/1 High voltage detection wreprom I / O Stomach eprom writem I / O write to memory wrtbl I / O table write command nintakd 1/1 interrupt confirmation delay intak 1/1 interrupt confirmation 96779.doc -15- 200530920 The clock scheme / instruction cycle is shown in Figure 7. The clock input (from 0scl) is divided into four internally to generate Non-overlapping quadruple clocks, namely Q2 Q2, Q3 and Q4. Internally, the program counter 递增 is incremented every = Qi, and Q4 is used to fetch the instruction from the program memory? Asia latches it into the instruction temporary storage 11. Remove obstacles and follow = instructions during subsequent Q1 divisions. PLA decoding is done in between. During the master cycle ', operands are read from memory or peripheral elements and the ALU performs calculations. Time ’will write the result to the destination location. Figure 8 illustrates the clock and instruction execution flow.
Q週期活動 如圖7所示,每個指令週期(TCY)係由四個Q週期㈧丨至 Q )成A Q週期係與裝置振盪器週期(T〇sc)相同。 ==個指令週期解碼、讀取、處理資料、寫入等的時 έ :疋下圖(圖7)顯示Q週期與指令週期的關係。可將 組成—執行指令週期(TCY)的四個Q週期-般化為:Q cycle activity As shown in FIG. 7, each instruction cycle (TCY) is composed of four Q cycles (from Q to Q) into A. The Q cycle is the same as the device oscillator cycle (Tsc). == Decode, read, process data, write, etc. of the instruction cycle: 疋 The following figure (Figure 7) shows the relationship between the Q cycle and the instruction cycle. The four Q cycles that make up the instruction execution cycle (TCY) can be generalized into:
Q1 :指令解碼週期或強制NOP Q2 ·指令讀取週期或NOP Q3 :處理資料 4 ·指令寫入週期或N〇p 每個指令將顯示該指令的詳細Q週期操作。 指令流/管線操作 、私令週期」係由四個Q週期(Ql、Q2、(^3與卩4) 成才曰7擷取與執行係被管線化,使擷取耗用-指令週 而解碼與執行耗用另一指令週期。“,由於管線操 96779.doc -16- 200530920 每個指令在—週期中有效地執行。有四類指令流。第一類 係正吊的1子701週期管線指令。如圖9所示’此等指令將 ^用一,效週期來執行。第二類係i字元2週期管線清除指 "μ私7包括相對的分支,相對的呼叫、跳過與返回。 當一指令改變PC時,捨棄管線榻取。如圖1〇所示,此使得 該指令_兩個有效週期來執行。第三類係表格操作指 令:此等指令將暫停#|取以插人以及讀取或寫人週期至程 式記憶體。執行表格操作時賴取的指令係保…週期,並 在表格操作之後的下—週期執行,如圖u所示。第四類係 新的二字指令。此等指令包括MOVFF與M0 VLF。在此等指 二中’:令之後的擷取包含該等位址的剩餘部分。對“ 打第-字το期間的MOVFF,該機ϋ將執行該源暫存器的讀 取。在執行第二字元期間,獲得源位址,㈣該指令將= 成該移動’如圖12所示。M0VLF與此類似,不過其在2個 週期中移動2個文字值進入,如圖η所示。 第五’係CALL與GOTO的二字指令。在此等指令中,^ 之後的擷取包含跳轉或呼叫目的地位址的剩餘部分。二 情況下’ Λ等指令將需要3個週期來執行,其中以固用於操 取該等2指令字元,另外〖個用於隨後的管線清除。然而, 藉由在第二次擷取時提供一高速路徑,可在指令執行的第 -週期中以完整的值來更新PC,從而得到一 2週期指令,如 圖14所示。第六,係、中斷辨識執行。在下面的中斷部分中 論述中斷期間的指令週期。 96779.doc -17- 200530920Q1: Instruction decode cycle or forced NOP Q2 • Instruction read cycle or NOP Q3: Processing data 4 • Instruction write cycle or Nop Each instruction will show the detailed Q cycle operation of the instruction. The instruction flow / pipeline operation, private order cycle "is composed of four Q cycles (Ql, Q2, (^ 3, and 卩 4). The fetch and execution system is pipelined, so that fetch consumes-instruction cycle to decode It takes another instruction cycle to execute. "Because the pipeline operates 96779.doc -16- 200530920, each instruction is effectively executed in a cycle. There are four types of instruction flows. The first type is a 1-child 701 cycle pipeline that is being suspended. Instructions. As shown in Figure 9, 'these instructions will be executed with a one-cycle effect. The second type is the i-character 2-cycle pipeline clearing instructions.' Μ 私 7 includes relative branches, relative calls, skips and Back. When an instruction changes the PC, the pipeline is discarded. As shown in Figure 10, this makes the instruction _ two valid cycles to execute. The third type is a table operation instruction: these instructions will be suspended # | Insert and read or write cycles to program memory. The instructions relied upon when performing table operations are guaranteed ... cycles, and are executed in the next cycle after the table operations, as shown in Figure u. The fourth type is new Two-word instructions. These instructions include MOVFF and M0 VLF. In these two, ': Take the remainder containing these addresses. For the MOVFF during the "hit-word το", the machine will perform a read of the source register. During the execution of the second character, the source address is obtained, and the The instruction will = become this move 'as shown in Figure 12. M0VLF is similar, but it moves two text values in two cycles to enter, as shown in Figure η. The fifth' is a two-word instruction of CALL and GOTO. In these instructions, the fetch after ^ contains the remainder of the jump or call destination address. In the second case, the instructions such as Λ will take 3 cycles to execute, and the instructions are used to fetch these 2 instruction characters. In addition, one is used for subsequent pipeline clearing. However, by providing a high-speed path during the second fetch, the PC can be updated with a complete value in the first cycle of instruction execution, thereby obtaining a 2-cycle instruction , As shown in Figure 14. Sixth, system, interrupt identification execution. The instruction cycle during the interrupt is discussed in the interrupt section below. 96779.doc -17- 200530920
ALU 本發明包含一 8位元算術與邏輯單元(ALU) 142與工作暫 存器136,如圖6所示。ALU 142係一通用算術單元。其執行 工作暫存器中之資料與任何暫存器檔案之間的算術與布爾 函數。ALU 142係8位元寬,並能夠執行加法、減法、移位 與邏輯運算。除非另外提及,否則算術運算係二的補數性 質。工作(W)暫存器136係一用於ALU 140操作之8位元工作 暫存器。W暫存器136係可定址的,並且可直接寫入或讀 取。ALU 140能夠對兩個運算元或單個運算元執行算術或邏 輯運算。所有的單運算元指令在W暫存器136或既定檔案暫 存器上操作。對於兩個運算元的指令,其中一個運算元係 W暫存器136,而另一個係一檔案暫存器或一 8位元立即常 數,或一等效的儲存媒體。 根據所執行的指令,ALU 140可影響STATUS暫存器(下 述)中進位(C)、數位進位(DC)、零(Z)、上溢(OV)與負(N) 位元之值。C與DC位元係在減法中分別用作一借位與數位 借出位元。 本發明之較佳具體實施例包括一 8x8硬體乘法器134,其 係包括於如圖6所示之裝置的ALU 142中。藉由使乘法成為 一硬體運算,該操作可在單個指令週期中完成。此硬體運 算係給出一 1 6位元結果之無符號的乘法。將該結果儲存進 16位元乘積暫存器(PRODHiPRODL)。乘法器不會影響 STATUS暫存器中的任何旗標。 狀態暫存器 96779.doc -18- 200530920 ,侧暫存器包含ALU 14〇之狀態位元。圖i5中顯示狀 悲暫存&。在本發明之較佳具體實施财,位元Μ未予實 施,並且係作為,0’讀取。 位兀4係N」’即負位疋。此位元係用於有符號的算術(2 的補數)。其指示該結果是否為負,(ALUMSbO, 1 =結果 為負,0=結果為正。 位TC3係〇V」±溢位元。此位元係用於有符號的算術 (2的補數)。其指示7位元大小之上溢,使符號位元(位元7) 改變㈣。對於此位元’卜有符號算術發生上溢,(在此算 術運算中),並且〇=無上溢發生。 位元2係z」零位元。對於此位元,卜算術或邏輯運算 的結果為零,並且0=算術或邏輯運算的結果非零。 位元1係「DC」數位進位/借位位元。對於此位元,卜該 π果恤序位元發生進位輸出’並且該結果的第视 序位7L不發生進位輸出。應注意,對於借位,可使極性反 轉。 位元0係「C」進位/借位位元。對於此位元,1=該結果的 最高有效位元發生進位輸出,並且0=該結果的最高有效位 元不發生進位輸出。與位元丨一樣,對於借位,可使極性反 轉。 C與DC位元係減法中分別用作一借位與數位借位位元。 進位係ALU位元7進位輸出。數位進位係ALU位元3進位輸 出。如果ALU結果位元<7:〇>為,〇,,則零位元為真。 結果位元7。如果2的補數結果超過+ 127或小於_128,則將 96779.doc -19- 200530920 設定上溢位元。上溢係ALU位元6進位輸出與ALU位元7進 位輸出之XOR運算。與所有其他暫存器一樣,STATUS暫存 器可為任何指令的目的地。如果STATUS暫存器係影響任一 狀態位元之指令的寫入目的地,則停用對狀態位元的寫 入。根據ALU結果與指令規格來設定或清除該等位元。因 此,將STATUS暫存器作為目的地之指令的結果可能與預期 不符。 例如,CLRF REG指令一般將該暫存器寫入至〇,並設定Z 位元。CLRF STATUS指令將停用對N、OV、DC與C位元的 寫入,並設定Z位元。此使得STATUS暫存器變為〇〇〇u uluu。因此,推薦僅使用BCF、BSF、SWAPF與MOVWF指 令來改變STATUS暫存器,因為此等指令不會影響任何狀態 位元。若要瞭解其他指令如何影響該等狀態位元,請參閱 「指令集概述」。 程式計數器模組 修改該程式計數器(PC)168(參閱圖6),以允許擴展至最大 21位元。此係藉由添加一 5位元寬PCLATU暫存器而完成, 該暫存器之操作係類似於PCLATH暫存器。亦修改pc 168 來定址程式記憶體中之位元組而非字。若要實施此舉,PC 168之LSb處需有一位元組定址位元始終為〇。pcl的LSb位 元係可讀取的,但不可寫入。如果使用者試圖將,丨,寫入 LSb ’則結果將為’0,。若要允許隱藏測試EPROM,則PC 168 需有一隱藏的第22位元(位元21)(參閱圖16)。此PC位元在正 常情況下為0。當進入測試模式或程式設計模式時,設定此 96779.doc -20- 200530920 位元,並且將從測試區域擷取該等指令。一旦設定此位元, 則其無法藉由執行程式而清除,必須重設裝置。 程式計數器(PC) 168最大達如圖16所示的一 21位元暫存 器。將PCL 184,即PC 168的低位元組,映射進資料記憶體 104中(參閱圖6)。PCL 184係可讀取以及可寫入的,正如任 何其他暫存器一樣。PCH 182與PCU 180係PC的高位元組, 並且不可直接定址。因為未將PCH 182與PCU 184映射進資 料或程式記憶體160中,故將暫存器PCLATH 178 (PC高鎖 存器)及PCLATU 176 (PC上部鎖存器)用作PC 168之高位元 組之保持鎖存器。 將PCLATH 178與PCLATU 176映射進資料記憶體104 〇使 用者可經由PCLATH 178讀取及寫入PCH 182,並經由 PCLATU 176讀取及寫入PCU 180。每次於Q1期間擷取指令 之後,將PC 168的字遞增2,除非: •藉由一 GOTO、CALL、RETURN、RETLW、RETFIE 或 Branch指令修改。 •藉由中斷回應修改。 •由於一指令對PCL 168的目的地寫入。 「跳過」等效於被跳過位址處之一強制NOP週期。圖16 與17顯示各種情況之程式計數器之操作。 參考圖16,不同指令之PC 168、PCLATH 178與PCLATU 176的操作如下: a·關於PCL的讀取指令: 對於讀取PCL 184的任何指令。d=0的所有位元組指令; 96779.doc -21 - 200530920 MOVFF PCL? X ; CPFSEQ ; CPFSGT ; CPFSLT ; MULWF ; TSTFSZ然後PCL至資料匯流排然後至ALU或至目的地。最 後,PCH至 PCLATH與 PCU至 PCLATU。 b·關於PCL的寫入指令: 寫入PCL 184的任何指令。例如,MOVWF ; CLRF ; SETF, 然後寫入8位元資料至資料匯流排174,然後至PCL 184。還 有,PCLATH至 PCH與 PCLATU至 PCU。 c. 關於PCL的讀取-修改-寫入指令: 對PCL進行讀取-寫入-修改操作的任何指令。d=l的所有 位元組指令;位元指令;NEGF。讀取:PCL至資料匯流排 至ALU。寫入:將8位元結果寫入至資料匯流排以及至PCL, 然後 PCLATH至 PCH;最後 PCLATU至 PCU。 讀取-修改-寫入僅以結果影響PCL 184。分別將PCLATH 178與PCLATU 176中的值載入PCH 182與PCU 180 〇例如, 對於指令「ADDWF」,PCL 184將導致以下跳轉。如果在指 令之前,PC = 0003FOh、W = 30h、PCLATH = 05h及PCLATU =lh,則在指令之後PC = 010520h。為了完成一真實的20 位元計算跳轉,使用者需要計算20位元目的地位址,寫入 PCLATH 178 與 PCLATU 176,然後將低值寫入PCL 168。 d. RETURN指令: 使用圖17將<MRU>堆疊至PC<20:0>,GOTO與CALL指令 之 PC 168、PCLATH 178 與 PCLATU 176 之操作如下: e. CALL、GOTO指令: 在2字指令(操作碼)中提供一目的地位址。第一字操作碼 96779.doc -22- 200530920 <6:0〉至PCL<7:1>。第一字操作碼<7>至pcLATH<0〉以及至 PCH<0>。第二字操作碼 <6:〇> 至 PCLATH<7:1> 以及 PCH <7:1〉。第二字操作碼 <11:7> 至 PCLaTU<4:0> 以及 PCU <4:0> 〇 應注意,以下與PC 168有關的操作不會改變PCLATH 178 與PCLATU 176 : a. RETLW、RETURN與 RETFIE指令。 b·將中斷向量強制到PC上。 c·關於PCL的讀取-修改-寫入指令(例如BSF PCL,2)。 返回堆疊操作 本發明具有一 31層深的返回(或硬體)堆疊。堆疊的深度 相對於先前技術有所增加,以便允許更複雜的程式。該堆 疊非為程式或資料記憶體空間的一部分。 當執行一 CALL或RC ALL指令或確認一中斷時,將PC 168 推到堆疊上。當執行RETURN、RETLW或RETFIE指令時, 從該堆疊拉出PC 168值。PCLATU 176與PCLATH 178不受 任何返回指令的影響。 該堆疊用作一31字元x21位元RAM與一 5位元堆疊指標, 並且在所有重設之後將堆疊指標初始化為〇〇〇〇〇b。不存在 與堆疊指標000h相關聯的RAM字。此僅係一重設值。一 CALL型指令引起向該堆疊推入期間,首先使堆叠指標遞 增,並且在該堆疊指標所指向的RAM位置寫入PC的内容。 一 RETURN型指令引起從該堆疊取出期間,將STKPTR所指 向的RAM位置的内容轉移至PC,然後使堆疊指標遞減。 96779.doc -23- 200530920 堆疊頂部存取 堆疊的頂部係可讀取及可寫入的。三個暫存器位置 TOSU、TOSH與TOSL定址STKPTR所指向的堆疊RAM位 置。此允許使用者在必要時實施一軟體堆疊。在一 CALL或 RCALL指令或一中斷之後,該軟體可藉由讀取TOSU、TOSH 與TOSL暫存器而讀取被推入的值。可將此等值放置於一使 用者定義的軟體堆疊上。在返回時,軟體可替換T0SU、 TOSH與TOSL並進行一返回。應注意,在此時間期間,使 用者必須停用全域中斷致動位元,以防止無意中執行堆疊 操作。 PUSH與POP指令 因為堆疊頂部(T0S)係可讀取及可寫入的,故在不干擾正 常程式執行的情況下將值推到堆疊上以及從堆疊上拉出值 的能力係一理想的選擇。為了將目前的PC值推到堆疊上, 可執行一 PUSH指令。此舉將目前的PC值推到該堆疊上;設 定TOS = PC與PC = PC + 2。在不干擾正常執行的情況下, 從該堆疊拉出T0S值並使用先前被推到該堆疊上的值將其 替換的能力,係藉由使用POP指令來達成。POP指令從該堆 疊拉出TOS值,但此值未寫入PC ;推到該堆疊上的先前值 則變為TOS值。 返回堆疊指標(STKPTR) STKPTR暫存器包含返回堆疊指標值與上溢及下溢位 元。堆疊上溢位元(STK0VF)與下溢位元(STKUNF)允許使 用軟體驗證堆疊條件。僅在重設POR之後清除STKOVF與 96779.doc •24- 200530920 STKUNF位元。 在將PC推到該堆疊上3 1次之後(未從該堆疊上拉出任何 值),第32次推入覆寫來自第31次推入的值,並設定 STK-OVF位元,而STKPTR則保持於11111b。第33次推入覆 寫第32次推入(依此類推),而3!^?丁11保持於111111)。 在對堆疊進行足夠多次取出以卸載該堆疊之後,下一次 取出將向PC返回零值,並且設定STKUNF位元,同時使 STKPTR保持於00000b。下一次取出再次返回零(依此類推) 同時使STKPTR保持於00000b。應注意,在下溢的情況下將 一零返回至PC具有使該程式定向於重設向量的效果,其中 可驗證堆疊條件並採取適當的動作。 可經由STKPTR暫存器來存取堆疊指標。使用者可讀取與 寫入堆疊指標值。RTOS可使用此值進行返回堆疊維護。圖 18顯示STKPTR暫存器。堆疊指標的值將為〇至31。重設時, 該堆疊指標值將為0。推入時,該堆疊指標將遞增,而取出 時則遞減。 堆疊上溢/下溢重設 按照使用者的選擇,上溢與下溢可使一裝置重設中斷程 式碼。使用一組態位元STVRE來致動該重設。當停用STVRE 位元時,上溢或下溢將設定適當的STKOVF或STKUNF位元 而不引起重設。當致動STVRE位元時’上溢或下溢將設定 適當的STKOVF或STKUNF位元,然後使一裝置重設的性質 非常類似於WDT重設。在任一情況下,不清除STK0VF或 STKUNF位元,除非使用者軟體或P〇R重設將其清除。圖18 96779.doc -25- 200530920 至21說明堆疊暫存器。圖。至以說明堆疊操作。 程式記憶鱧 本發明之較佳具體實施例具有最高達2百萬位元組 (2Μ)χ8使用者程式記憶體空間。該程式記憶體空間主要係 要包含用於執行的指令ϋ可使用表格讀取與寫入指 令來儲存與存取資料表格。有另—胁8測試㈣記憶體空 間用於測試ROM、組態位元與識別字元。 該裝置具有最高達21位元之程式計數器,其能夠定址 2MX8程式記憶體空間。還有—第22 %位元,在正常操作 期間’其係隱藏的’並且當其被設料,可存取組態位元、 裝置ID與職R〇M。可在測試模式或程式設計模式中設定 此位元,並且必須重設該裝置才能清除此位元。使用此位 元設定無法存取使用者程式記憶體空間。因為pc必須存取 程式記憶體中-偶數位S組邊界上的指令,故pc的Lsb係 一默示的,0,,並且對於每—指令,pc遞增二。 該重設向量係000000h,並且該高優先權中斷向量係 000008h,並且低優先權中斷向量係〇〇〇〇i8h(參閱圖3〇)。 程式記憶體組織 程式記憶體中的每個位置具有一位元組位址。此外,每2 個鄰近位元組具有-字位址。圖31顯示具有所示位元組與 2位址之程式記憶體之映射。在程式記憶體内,必須使該 等指令的字對齊。圖32顯#具有數個範例性指令之程式記 憶體之映射以及置於該映射中針對該等指令之十六進制 碼。表格操作將與位元組實體—起工作。表格區塊不必字 96779.doc -26- 200530920 對齊’故表格區塊可在任何位元組位址開始與結束。此點 的例外係’使用表格寫入來程式化内部程式記憶體或外: :元寬快閃記憶體的情況。當程式化時,可能需要將寫二 貝料與程式化方法所用的字元寬度對齊。 程式記憶體模式 本發明可以五種可㈣程式記㈣㈣之—來操作 由組態位元來選擇該組態。可能的模式為·· 曰 • MP-微處理器 • EMC-擴充微控器 • PEMC-受保護擴充微控器 • MC-微控器 • PMC-受保護微控器 微控器與受保護微控器模式僅允許㈣執行。在該程式 =憶體之外的任何存取均讀取所有的零。受保護的微控器 模式亦致動碼保護特徵。微控器係—未程式化裝置的預設 模式。 擴充微控器模式存取内部程式記憶體與外部程式記憶 體。執行在内部與外部記憶體之間自動地切換。該21位元 之位址允許2M位元組的程式記憶體範圍。受保護擴充微控 器模式將藉由防止對内部記憶體的表格讀取/寫人同時仍 允々執仃與表格讀取/寫人外部程式記憶體而對内部程式 記憶體進行碼保護。 該微處理器模式僅存取外部程式記憶體。忽略該晶片上 式°己隐體違21位元之位址允許⑽位元組的程式記憶體 96779.doc -27- 200530920 範圍。 在裝置的正常操作期間,藉由使用TBLRD指令,可讀取 測試記憶體與組態位元。如果RCON暫存器中的LWRT位元 被設定或者裝置處於測試與程式設計模式,則僅可使用 TBLWT指令來修改此等區域。 在測試與程式設計模式中才能從此等區域執行。 僅在具有被定義為I/O接針之部分的外部記憶體匯流排 之裝置上才能使用擴充微控器模式與微處理器模式。表2 列出了哪些模式可存取内部與外部記憶體。圖33說明不同 程式模式中的裝置記憶體映射。 圖2裝置模式記憶體存取 操作模式 内部程式記憶體 外部程式記憶體 微處理器 無存取 執行/TBLRD/TBLWT 擴充微控器 執行/TBLRD/TBLWT 執行/TBLRD/TBLWT 文保護擴充微控器 口只 " " ------— 執行 執行/TBLRD/TBLWT AfUf 口口 — ^t/TBLRD/TBLWT 無存取 文保護微控器 SJatblrd 無存取 外部程式記憶體介面 田I擇U處理器或擴充微控器模式時,最多將四個埠組 二為系、洗匯机排。兩個埠及第三個埠的一部分係多工位址/ 資料匯流排,而另认 ^ 力外一個埠的一部分係用於控制信號。需 要外部組件央紐夕 鮮夕工位址與資料。外部記憶體介面可在8 位70貝料;^式或16位元資料模式中運行。外部記憶體介面 上的位址總係位元組位址。 圖36與37分別說明16位元與8位元資料的外部記憶體連 96779.doc 200530920 接。外部程式記憶體匯流排共享接針上的1/〇埠功能。圖38 列出了I/O接針功能上外部匯流排功能之典型映射。在擴充 微控器模式中,當該裝置係在内部記憶體之外執行時,該 等控制彳§號將不活動。其將進入一狀態,其中1 $、 八<19:〇>係三態; UBA0 與 ALE係「〇」。 16位元外部介面 如果外部介面係16位元,則將作為16位元字元擷取該等 ^ 4 〇E輸出致動信號將一次致動兩種類型的程式記憶 體乂輸出16位元子元。無需將該位址的最低有效位元 ΒΑ0連接至記憶體裝置。 一外部表格讀取邏輯上係一次執行一位元組,儘管該記 憶體將從外部讀取一 16位元字元。該位置的最低有效位元 將在内部於高與低位元組(LSb=〇至較低位元組,Lsb=丨至較 咼位組)之間進行選擇。微處理器與擴充微控器模式中的 外4位址係21位元寬;此允許定址最高達2M位元組。 一 16位元匯流排上的一外部表格寫入邏輯上係一次執行 一位7L組。實際的寫入將取決於所連接之外部裝置的類型 與MEMCON暫存器中的WM<1:0>位元,如圖34所示。表 格操作部分詳細說明實際的寫入週期。 8位元外部介面 如果外部介面係8位元,則將作為2個8位元之位元組擷取 4等扣令。在一指令週期内擷取兩個位元組。無需將該位 址的最低有效位元連接至記憶體裝置。0E輸出致動信號與 96779.doc -29- 200530920 BA^ 1將在该週期之q3部分致動從程式記憶體讀取該指令 的最高有效位元組,然後在該週期之Q4部分,βΑ〇將變為 0,亚將讀取最低有效位元組,以形成16位元指令字元。 /外邛表格碩取亦係一次執行一位元組。一外部表格寫 入係夂執行一位元組。在每次外部寫入時,WRL係活動 的。 當選擇8位元介面時,不使用WRH、118與1;1^線路,並且 妾、十返回到I/O埠功能。一組態位元選擇外部介面的8位元 模式。 外部等待週期 。亥外邛σ己憶體介面支援等待週期。該外部記憶體等待週 期僅適用於透過該外部匯流排之表格讀取與表格寫入操 作。因為裝置之執行係與指令擷取聯繫在一起,故執行速 率比操取速率快係沒有意義的。因此,如果需要使程式擷 取放慢,則必須使該處理器速度以一不同的TCY時間放慢。 MEMCON暫存器中的·τ <1:〇>位元將在每個記^體 擷取週期選擇〇、丨、2或3個額外的TCY週期。對於一 16位 70介面上的表格讀取與寫入,該等等待週期將係有效的。 在8位元"面上,對於表格讀取與寫入,該等待僅將發生 於Q4上。 上電時等待之預設設定係要確定最大3個TCY週期的等 待。此可確保慢速的記憶體可在重設之後立即在微處理器 模式中工作。一組態位元,稱為WAIT,將致動或停用等待 狀恶。圖39說明16位元介面,而圖4〇說明8位元,在兩種情 96779.doc -30- 200530920 形下皆顯示不具有等待之程式記憶體指令擷取以及具有等 待狀態之表格讀取。 外部匯流排信號停用 為了靈活地利用提交給外部匯流排的接針,在組態位元 中提供數個停用。為了停用整個外部匯流排,正如在擴充 微控器模式中時可能進行的那樣,以及允許一 DMA功能, 如圖35所示在MEM-CON暫存器中組態EBDIS位元。此停用 將允許對整個外部匯流排介面進行三態處理。此將允許 DMA操作以及透過I/O接針功能藉由程式控制來直接控制 外部裝置。 在模擬器系統中,-ME裝置必須具有用於表示匯流排停 用組態位元的輸入,以使I/O埠功能可偵測到作為外部介面 之接針的狀態。-ME裝置亦具有一特殊輸入接針,其指示 該模擬器系統是否係處於微處理器或擴充微控器模式。 資料記憶體 在本發明中,可將資料記憶體與通用RAM尺寸擴充至 4096位元組。資料記憶體位址係12位元寬。將該資料記憶 體分割成16個儲存庫,每個儲存庫有256位元組,該等儲存 庫包含通用暫存器(GPR)與特殊功能暫存器(SFR)。 將GPR機械化為一位元組寬RAM陣列,尺寸相當於組合 的GPR暫存器。通常在SFR控制其功能的周邊元件之間分配 SFR 〇 藉由儲存庫選擇暫存器(BSR<3:0>)來選擇儲存庫。BSR 暫存器可能存取16個以上的儲存庫,然而直接長定址模式 96779.doc -31 - 200530920 係限於12位元位址或16個儲存庫。BSR受到相應限制。 憶 體映射 裝置指令可在一指令週期中讀取、修改並寫入一特定位 置。每個週期僅產纟一位址,&不可能在單個週期中讀取 一位置並修改/寫入另一位置。圖42說明一範例性資料記 通用暫存器 在所有PIC裝置中,所有的資料RAM皆被所有指令用作暫 存器。大多數資料記憶體儲存庫僅包含GPR記憶體。所有 1置的儲存庫〇上必須包括有GPR記憶體。 儲存庫〇中的GPR數目之絕對最小值係128。此GpR區域, 稱為存取RAM,係必要的,以使程式師可具有不論咖設 定如何皆可存取的資料結構。 特殊功能暫存器 SFR係特殊暫存器,通常用於裝置與周邊控制及狀態功 能。所有指令皆可存取此等暫存器。如有可能,儲存庫b 之上部128位元組中應包含所有的SFR。如果SFR不使用_ 特定裝置上所有可用的位置,則不實施未使用的位置,並 且將其讀取為,0,。某些裝置,例如LCD控制器可在除儲存 庫15之外的其他儲存庫中具有SIR區域。 儲存庫15中SFR之邊界可因裝置不同而進行修改。存取 儲存庫中必須包括至少16個GPR。圖43顯示一可能的特殊 功旎暫存器映射。圖44與45顯示核心特殊功能暫存器之概 述。 定址模式 96779.doc •32- 200530920 本發明支援7個資料定址模式: •固有 •文字 •直接短 •直接強制 •直接長 •間接 •索引間接偏移 其申三個模式,即直接強制、直接長與間接索引係PIC 架構的新模式。 固有 對於某些指令,例如DAW,除操作碼中所明確定義的定 址之外,不需要其他定址。 文字 文字指令包含一文字常數攔位,通常用於一數學運算, 例如ADDLW。文字定址亦用於GOTO、CALL與分支操作碼。 直接短 大多數數學與移動指令在直接短定址模式中操作。在此 定址模式中,該指令包含該資料之最低有效位址之八個位 元。位址的其餘四個位元係來自儲存庫選擇暫存器或 BSR。BSR係用於在資料記憶體區域中的各儲存庫之間切換 (參見圖47)。 對大容量通用記憶體空間的需要指示了 一通用RAM分庫 方案。BSR的下半位元組選擇目前活動的通用RAM儲存 96779.doc -33- 200530920 庫。為協助此操作 指令。 在才曰令集中已提供了一 m〇Vlb儲存庫 敌果不Λ施目前選定的儲存庫(例如儲存庫13),任何讀 取將碩取所有丨〇丨。士一 況來A f π㈣任何寫人,並且根據情 况末叹疋、除STATUS暫存器位元。 直接強制 字斤有的特殊功能暫存器(sfr)映射進資料記憶體空間 為/方便地存取SFR,-般將其全部映射進儲存庫15。 為了間化存取’指令中有一元攔位,其將位址指向通用 RAM之儲存庫〇之下半部分以及淑之儲存庫此上半部 分,而不論BSR的内容為何。將職設定為·=η,於是, 可以任何指令定址3個儲存庫,即直接強制模式中的儲存庫 〇與15以及直接短模式中的儲存庫「n」。 直接長 直接長定址將資料位址的全部十二個位元編碼進該指 令。唯有MOVFF指令才使用此模式。 '日 間接定址 間接定址係定址資料記憶體的一種模式,其中藉由另— 暫存器來決定該指令中的資料記憶體位址。這對於資料圮 憶體中的資料表格或堆疊可能係有用的。圖53顯示間接定 址之操作。FSR暫存器的值係用作資料記憶體位址。 間接定址暫存器 本發明具有三個12位元暫存器用於間接定址。此等暫存ALU The present invention includes an 8-bit arithmetic and logic unit (ALU) 142 and a work register 136, as shown in FIG. ALU 142 is a general arithmetic unit. It performs arithmetic and Boolean functions between the data in the register and any register files. The ALU 142 is 8 bits wide and is capable of performing addition, subtraction, shift, and logical operations. Unless otherwise mentioned, arithmetic operations are two's complement nature. The work (W) register 136 is an 8-bit work register for ALU 140 operation. The W register 136 is addressable and can be directly written or read. The ALU 140 is capable of performing arithmetic or logical operations on two operands or a single operand. All single operation meta instructions operate on the W register 136 or the predetermined file register. For the instructions of two operands, one of them is W register 136, and the other is a file register or an 8-bit immediate constant, or an equivalent storage medium. Depending on the instruction executed, ALU 140 can affect the values of Carry (C), Digital Carry (DC), Zero (Z), Overflow (OV), and Negative (N) bits in the STATUS register (described below). The C and DC bits are used as a borrow and a digital borrow bit respectively in subtraction. A preferred embodiment of the present invention includes an 8x8 hardware multiplier 134, which is included in the ALU 142 of the apparatus shown in FIG. By making multiplication a hardware operation, the operation can be completed in a single instruction cycle. This hardware operation gives an unsigned multiplication of a 16-bit result. The result is stored in a 16-bit product register (PRODHiPRODL). The multiplier does not affect any flags in the STATUS register. Status register 96779.doc -18- 200530920, the side register contains the status bit of ALU 14〇. Figure i5 shows the state of temporary storage & In the preferred embodiment of the present invention, bit M is not implemented and is read as 0 '. Position 4 is N ″ ', which means negative position. This bit is used for signed arithmetic (2's complement). It indicates whether the result is negative, (ALUMSbO, 1 = negative result, 0 = positive result. Bit TC3 is 0V ”± overflow bit. This bit is used for signed arithmetic (2's complement) . It indicates a 7-bit size overflow that causes the sign bit (bit 7) to change ㈣. For this bit, 'signed arithmetic overflows (in this arithmetic operation), and 0 = no overflow Occurs. Bit 2 is the zero bit. For this bit, the result of the arithmetic or logical operation is zero, and 0 = the result of the arithmetic or logical operation is non-zero. Bit 1 is the "DC" digital carry / borrow Bit bit. For this bit, a carry output of the π order shirt bit occurs and no carry output of the 7th order bit of the result. It should be noted that for borrowing, the polarity can be reversed. Bit 0 is the "C" carry / borrow bit. For this bit, 1 = the most significant bit of the result has a carry out, and 0 = the most significant bit of the result has no carry out. Same as bit 丨For borrowing, the polarity can be reversed. C and DC bits are used as a borrow and digital borrow bit respectively in subtraction. Carry is the ALU bit 7 carry output. Digital carry is the ALU bit 3 carry output. If the ALU result bit < 7: 〇 > is 0, then the zero bit is true. The result bit is 7. If 2 If the result of the complement is more than + 127 or less than _128, the overflow bit is set to 96779.doc -19- 200530920. The overflow is the XOR operation of the ALU bit 6 carry output and the ALU bit 7 carry output. Like the register, the STATUS register can be the destination of any instruction. If the STATUS register is the write destination of an instruction that affects any status bit, the write to the status bit is disabled. According to ALU The result and instruction specifications set or clear these bits. Therefore, the result of the instruction using the STATUS register as the destination may not be as expected. For example, the CLRF REG instruction generally writes this register to 0 and sets Z bit. The CLRF STATUS instruction will disable writing to the N, OV, DC, and C bits and set the Z bit. This makes the STATUS register 〇〇〇u uluu. Therefore, it is recommended to use only BCF , BSF, SWAPF and MOVWF instructions to change the STATUS register, because these instructions will not Affects any status bit. To learn how other instructions affect these status bits, see "Instruction Set Overview". The Program Counter module modifies the Program Counter (PC) 168 (see Figure 6) to allow expansion to the maximum 21 bits. This is accomplished by adding a 5-bit wide PCLATU register, which operates similarly to the PCLATH register. PC 168 is also modified to address the bits in program memory and Not a word. To implement this, there must be a byte at the LSb of PC 168. The addressing bit is always 0. The LSb bit of pcl is readable but not writable. If the user attempts to write LSb ', the result will be' 0 '. To allow the hidden test EPROM, the PC 168 needs a hidden bit 22 (bit 21) (see Figure 16). This PC bit is normally 0. When entering test mode or programming mode, set this 96779.doc -20- 200530920 bit, and retrieve these instructions from the test area. Once this bit is set, it cannot be cleared by running the program and the device must be reset. The program counter (PC) 168 is up to a 21-bit register as shown in FIG. The PCL 184, that is, the lower byte of the PC 168, is mapped into the data memory 104 (see FIG. 6). PCL 184 is readable and writable, just like any other register. PCH 182 and PCU 180 are the high byte of PC, and cannot be directly addressed. Because PCH 182 and PCU 184 are not mapped into data or program memory 160, the temporary registers PCLATH 178 (PC High Latch) and PCLATU 176 (PC Upper Latch) are used as the high byte of PC 168 It keeps the latch. PCLATH 178 and PCLATU 176 are mapped into data memory 104. Users can read and write PCH 182 via PCLATH 178 and PCU 180 via PCLATU 176. Each time the instruction is fetched during Q1, the word of PC 168 is incremented by 2 unless: • Modified by a GOTO, CALL, RETURN, RETLW, RETFIE, or Branch instruction. • Modified by interrupt response. • Write to destination of PCL 168 due to an instruction. "Skip" is equivalent to a forced NOP cycle at one of the skipped addresses. Figures 16 and 17 show the operation of the program counter in various cases. Referring to FIG. 16, the operations of the PC 168, PCLATH 178, and PCLATU 176 of the different instructions are as follows: a. Read instruction for PCL: For any instruction to read PCL 184. All byte instructions with d = 0; 96779.doc -21-200530920 MOVFF PCL? X; CPFSEQ; CPFSGT; CPFSLT; MULWF; TSTFSZ then PCL to the data bus and then to ALU or to the destination. Finally, PCH to PCLATH and PCU to PCLATU. b · PCL write instruction: Write any instruction to PCL 184. For example, MOVWF; CLRF; SETF, and then write 8-bit data to the data bus 174, and then to the PCL 184. Also, PCLATH to PCH and PCLATU to PCU. c. Read-modify-write instructions for PCL: Any instruction for read-write-modify operations on PCL. d = l all byte instructions; bit instructions; NEGF. Read: PCL to data bus to ALU. Write: Write the 8-bit result to the data bus and to PCL, then PCLATH to PCH; finally PCLATU to PCU. Read-modify-write affects PCL 184 only as a result. Load the values in PCLATH 178 and PCLATU 176 into PCH 182 and PCU 180, respectively. For example, for the instruction "ADDWF", PCL 184 will cause the following jump. If PC = 0003FOh, W = 30h, PCLATH = 05h, and PCLATU = lh before the instruction, then PC = 010520h after the instruction. In order to complete a real 20-bit calculation jump, the user needs to calculate the 20-bit destination address, write it to PCLATH 178 and PCLATU 176, and then write the low value to PCL 168. d. RETURN instruction: Use Figure 17 to stack < MRU > to PC < 20: 0 >, the operations of PC 168, PCLATH 178, and PCLATU 176 of GOTO and CALL instructions are as follows: e. CALL, GOTO instruction: In 2-word instruction (Opcode) Provide a destination address. First word opcodes 96779.doc -22- 200530920 < 6: 0> to PCL < 7: 1 >. The first word operation codes < 7 > to pcLATH < 0> and to PCH < 0 >. The second word opcodes < 6: 〇 > to PCLATH < 7: 1 > and PCH < 7: 1>. Second word opcodes < 11: 7 > to PCLaTU < 4: 0 > and PCU < 4: 0 > 〇 It should be noted that the following operations related to PC 168 will not change PCLATH 178 and PCLATU 176: a. RETLW, RETURN and RETFIE instructions. b. Force the interrupt vector to the PC. c. PCL read-modify-write instructions (eg BSF PCL, 2). Back stack operation The present invention has a 31-layer deep back (or hardware) stack. The depth of the stack is increased relative to the prior art to allow more complex programs. The stack is not part of the program or data memory space. When a CALL or RC ALL instruction is executed or an interrupt is acknowledged, the PC 168 is pushed onto the stack. When a RETURN, RETLW, or RETFIE instruction is executed, the PC 168 value is pulled from the stack. PCLATU 176 and PCLATH 178 are not affected by any return instruction. This stack is used as a 31-character x 21-bit RAM and a 5-bit stack pointer, and the stack pointer is initialized to 0000b after all resets. There is no RAM word associated with the stack index 000h. This is only a reset value. A CALL-type instruction causes the stack index to be incremented during the push into the stack, and the contents of the PC are written to the RAM location pointed to by the stack index. A RETURN instruction causes the contents of the RAM location pointed to by STKPTR to be transferred to the PC during the fetch from the stack, and then the stack index is decremented. 96779.doc -23- 200530920 Stack top access The top of the stack is readable and writable. Three register locations TOSU, TOSH, and TOSL address the stack RAM locations pointed to by STKPTR. This allows the user to implement a software stack if necessary. After a CALL or RCALL instruction or an interrupt, the software can read the pushed values by reading the TOSU, TOSH, and TOSL registers. This value can be placed on a user-defined software stack. When returning, the software can replace T0SU, TOSH and TOSL and perform a return. It should be noted that during this time, the user must disable the global interrupt actuation bit to prevent inadvertent stack operations. PUSH and POP instructions Because the top of the stack (T0S) is readable and writable, the ability to push values onto the stack and pull values from the stack without disturbing normal program execution is an ideal choice . To push the current PC value onto the stack, a PUSH instruction can be executed. This pushes the current PC value onto the stack; set TOS = PC and PC = PC + 2. The ability to pull the TOS value from the stack and replace it with the value previously pushed onto the stack without disturbing normal execution is achieved by using the POP instruction. The POP instruction pulls the TOS value from the stack, but this value is not written to the PC; the previous value pushed onto the stack becomes the TOS value. Return Stack Index (STKPTR) The STKPTR register contains return stack index values and overflow and underflow bits. Stack overflow bit (STK0VF) and underflow bit (STKUNF) allow software to verify stack conditions. Only clear STKOVF and 96779.doc after resetting the POR. • 24-200530920 STKUNF bit. After pushing the PC to the stack 31 times (without pulling any value from the stack), the 32nd push overwrites the value from the 31st push and sets the STK-OVF bit, and the STKPTR It stays at 11111b. The 33rd push overwrites the 32nd push (and so on), while 3! ^? Ding 11 remains at 111111). After the stack is taken out many times to unload the stack, the next removal will return a zero value to the PC and set the STKUNF bit while keeping the STKPTR at 00000b. The next fetch returns again to zero (and so on) while keeping STKPTR at 00000b. It should be noted that returning a zero to the PC in the case of an underflow has the effect of orienting the program to the reset vector, where the stacking conditions can be verified and appropriate actions taken. Stack indicators can be accessed via the STKPTR register. Users can read and write the stack index value. RTOS can use this value for return stack maintenance. Figure 18 shows the STKPTR register. The value of the stack index will be 0 to 31. When reset, the stacking index value will be 0. The stacking indicator will increase when pushing in, and decrease when removing. Stack Overflow / Underflow Reset According to the user's selection, overflow and underflow can reset the interrupt code of a device. A configuration bit STVRE is used to activate the reset. When the STVRE bit is disabled, the overflow or underflow will set the appropriate STKOVF or STKUNF bit without causing a reset. When the STVRE bit is actuated, the 'overflow or underflow' will set the appropriate STKOVF or STKUNF bit, and then reset the nature of a device very similar to WDT reset. In either case, the STK0VF or STKUNF bits are not cleared unless they are cleared by user software or a POR reset. Figure 18 96779.doc -25- 200530920 to 21 illustrates the stack register. Illustration. So to explain the stacking operation. Program memory 鳢 A preferred embodiment of the present invention has up to 2 million bytes (2M) x 8 user program memory space. The program memory space mainly contains instructions for execution. Table read and write instructions can be used to store and access data tables. There is another-test 8 memory space for testing ROM, configuration bits and identification characters. The device has a program counter up to 21 bits, which can address 2MX8 program memory space. And—the 22% bit, which is 'hidden' during normal operation, and when it is set, can access the configuration bit, device ID, and ROM. This bit can be set in test mode or programming mode, and the device must be reset to clear this bit. With this bit set, user program memory space cannot be accessed. Because the pc must access instructions on the boundary of the even-numbered S group in program memory, the Lsb of the pc is an implied, 0, and for every instruction, the pc is incremented by two. The reset vector is 000000h, and the high-priority interrupt vector is 000008h, and the low-priority interrupt vector is 0000i8h (see FIG. 30). Program Memory Organization Each location in program memory has a one-byte address. In addition, every 2 adjacent bytes have a -word address. Figure 31 shows the mapping of program memory with the indicated bytes and 2 addresses. In program memory, the words of these instructions must be aligned. Figure 32 shows the mapping of the program memory with several exemplary instructions and the hexadecimal codes placed in the mapping for those instructions. Table operations will work with byte entities. The table block does not need to be aligned 96779.doc -26- 200530920 so the table block can start and end at any byte address. The exception to this is the case of using table writes to program internal program memory or external :: Yuankuan flash memory. When stylized, you may need to align the writing material with the character width used by the stylized method. Program memory mode The present invention can be operated by five types of program memory—the configuration bit selects the configuration. Possible modes are: • MP-Microprocessor • EMC-Expansion Microcontroller • PEMC-Protected Expansion Microcontroller • MC-Microcontroller • PMC-Protected Microcontroller Microcontroller and Protected Microcontroller The controller mode allows only execution. Any access outside the program = memory reads all zeros. Protected microcontroller mode also activates the code protection feature. Microcontroller system—default mode for unprogrammed devices. Extended Microcontroller mode to access internal program memory and external program memory. Performs automatic switching between internal and external memory. The 21-bit address allows 2M bytes of program memory range. The protected extended microcontroller mode will code protect the internal program memory by preventing table read / write from internal memory while still allowing execution and table read / write from external program memory. This microprocessor mode only accesses external program memory. Ignore the on-chip format. The hidden 21-bit address allows the program memory of bytes to be in the range 96779.doc -27- 200530920. During normal operation of the device, test memory and configuration bits can be read by using TBLRD instructions. If the LWRT bit in the RCON register is set or the device is in test and programming mode, these areas can only be modified using the TBLWT instruction. You can only run from these areas in test and programming mode. The extended microcontroller mode and microprocessor mode are only available on devices with external memory buses that are defined as part of the I / O header. Table 2 lists the modes that can access internal and external memory. Figure 33 illustrates device memory mapping in different program modes. Figure 2 Device Mode Memory Access Operation Mode Internal Program Memory External Program Memory Microprocessor No Access Execution / TBLRD / TBLWT Extended Microcontroller Execution / TBLRD / TBLWT Execution / TBLRD / TBLWT Text Protection Expansion Microcontroller Port &Quot; " ------— Run / TBLRD / TBLWT AfUf port — ^ t / TBLRD / TBLWT No access protection micro-controller SJatblrd No access to external program memory interface Tin I U processing In the controller or expansion micro-controller mode, a maximum of four port groups can be used as the system and sink. Part of the two ports and the third port are multiplexed address / data buses, and part of the other port is used for control signals. Requires external components, Yang Nixian, Xianxi site and information. The external memory interface can be operated in 8-bit or 70-bit mode or 16-bit data mode. The addresses on the external memory interface are always byte addresses. Figures 36 and 37 illustrate the external memory connections of 16-bit and 8-bit data, respectively. The external program memory bus shares the 1/0 port function on the header. Figure 38 shows a typical mapping of the external bus function on the I / O header function. In Extended Microcontroller mode, when the device is executed outside the internal memory, these control numbers will not be active. It will enter a state where 1 $, eight < 19: 〇 > are tri-state; UBA0 and ALE are "〇". 16-bit external interface If the external interface is 16-bit, these will be captured as 16-bit characters. The output activation signal will actuate two types of program memory at one time and output 16-bit sub-bits. yuan. It is not necessary to connect the least significant bit of the address ΒΑ0 to the memory device. An external table read is performed logically one byte at a time, although the memory will read a 16-bit character from the outside. The least significant bit of this position will be selected internally between high and low bytes (LSb = 0 to lower bytes, Lsb = 丨 to higher bytes). The outer 4 addresses in the microprocessor and extended microcontroller modes are 21 bits wide; this allows addressing up to 2M bytes. An external table write on a 16-bit bus is performed logically one 7L group at a time. The actual writing will depend on the type of external device connected and the WM < 1: 0 > bits in the MEMCON register, as shown in Figure 34. The table operation section details the actual write cycle. 8-bit external interface If the external interface is 8-bit, 4th order deduction will be retrieved as 2 8-bit bytes. Fetch two bytes in one instruction cycle. It is not necessary to connect the least significant bit of the address to the memory device. The 0E output activation signal and 96779.doc -29- 200530920 BA ^ 1 will be activated at the q3 part of the cycle to read the most significant byte of the instruction from the program memory, and then in the Q4 part of the cycle, βΑ〇. Will become 0 and Asia will read the least significant byte to form a 16-bit instruction character. The master / nephew form is also executed one tuple at a time. An external form is written to the system to execute a tuple. WRL is active at every external write. When the 8-bit interface is selected, WRH, 118, and 1; 1 ^ lines are not used, and 妾 and 返回 return to the I / O port function. A configuration bit selects the 8-bit mode of the external interface. External wait period. The Haiwai 邛 σ self-memory interface supports wait cycles. The external memory waiting period is only applicable to table read and table write operations through the external bus. Because the execution of the device is related to the fetching of instructions, it does not make sense to execute faster than the rate of operation. Therefore, if program fetching needs to be slowed down, the processor speed must be slowed down at a different TCY time. The τ < 1: 〇 > bit in the MEMCON register will select 0, 丨, 2 or 3 additional TCY cycles in each record fetch cycle. For table reads and writes on a 16-bit 70 interface, these wait cycles will be valid. On the 8-bit " surface, for table reads and writes, the wait will only occur on Q4. The default setting for waiting at power-on is to wait for a maximum of 3 TCY cycles. This ensures that slow memory can work in microprocessor mode immediately after reset. A configuration bit, called WAIT, will activate or deactivate wait states. Figure 39 illustrates the 16-bit interface, and Figure 40 illustrates the 8-bit interface. In both cases, the status of 96779.doc -30- 200530920 shows the retrieval of program memory instructions without waiting and table reading with waiting status. . External bus signal deactivation In order to flexibly utilize the pins submitted to the external bus, several deactivations are provided in the configuration bit. To disable the entire external bus, as may be done in the extended microcontroller mode, and to allow a DMA function, configure the EBDIS bit in the MEM-CON register as shown in Figure 35. This deactivation will allow tristate of the entire external bus interface. This will allow DMA operation and direct control of external devices through program control via the I / O header function. In the simulator system, the -ME device must have an input for indicating the bus stop configuration bit, so that the I / O port function can detect the status of the pin as an external interface. The -ME device also has a special input pin that indicates whether the simulator system is in microprocessor or expansion microcontroller mode. Data Memory In the present invention, the data memory and general-purpose RAM size can be expanded to 4096 bytes. The data memory address is 12 bits wide. The data memory is divided into 16 repositories, each of which has 256 bytes. These repositories include a general purpose register (GPR) and a special function register (SFR). The GPR is mechanized into a one-byte wide RAM array with the size equivalent to a combined GPR register. SFRs are usually allocated between peripheral elements whose functions are controlled by the SFR. The bank is selected by a bank selection register (BSR < 3: 0 >). The BSR register may access more than 16 repositories, but the direct long addressing mode 96779.doc -31-200530920 is limited to 12-bit addresses or 16 repositories. BSR is restricted accordingly. Memory mapping device instructions can read, modify, and write to a specific location in an instruction cycle. Only one address is generated per cycle, & it is not possible to read one location and modify / write to another location in a single cycle. Figure 42 illustrates an exemplary data register. Universal Registers In all PIC devices, all data RAMs are used as registers by all instructions. Most data memory repositories contain only GPR memory. All 1 banks must include GPR memory. The absolute minimum number of GPRs in Repository 0 is 128. This GpR area, called access RAM, is necessary so that the programmer can have a data structure that can be accessed regardless of the settings of the computer. Special function register SFR is a special register, which is usually used for device and peripheral control and status functions. All registers can access these registers. If possible, all SFRs should be contained in the 128-byte upper byte of bank b. If SFR does not use all available locations on a particular device, unused locations are not implemented and read as 0. Some devices, such as the LCD controller, may have SIR areas in banks other than the bank 15. The boundaries of the SFR in the repository 15 may be modified for different devices. The access repository must include at least 16 GPRs. Figure 43 shows a possible special function register mapping. Figures 44 and 45 show an overview of the core special function registers. Addressing mode 96779.doc • 32- 200530920 The invention supports 7 data addressing modes: • inherent • text • direct short • direct coercion • direct long • indirect • index indirectly offsets its three modes, namely direct coercion and direct length A new model of the PIC architecture with indirect indexing. Inherent For some instructions, such as DAW, no addressing is required other than the addressing explicitly defined in the opcode. Text The text instruction contains a literal constant block, which is usually used for a mathematical operation, such as ADDLW. Text addressing is also used for GOTO, CALL, and branch opcodes. Direct Short Most math and move instructions operate in direct short addressing mode. In this addressing mode, the instruction contains eight bits of the least significant address of the data. The remaining four bits of the address are from the bank select register or BSR. The BSR is used to switch between repositories in the data memory area (see Figure 47). The need for large-capacity general-purpose memory space indicates a general-purpose RAM sub-library scheme. The lower half of the BSR selects the currently active general-purpose RAM to store the 96779.doc -33- 200530920 library. To assist with this instruction. A m0Vlb repository has been provided in the Caiyu Collection. The enemy will not apply the currently selected repository (for example, repository 13). Any read will win all of them. Anyone who writes A f π ㈣, and sighs and removes the STATUS register bit according to the situation. Directly force the special function register (sfr) of the character to be mapped into the data memory space. In order to / conveniently access the SFR, generally map it all into the storage bank 15. In order to interleave access, there is a meta block in the instruction, which points the address to the lower half of the general-purpose RAM repository 0 and the upper part of Shu's repository, regardless of the contents of the BSR. The job is set to · = η, so the 3 banks can be addressed by any instruction, that is, the banks 0 and 15 in the direct force mode and the bank "n" in the direct short mode. Direct Length Direct Addressing encodes all twelve bits of a data address into the instruction. This mode is used only by the MOVFF instruction. 'Day Indirect Addressing Indirect addressing is a mode of addressing data memory, where the address of the data memory in the instruction is determined by another-a register. This may be useful for data tables or stacks in data memory. Figure 53 shows the operation of indirect addressing. The value of the FSR register is used as the data memory address. Indirect Addressing Registers The present invention has three 12-bit registers for indirect addressing. These temporary
Eg:曰 · σσ · 96779.doc -34- 200530920Eg: Said · σσ · 96779.doc -34- 200530920
• FSR0H與 FSROL• FSR0H and FSROL
• FSR1H與 FSR1L• FSR1H and FSR1L
• FSR2H與 FSR2L FSR係12位元暫存器,並允許定址4096位元組資料記憶 體位址範圍中的任何位置。 除此之外,存在實體上不予實施的暫存器INDF0、INDF 1 與INDF2。讀取或寫入至此等暫存器可啟動間接定址,其 中對應FSR暫存器中的值係資料的位址。如果經由FSR間接 地讀取檔案INDF0(或INDF1,2)本身,則讀取全部’〇’(設定零 位元)。同樣,如果間接地寫入INDF0(或INDF1,2),則該操 作將等同於NOP,並且STATUS位元不受影響。 間接定址操作 每個INDF暫存器具有四個與其關聯的位址。當完成對四 個INDF位置之一的資料存取時,所選定的位址將FSR暫存 器組態為: •在間接存取之後自動遞減FSR中的值(位址)(後遞減)。 •在間接存取之後自動遞增FSR中的值(位址)(後遞增)。 •在間接存取之前自動遞增FSR中的值(位址)(預遞增)。 •在間接存取之後不改變FSR中的值(位址)(無變化)。 當使用自動遞增或自動遞減特徵時,對FSR的影響不會 被反映到STATUS暫存器中。例如,如果間接定址使FSR等 於f0’,則將不設定Z位元。添加此等特徵使FSR在用於資料 表格操作之外還可用於堆疊指標。 索引間接定址 96779.doc -35- 200530920 每個INDF具有一與其關聯的位址,其執行一索引的間接 存取。當發生對此INDF位置的資料存取時,將FSR組態為: •在間接存取之前,添加W暫存器中有符號的值以及FSR 中的值以形成該位址。 •不改變FSR值。 間接定址(INDF)暫存器之間接寫入 如果FSR暫存器包含一值,該值指向間接暫存器 (FEFh-FEBh、FE7h-FE3h、FDFh-FDBh)之一,則一間接讀 取將讀取〇〇h(設定零位元),而一間接的寫入將等效於一 NOP(STATUS位元不受影響)。 指標(FSR)暫存器之間接寫入 如果完成一間接定址操作,其中該目標位址係一 FSRnH 或FSRnL暫存器,則寫入操作將主導預遞增/遞減或後遞增/ 遞減功能。舉例來說: FSR0=FE8h (比 FSR0L位置少一) W=50h MOVWF *(++FSR0) ; (PREINCO) 將FSR0遞增一至FE9h,指向FSR0L。然後,將W寫入 FSR0L可將FSR0L改變為50h。然而, FSR0=FE9h (FSR0L 的位置) W=50h MOVWF *FSR0++ ; (POSTINCO) 在要發生FSRO遞增的同時,將試圖寫入W至FSROL。W 的寫入將勝過後遞增,並且FSR0L將為50h。 96779.doc -36- 200530920 指令集概述 、:發明之指令集由77個指令組成。由於先前技術架構中 過里的頁面與儲存庫切換,需要線性化程式與資料記憶體 映射’亚且修改該指令集,以促進此線性化。本法明之較 U體貫施例之資料記憶體空間具有最多達4κ位元組,其 係由16個储存庫組成,每個儲存庫有256個位元組。在本發 明的較佳具體實施例中,所有的特殊功能暫存器都位於二 儲存庫中,較佳係指定所有執行檔案操控(其可強制一虛擬 諸存庫)之扣7之操作碼中的一位元。因此,不必切換儲存 庫來存取特殊功能暫存器。 在較佳具體實施 <列中,於&前技術系统的基礎上將程式 ^憶體空間修改成最多達2M位it組。將PC從13位元增加到 最夕21位元,並將引起跳轉的某些指令(CALL·、GOTO)改 變為二字指令,以載入用於PC的21位元值。相對於先前技 〜、另改進係包括模組化模擬器。此需要在兩個用於模 擬之曰曰片之間進行通信,並且為了達成所需的速度,不可 月13在相同的指令週期内具有不同的來源與目的地暫存器。 因此’ ’肖除先前技術中的MOVPF與MOVFP指令。為了保持 此功此性’添加一二字指令MOVFF。 可將本發明的指令集分組成三類·· •位元組導向 •位元導向 •文字與控制操作。 圖%顯示此等格式。圖54顯示操作碼的欄位說明。此等 96779.doc 200530920 2明有助於瞭解圖57至59中以及附錄A中所找到的每 疋指令說明中的操作碼。圖114說明指令解碼映射。、 對於位元組導向的指令H示-檔案暫存ϋ指定符, 並且,d,表示-目的地指定符。該槽案暫存器指定符指定1 指令係要使用哪個檔案暫存器。該目的地指定符指定^ 作的結果係要放到何處。如果,d,=,〇,,則將該結果放到;: 存器中。如果…’卜則將該結果放到該指令所指定的檀^ 暫存器中。 〃 同樣’對於位元組導向的指令,,a,表示虛擬儲存庫選擇 位凡如果a=’0’,則覆蓋BSR,並選擇虛擬儲存庫。如果 a 1,則不覆盍儲存庫選擇暫存器(BSR)。 對於位7G導向的指令,,b,表示_位元欄位指定符,盆選 擇受該操作影響的位元的數目,而,f,表示該位元所在的槽 案位址。 、對:文子與控制操作,’k’表示一8、12、16或20位元常數 A文子值n ’ v表示快速呼叫/返回選擇位元。如果 ☆·〇,,陰影暫存器(shadow register)係未使用。如果v=,卜 則·二RETURN或RETFIE指令從陰影暫存器更新w、bsr ’、TUS曰存器,或經一 CALL指令從對應的暫存器載入 陰P S存器最後,係2的補數,其決定相對分支指令之 跳轉的方向與幅度。 該指令集係高度正交的並且係被分組成·· •位元組導向操作 •位元導向操作 96779.doc -38- 200530920 •文字與控制操作 在單個指令週期内執行所有指令,除非: •一條件測試為真 •因一指令而改變該程式計數器 •執行一檔案至檔案轉移 •執行一表格讀區或一表格寫入指令 在上列情況下,該執行耗用兩個指令週期,其中第二週 期作為一 NOP執行。 作為來源/目的地之特殊功能暫存器 本發明之正交指令集允許讀取與寫入所有的檔案暫存 器,包括特殊功能暫存器。有部分特殊情況係使用者應該 意識到的:• FSR2H and FSR2L FSR are 12-bit registers and allow addressing anywhere in the 4096-byte data memory address range. In addition, there are register INDF0, INDF1, and INDF2 that are not physically implemented. Reading or writing to these registers can initiate indirect addressing, where the corresponding value in the FSR register is the address of the data. If the file INDF0 (or INDF1, 2) itself is read indirectly via the FSR, all '0' (set zero bits) are read. Similarly, if INDF0 (or INDF1, 2) is written indirectly, the operation will be equivalent to NOP, and the STATUS bit will not be affected. Indirect Addressing Operations Each INDF register has four addresses associated with it. When data access to one of the four INDF locations is complete, the selected address configures the FSR register as: • Automatically decrement the value (address) in the FSR (post-decrement) after indirect access. • The value (address) in the FSR is automatically incremented after indirect access (post-increment). • Automatically increment the value (address) (pre-increment) in the FSR before indirect access. • The value (address) in the FSR is not changed after indirect access (no change). When using the auto-increment or auto-decrement feature, the effect on FSR will not be reflected in the STATUS register. For example, if indirect addressing makes FSR equal to f0 ', the Z bit will not be set. Adding these features allows FSR to be used for stacked indicators in addition to data table operations. Index Indirect Addressing 96779.doc -35- 200530920 Each INDF has an address associated with it, which performs indirect access to an index. When data access to this INDF location occurs, configure the FSR to: • Before indirect access, add the signed value in the W register and the value in the FSR to form the address. • Do not change the FSR value. Indirect addressing (INDF) register indirect write If the FSR register contains a value that points to one of the indirect registers (FEFh-FEBh, FE7h-FE3h, FDFh-FDBh), an indirect read will Read 00h (set the zero bit), and an indirect write will be equivalent to a NOP (STATUS bit is not affected). Index (FSR) register indirect write If an indirect addressing operation is completed, where the target address is an FSRnH or FSRnL register, the write operation will dominate the pre-increment / decrement or post-increment / decrement functions. For example: FSR0 = FE8h (one less than FSR0L position) W = 50h MOVWF * (++ FSR0); (PREINCO) Increment FSR0 by FE9h to point to FSR0L. Then, writing W to FSR0L can change FSR0L to 50h. However, FSR0 = FE9h (the location of FSR0L) W = 50h MOVWF * FSR0 ++; (POSTINCO) At the same time that FSRO increment is to occur, an attempt will be made to write W to FSROL. The write of W will exceed the post-increment, and FSR0L will be 50h. 96779.doc -36- 200530920 Instruction Set Overview : The instruction set of the invention consists of 77 instructions. Due to the previous page and repository switching in the prior art architecture, a linearization program and data memory mapping are needed and the instruction set is modified to promote this linearization. The data memory space of this embodiment is up to 4 kbytes, which is composed of 16 repositories, each of which has 256 bytes. In a preferred embodiment of the present invention, all special function registers are located in two repositories, preferably in the operation code of deduction 7 which specifies all file manipulations (which can force a virtual repository). One bit. Therefore, it is not necessary to switch banks to access special function registers. In the preferred implementation < column, the program memory space is modified to a maximum of 2M it groups based on the & previous technology system. Increase the PC from 13-bit to the latest 21-bit, and change some instructions (CALL ·, GOTO) that cause jumps to two-word instructions to load the 21-bit value for the PC. Compared with the prior art, another improvement system includes a modular simulator. This requires communication between the two chips used for simulation, and in order to achieve the required speed, it is not possible to have different source and destination registers in the same instruction cycle. Therefore, "'" eliminates the MOVPF and MOVFP instructions in the prior art. In order to maintain this functionality, a two-word instruction MOVFF is added. The instruction set of the present invention can be grouped into three types: • Byte-oriented • Bit-oriented • Text and control operations. Figure% shows these formats. Figure 54 shows a field description of the opcode. These 96779.doc 200530920 2 clearly help to understand the operation codes in each instruction description found in Figures 57 to 59 and Appendix A. Figure 114 illustrates the instruction decode map. For byte-oriented instructions, H indicates the -file temporary storage ϋ specifier, and d, indicates -destination specifier. The slot register specifier specifies which file register to use for the 1 instruction. The destination specifier specifies where to put the result of ^. If d, =, 〇, then put the result in;: memory. If ... ’, the result is placed in the register designated by the instruction. 〃 Similarly, for byte-oriented instructions, a, indicates the selection of a virtual repository. If a = '0', the BSR is overwritten and the virtual repository is selected. If a 1, the repository selection register (BSR) is not overridden. For bit 7G-oriented instructions, b indicates the _bit field designator, and selects the number of bits affected by the operation, while f indicates the address of the slot where the bit is located. , Pair: text and control operation, 'k' represents an 8, 12, 16, or 20-bit constant A text value n 'v represents a quick call / return selection bit. If ☆ · 〇, the shadow register is unused. If v =, then the two RETURN or RETFIE instructions update the w, bsr ', and TUS registers from the shadow register, or load the corresponding PS register from the corresponding register via a CALL instruction. Finally, the 2 Complement, which determines the direction and magnitude of the jump relative to the branch instruction. The instruction set is highly orthogonal and is grouped into groups. • Byte-oriented operations • Bit-oriented operations 96779.doc -38- 200530920 • Text and control operations execute all instructions in a single instruction cycle, unless: • A conditional test is true. • The program counter is changed due to an instruction. • A file-to-file transfer is performed. • A table read area or a table write instruction is executed. In the above case, the execution takes two instruction cycles. The two cycles are executed as a NOP. Special Function Registers as Source / Destination The orthogonal instruction set of the present invention allows reading and writing of all file registers, including special function registers. There are some special situations that users should be aware of:
作為目的地之STATUS 如果一指令寫入至STATUS暫存器,則可作為該指令的結 果而設定或清除Z、C、DC、OV與N位元並且覆寫所寫入的 原始資料位元。STATUS as a destination If an instruction is written to the STATUS register, the Z, C, DC, OV, and N bits can be set or cleared as a result of the instruction and the original data bits written can be overwritten.
作為來源或目的地之PCL PCL上的讀取、寫入或讀取-修改-寫入可具有下列結果: •對於一讀取PCL,首先PCU至PCL ATU ;然後PCH至 PCLATH ;然後PCL至目的地。 •對於一寫入PCL,首先PCLATU至PCU ;然後PCLATH 至PCH ;然後8位元結果值至PCL。 •對於一讀取-修改·寫入:首先PCL至ALU運算元,然後 PCLATH至PCH,然後PCLATU至PCU,然後8位元結果至 96779.doc -39- 200530920 PCL〇 其中: PCL=程式計數器低位元組 PCH=程式計婁i:器高位元組 PCLATH=程式計數器高保持鎖存器 PCU:程式計數器上部位元組 PCLATU=程式計數器上部保持鎖存器 dest=目的地,W或f。 位元操控 所有的位元操控指令皆係藉由首先讀取整個暫存器、在 所選定的位元上操作以及寫回結果而完成(讀取-修改-寫入 (R-M_W))。當在某些特殊功能暫存器(例如埠)上操作時, 使用者應記住此點。應注意,係在Q1週期中設定或清除藉 由該裝置所操控的狀態位元(包括中斷旗標位元)。因此,在 包含此等位元的暫存器上執行R_M-W指令時不會有問題。 圖60至113包含本發明之指令集内各指令之一般操作之 流程圖。各圖顯示用於擷取與執行本發明之指令集内之指 令的一般化與特定步驟。例如,圖60顯示用於擷取位元組 導向檔案暫存器操作之步驟,其包含指令ADDWF、 ADDWFC、ANDWF、COMF、DECF、INCF、IORWF、MOVF、 RLCF、RLNCF、RRCF、RRNCF、SUBFWB、SUBWF、 SUBWFB、SWAPF、XORWF、MOVWF 與 NOP 〇 同樣,圖 61顯示用於執行位元組導向檔案暫存器操作之步驟,其包 含指令 ADD WF、ADDWFC、AND WF、COME、DECF、INCF、 96779.doc -40- 200530920 IORWF、MO VF、RLCF、RLNCF、RRCF、RRNCF、SUBF WB、 SUBWF、SUBWFB、SWAPF與 XORWF(但 MOVWF只進行一 虛設讀取,並且NOP進行一虛設讀取與一虛設寫入)。 圖77顯示文字操作之擷取步驟,其包括指令ADDLW、 ANDLW、IORLW、MOVLW、SUBLW與 XORLW。如前,圖 78顯示文字操作之執行步驟,其包括指令ADDLW、 ANDLW、IORLW、MOVLW、SUBLW與 XORLW。 圖90顯示擷取分支操作之流程圖,其包括指令BC、BN、 BNC、BNN、BNV、BNZ、BV與BZ。同樣,圖90顯示執行 分支操作之流程圖,其包括指令BC、BN、BNC、BNN、BNV、 BNZ、BV與BZ。其餘圖式顯示擷取與執行指令集中其他指 令的步驟。 對於需要兩次擷取來獲得完整指令的多字指令而言,使 用三個流程圖來說明整個擷取與執行程序。例如,圖70至 72說明MOVFF指令。圖70顯示一相對較標準的擷取操作。 然而,圖71顯示操作框左側MOVFF第一部分的執行,而操 作框右邊部分則顯示指令之第二字元的擷取。因此,圖72 僅顯示MOVFF指令之第二字元之執行步驟。針對其他多字 指令提供類似的流程圖:LFSR (圖79至81) ; GOTO(圖102 至 104); CALL(圖 105至 107); TBLRD*、TBLRD* +、TBLRD*-與 TBLRD+*(圖 108至 110) ; TBLWT*、TBLWT*+、TBLWT*-與 TBLWT+*(圖 111 至 113) 〇 附錄A包含本發明之指令集之操作碼與指令之詳細列 表。基於所有目的以引用方式併入附錄A中之材料。 96779.doc -41 - 200530920 具有文字偏移之索引 圖U5說明另一定址模式,明確言之係具有文字偏移之索 引之定址模式。在一項具體實施例令,具有文字偏移之索 引之定址模式係藉由將稱為索引位元的上下文位元程式化 為T而致動。索引位元可能作為一熔絲實施,但亦可以軟 體或任何旗標/開關致動技術實施。當將索引位元程式化為 致動時,具有文字偏移的索引位址模式將取決於位址,並 且亦將取決於指令字元中存取位元的值。此模式僅適用於 使用直接強制位址的指令。 如果存取位元被設定為,丨,,則從先前架構決定位址的方 式不會有變化,並且定址模式預設為直接短。如果存取位 元的值為,0,,則解碼指令字元中所包含的位址並將其與值 5Fh進行比較。如果位址大於5Fh,則將定址模式解碼為直 接強制。如果存取位元係零,並且指令字元中的位址小於 或等於〇5Fh,則定址模式係具有文字偏移之索引。當此情 況發生時,指令字元中的位址預設為一添加至fsr2内容的 文字值。然後將所得到的值用作被操作的位址。 圖116顯不§具有文字偏移之索引被致動時如何分割存 取儲存庫。可將位置_至51?11映射至記憶體中的任何位 置。將存取儲存庫之此部分之起始位址映射至 FSR2H:FSR2L暫存器中所包含的位址。 對FSR2的修改 包括該指令暫存器 ’以添加至FSR2的 為了支援具有文字偏移之索引模式, 較低的七個位元作為四個可能的值之一 96779.doc 200530920 内容。 將IR中所包含的資料視為一無符號整數,並且不將結果 儲存於FSR2中。有四種定址模式: •間接(INDF); •具有增量/減量(FSR2 + )、(+FSR2)與(FSR2-)之間接模 式; •具有偏移之間接模式(FSR2 + W,其中W的内容係用於 偏移);以及 •具有文字偏移之間接模式(FSR2+文字)。 本發明包括一指令集,當調用該指令集時,其在微控器 上執行一或多個任務。以下說明數個指令。在特殊的情況 下,可藉由,例如,一開關或其他等效的措施來調用此等 指令。 「PUSHL」指令將一 8位元文字值推入至該堆疊上。 PUSHL指令的實際語法係「PUSHLk」,其中0 <=k<= 225。 該命令的調用不會影響微控器的狀態。PUSHL指令的編碼 係「1110 1010 kkkk kkkk」,其中8位元文字係藉由該指令 的kkkk kkkk部分來指定。此處,將該8位元文字複製至第 二檔案選擇暫存器(「FSR2」)正在定址的位置,並使FSR2 遞減。 「SUBFSR」指令從一檔案選擇暫存器(「FSR」)減去一 5 位元文字。該命令的語法係「SUBFSR f,k」,其中0 <= f <= 2與0 <=k <=63。該命令的調用不會影響微控器的狀態。該 命令的編碼係「1110 1001 ffkk kkkk」,當被調用時,其從 96779.doc -43- 200530920 FSRf減去6位元(無符號)文字,並將結果儲存回FSRf,其中 該指令的「ff」部分指定特定的檔案選擇暫存器,並且該指 令的「kk kkkk」部分指定文字。 「SUBULNK」指令從第二檔案選擇暫存器(「FSR2」) 減去一 5位元文字,並將所得到的值返回。該命令的語法係 「SUBULNK k」,其中0 <= k <= 63。該命令的調用不會影 響微控器的狀態。該命令的編碼係「1110 1001 llkk kkkk」, 當被調用時,其從FSR2減去6位元(無符號)文字,將結果儲 存回FSR2,並將該結果與該執行返回到呼叫器。 「ADDFSR」指令將一5位元文字添加至一 FSR。該指令 的語法係「ADDFSR f,k」,其中 0<=f<=2與 0<=k<=63。 微控器的狀態不受此指令的影響。該指令的編碼係「1110 1000 ffkk kkkk」,當被調用時,其將6位元(無符號)文字添 加至從FSRf,並將所得到的值儲存回FSRf,其中該指令的 「ff」部分指定特定的檔案選擇暫存器,並且該指令的「kk kkkk」部分指定文字。 「ADDULNK」指令將一 5位元文字添力口至FSR2,並且將 該結果與該執行返回呼叫常式。該指令的語法係 「ADDULNK k」,其中0 <= k <= 63。該指令的調用不會影 響微控器的狀態。該指令的編碼係「11 10 1000 llkk kkkk」, 其中當調用時,將一 6位元(無符號)文字(其係由該指令的 「kk kkkk」部分指定)添加至FSR2,並將該結果儲存回 F SR2,並將執行返回至呼叫器。 「MOVSF」指令將一堆疊位置儲存至通用暫存器 96779.doc -44- 200530920 (「GPR」)。該指令的語法係r m〇VSF s,d」,其中0 <= s <= 127與0 <== d <= 4095。該指令的調用不會影響微控器的狀 態。該指令的編碼係在二字中,其中Word 1係「1110 1 〇 11PCL as source or destination Read, write or read-modify-write on PCL can have the following results: • For a read PCL, first PCU to PCL ATU; then PCH to PCLATH; then PCL to destination Ground. • For a write to PCL, first PCLATU to PCU; then PCLATH to PCH; then 8-bit result value to PCL. • For a read-modify-write: first PCL to ALU operand, then PCLATH to PCH, then PCLATU to PCU, and then 8-bit result to 96779.doc -39- 200530920 PCL〇 Among them: PCL = program counter low Tuple PCH = program counter i: device high byte PCLATH = program counter high holding latch PCU: upper part of program counter tuple PCLATU = program counter upper holding latch dest = destination, W or f. Bit manipulation All bit manipulation instructions are completed by first reading the entire register, operating on the selected bit, and writing back the result (Read-Modify-Write (R-M_W)). Users should keep this in mind when operating on some special function registers (such as ports). It should be noted that the status bits (including interrupt flag bits) controlled by the device are set or cleared during the Q1 cycle. Therefore, there is no problem when executing the R_M-W instruction on the register containing these bits. Figures 60 to 113 contain flowcharts of the general operations of each instruction in the instruction set of the present invention. The figures show generalized and specific steps for retrieving and executing instructions within the instruction set of the present invention. For example, Figure 60 shows the steps for retrieving a byte-oriented file register operation, which includes the instructions ADDWF, ADDWFC, ANDWF, COMF, DECF, INCF, IORWF, MOVF, RLCF, RLCCF, RRCF, RRCCF, SUBFWB, SUBWF, SUBWFB, SWAPF, XORWF, MOVWF and NOP 〇 Similarly, Figure 61 shows the steps for performing a byte-oriented file register operation, which includes the instructions ADD WF, ADWDFC, AND WF, COME, DECF, INCF, 96779 .doc -40- 200530920 IORWF, MO VF, RLCF, RNLCF, RRCF, RRCCF, SUBF WB, SUBWF, SUWFB, SWAPF, and XORWF (but MOVWF only performs a dummy read, and NOP performs a dummy read and a dummy write Into). Figure 77 shows the retrieval steps for text operations, which include the instructions ADDLW, ANDLW, IOLWL, MOVLW, SUBLW, and XORLW. As before, FIG. 78 shows the execution steps of the text operation, which includes the instructions ADDLW, ANDLW, IOLWL, MOVLW, SUBLW, and XORLW. FIG. 90 shows a flowchart of a fetch branch operation, which includes instructions BC, BN, BNC, BNN, BNV, BNZ, BV, and BZ. Similarly, Fig. 90 shows a flowchart for performing a branch operation, which includes instructions BC, BN, BNC, BNN, BNV, BNZ, BV, and BZ. The remaining diagrams show the steps to retrieve and execute other instructions in the instruction set. For multi-word instructions that require two fetches to obtain a complete instruction, three flowcharts are used to illustrate the entire fetch and execution process. For example, Figures 70 to 72 illustrate the MOVFF instruction. Figure 70 shows a relatively standard acquisition operation. However, Fig. 71 shows the execution of the first part of MOVFF on the left side of the operation box, and the right part of the operation box shows the fetching of the second character of the instruction. Therefore, Fig. 72 only shows the execution steps of the second character of the MOVFF instruction. Similar flowcharts are provided for other multi-word instructions: LFSR (Figures 79 to 81); GOTO (Figures 102 to 104); CALL (Figures 105 to 107); TBLRD *, TBLRD * +, TBLRD *-and TBLRD + * (Figure (108 to 110); TBLWT *, TBLWT * +, TBLWT *-, and TBLWT + * (Figures 111 to 113). Appendix A contains a detailed list of operation codes and instructions of the instruction set of the present invention. Materials incorporated in Appendix A by reference for all purposes. 96779.doc -41-200530920 Index with text offset Figure U5 illustrates another addressing mode, specifically an addressing mode with an index with text offset. In a specific embodiment, the addressing mode of an index with text offset is activated by programming a context bit called an index bit to T. The index bit may be implemented as a fuse, but it may also be implemented in software or any flag / switch actuation technology. When the index bit is programmed into actuation, the index address pattern with text offset will depend on the address and will also depend on the value of the access bit in the instruction character. This mode is only applicable to instructions using direct forced addresses. If the access bit is set to, the addressing method from the previous architecture will not change, and the addressing mode is preset to be directly short. If the value of the access bit is 0, the address contained in the instruction character is decoded and compared with the value 5Fh. If the address is greater than 5Fh, the addressing mode is decoded as directly forced. If the access bit is zero and the address in the instruction character is less than or equal to 0Fh, the addressing mode is an index with text offset. When this happens, the address in the instruction character is preset to a literal value added to the fsr2 content. The resulting value is then used as the address to be manipulated. Figure 116 shows how an index with text offset is partitioned into an access repository when it is activated. You can map locations_ to 51? 11 to any location in memory. Map the starting address of this part of the access repository to the address contained in the FSR2H: FSR2L register. Modifications to FSR2 include the instruction register ’added to FSR2. To support the index mode with text offset, the lower seven bits are included as one of four possible values. 96779.doc 200530920 content. The data contained in the IR is treated as an unsigned integer, and the result is not stored in FSR2. There are four addressing modes: • Indirect (INDF); • Increment / decrement (FSR2 +), (+ FSR2) and (FSR2-) indirect modes; • Offset indirect mode (FSR2 + W, where W Content is for offset); and • Indirect mode with text offset (FSR2 + text). The invention includes an instruction set that, when invoked, executes one or more tasks on a microcontroller. Several instructions are described below. In special cases, these instructions can be called by, for example, a switch or other equivalent measures. The "PUSHL" instruction pushes an 8-bit text value onto the stack. The actual syntax of the PUSHL instruction is "PUSHLk", where 0 < = k < = 225. The invocation of this command does not affect the state of the microcontroller. The encoding of the PUSHL instruction is "1110 1010 kkkk kkkk", in which 8-bit characters are specified by the kkkk kkkk part of the instruction. Here, this 8-bit text is copied to the location where the second file selection register ("FSR2") is being addressed, and FSR2 is decremented. The "SUBFSR" instruction subtracts a 5-bit text from a file selection register ("FSR"). The syntax of this command is "SUBFSR f, k", where 0 < = f < = 2 and 0 < = k < = 63. The invocation of this command does not affect the state of the microcontroller. The encoding of this command is "1110 1001 ffkk kkkk". When called, it subtracts 6-bit (unsigned) text from 96779.doc -43- 200530920 FSRf and stores the result back to FSRf, where the " The "ff" section specifies a specific file selection register, and the "kk kkkk" section of the command specifies text. The "SUBULNK" instruction subtracts a 5-bit character from the second file selection register ("FSR2") and returns the resulting value. The syntax of this command is "SUBULNK k", where 0 < = k < = 63. The invocation of this command does not affect the state of the microcontroller. The encoding of this command is "1110 1001 llkk kkkk". When called, it subtracts 6-bit (unsigned) text from FSR2, stores the result back to FSR2, and returns the result and the execution to the caller. The "ADDFSR" instruction adds a 5-bit text to an FSR. The syntax of this instruction is "ADDFSR f, k", where 0 < = f < = 2 and 0 < = k < = 63. The state of the microcontroller is not affected by this instruction. The encoding of this instruction is "1110 1000 ffkk kkkk". When called, it adds 6-bit (unsigned) text to the slave FSRf and stores the resulting value back to the FSRf, where the "ff" part of the instruction Specify a specific file selection register and specify text in the "kk kkkk" part of the command. The "ADDULNK" instruction adds a 5-digit character to FSR2, and returns the result and the execution to the call routine. The syntax of this instruction is "ADDULNK k", where 0 < = k < = 63. The call of this instruction does not affect the state of the microcontroller. The encoding of the instruction is "11 10 1000 llkk kkkk", where when called, a 6-bit (unsigned) text (specified by the "kk kkkk" part of the instruction) is added to FSR2, and the result is Save back to F SR2 and return execution to the pager. The "MOVSF" instruction stores a stack location in the general register 96779.doc -44- 200530920 ("GPR"). The syntax of this instruction is r m0VSF s, d ", where 0 < = s < = 127 and 0 < == d < = 4095. The call of this instruction does not affect the state of the microcontroller. The instruction is coded in two words, of which Word 1 is "1110 1 〇 11
Osss ssss」,並且 Word 2係「mi dddd dddd dddd」,並且其 中該指令之第一字元的「sss ssss」部分指定一來源,而該 第二字元的「dddd dddd dddd」部分指定目的地。調用該指 令時,將7位元文字值添加至FSR2中的值,得到一 8位元值 之源位址’,隨後會將該源位址複製至由12位元值d所指定的 一位置。FSR2值不受MOVSF指令的影響,微控器的狀態也 不受影響。 「MOVSS」指令將一堆疊位置複製至另一堆疊位置。該 指令的語法係「MOVSS s,d」,其中〇 <= s <= 127與0 <= d <= 127。該指令的調用不會影響微控器的狀態。該指令的編碼 係在二字中,其中Word 1係「1110 1011 lsss ssss」,並且 Word 2係「1111 χχχχ xddd dddd」,並且其中該指令之第一 字元的「sss ssss」部分指定一來源,而該第二字元的r ddd dddd」部分指定目的地。調用該指令時,將7位元文字值添 加至FSR2中的值,得到一 8位元值之源位址,隨後會將該源 位址複製至由一位址(該位址係藉由將該7位元值添加至 FSR2中的值而決定)所指定的一位置。FSR2值不受MOVSS 指令的影響,微控器的狀態也不受影響。 「CALLW」指令係一間接的呼叫。該指令的語法係 「C ALLW」。該指令的調用不會影響微控器的狀態。該命 令的編碼係「0 0 0 0 0 0 0 0 0 0 01 010 0」,當調用該指令時,將 96779.doc •45 - 200530920 下一指令的位址推到該硬體堆疊上。明確言之,將來自第 一暫存器(例如PCLATU:PCLATH)的值複製至程式計數器 (「PC」)較高的16位元中,並將第二暫存器(例如w暫存器 (「WREG」))中的值複製至pc較低的8位元。 本發明因而充分地適於實行該目的,並獲得上述之目的 與優點,以及其他在此所固有者。雖然已參照本發明示範 性具體實施例來說明與定義本發明,但此類參照並不代表 本發明的限制,也不可推論此類限制。誠如熟悉一般相關 技付者所知本發明可以修正、變更與貝有相當的型式及 功能。本發明所描述並說明的具體實施例僅用於示範說 明,而非詳盡說明本發明範圍。因此,本發明僅藉由附加 之申請專利範圍的精神與範圍而予以限制,並在各方面給 予同等物完全的認可。 【圖式簡單說明】 圖1係先前技術之中型微控器單元之示意方塊圖; 圖2係先前技術Harvard架構之示意方塊圖; 圖3係先前技術vonNeumann架構之示意方塊圖; 圖4係先前技術之時脈/指令週期之時序圖; 圖5係執行多重指令之示意圖; 圖6係本發明之微控器核心之示意方塊圖; 圖7為本發明Q週期活動的時序圖; 圖8為本發明之時脈/指令週期的時序圖; 圖9係本發明之指令管線流程圖; 圖10係本發明之指令管線流程圖; 96779.doc -46- 200530920 圖11係本發明之指令管線流程圖; 圖12係本發明之指令管線流程圖; 圖13係本發明之指令管線流程圖; 圖14係本發明之指令管線流程圖; 圖15係本發明之狀態暫存器之方塊圖; 圖16係本發明之程式計數器之方塊圖; 之方 圖17係使用CALL與GOTO指令之本發明程式計數器 塊圖, 圖18係本發明之堆疊指標暫存器之方塊圖,· 圖19係本發明之堆疊頂部上部暫存器之方塊圖,· 圖20係本發明之堆疊頂部高暫存器之方塊圖; 圖21係本發明之堆疊頂部低暫存器之方塊圖; 圖2 2說明本發明之堆疊重設操作; 圖23說明本發明之初始化堆疊上的第一 €八乙乙; 圖24說明本發明之堆疊上的第二連續call ; 圖2 5說明本發明之堆疊上第3 1與第3 2連續C A L L· ; 取 圖26說明本發明之堆疊上的一返回pop操作; 圖27說明一在本發明内引起堆疊下溢狀況的堆疊返 出; 圖28說明本發明之堆疊上的一pUSH指令; 圖29說明本發明之堆疊上的一pop指令; 圖30係本發明之程式記憶體映射與堆疊之方塊圖; 圖3 1係本發明之記憶體映射之方塊圖; 圖32係本發明之記憶體映射之方塊圖; 96779.doc -47- 200530920 圖33係一在不同程式模式中本發明之裝置記憶體映射之 方塊圖; 圖34係一說明本發明之MEMC〇N暫存器之方塊圖; 圖35係一說明本發明之c〇NFIGi^態位元組之方塊圖; 圖36係本發明之16位元外部記憶體連接組態之示意方塊 圖; 圖37係本發明之8位元外部記憶體連接組態之方塊圖; 圖38係本發明之典型埠功能之列表; 圖39係本發明之16位元模式中外部程式記憶體匯流排之 時序圖; 圖40係本發明之8位元模式中外部程式記憶體匯流排之 時序圖; 圖41係本發明之外部匯流排週期類型之列表; 圖42係本發明之資料記憶體映射與指令「&」位元之示意 方塊圖; 圖43係本發明之特殊功能暫存器之映射; 圖44係本發明之核心特殊功能暫存器之示意圖; 圖45係圖44之核心特殊功能暫存器之延續; 圖46係本發明之直接短定址模式之示意方塊圖·, 圖47係本發明之BSR操作之示意方塊圖; 圖48係本發明之BSR操作在模擬/測試模式期間之示意方 塊圖; ^ 圖49係本發明之直接強制定址模式之示意方塊圖; 圖50係本發明之直接強制定址模式之示意方塊圖; 96779.doc -48- 200530920 圖5 1係本發明之直接長定址模式之示意方塊圖; 圖52係本發明之間接定址模式之示意方塊圖; 圖53係本發明之間接定址模式之示意方塊圖; 圖54係本發明之說明性列表操作碼欄位; 圖55係本發明之間接定址符號之列表; 圖56說明本發明之指令之通用格式; 圖57係本發明之指令集之部分列表; 圖5 8係本發明之指令集之部分列表; 圖59係本發明之指令集之部分列表; 圖60係本發明之位元組導向檔案暫存器操作之流程圖; 圖61係本發明之位元組導向檔案暫存器操作(執行)之流 程圖; 圖62係本發明之CLRF、NEGF、SETF(擷取)指令的流程 圖; 圖63係本發明之CLRF、NEGF、SETF(執行)指令的流程 圖, 圖 64係、本發明之DECFSZ、DCFSNZ、INCFSZ、ICFSNZ(擷 取)指令的流程圖; 圖 65係、本發明之DECFSZ、DCFSNZ、INCFSZ、ICFSNZ(擷 取)指令的流程圖; 圖 66係本發明之 CPFSEQ'CPFSQT^CPFSLT^TSTFSZ^ 取)指令的流程圖; 圖 67係、本發明之CPFSEQ、CPFSQT、CPFSLT與TSTFSZ(執 行)指令的流程圖; 96779.doc -49- 200530920 圖68係本發明之MULWF(擷取)指令的流程圖; 圖69係本發明之MULWF(執行)指令的流程圖; 圖70係本發明之MULFF(擷取)指令的流程圖; 圖71係本發明之MULFF(執行1)指令的流程圖; 圖72係本發明之MULFF(執行2)指令的流程圖; 圖73係本發明之BCF、BSF、BTG(擷取)指令的流程圖; 圖74係本發明之BCF、BSF、BTG(擷取)指令的流程圖; 圖75係本發明之BTFSC與BTFSS(擷取)指令的流程圖; 圖76係本發明之BTFSC與BTFSS(執行)指令的流程圖; 圖77係本發明之文字操作(擷取)的流程圖; 圖78係本發明之文字操作(執行)的流程圖; 圖79係本發明之LFSR(擷取)指令的流程圖; 圖80係本發明之LFSR(執行1)指令的流程圖; 圖81係本發明之LFSR(執行2)指令的流程圖; 圖82係本發明之DAW(擷取)指令的流程圖; 圖83係本發明之DAW(執行)指令的流程圖; 圖84係本發明之MULLW(擷取)指令的流程圖; 圖85係本發明之MULLW(執行)指令的流程圖; 圖86係、本發明之CLRWDT、HALT、RESET與SLEEP(擷取) 指令的流程圖, 圖87係本發明之CLRWDT、HALT' RESET與SLEEP(執行) 指令的流程圖; 圖88係本發明之MOVELB(擷取)指令的流程圖; 圖89係本發明之MOVLB(執行)指令的流程圖; 96779.doc -50- 200530920 圖90係本發明之分支操作(擷取)的流程圖; 圖91係本發明之分支操作(執行)的流程圖; 圖92係本發明之BRA與RCALL(擷取)指令的流程圖; 圖93係本發明之BRA與RCALL(執行)指令的流程圖; 圖94係本發明之PUSH(擷取)指令的流程圖; 圖95係本發明之PUSH(執行)指令的流程圖; 圖96係本發明之POP(擷取)指令的流程圖; 圖97係本發明之POP(執行)指令的流程圖; 圖98係本發明之RETURN與RETFIE(擷取)指令的流程 圖; 圖99係本發明之RETURN與RETFIE(執行)指令的流程 圖; 圖100係本發明之RETLW(擷取)指令的流程圖; 圖101係本發明之RETLW(執行)指令的流程圖; 圖102係本發明之GOTO(擷取)指令的流程圖; 圖103係本發明之GOTO(執行1)指令的流程圖; 圖104係本發明之GOTO(執行2)指令的流程圖; 圖105係本發明之CALL(擷取)指令的流程圖; 圖106係本發明之CALL(執行1)指令的流程圖; 圖107係本發明之CALL(執行2)指令的流程圖; 圖 108 係、本發明之 TBLRD*、TBLRD*+、TBLRD*-與 TBLRD+*(擷取)指令的流程圖; 圖 109 係、本發明之 TBLRD*、TBLRD*+、TBLRD*-與 TBLRD+*(執行1)指令的流程圖; 96779.doc -51 - 200530920 圖 110 係本發明之 TBLRD*、TBLRD*+、TBLRD*-與 TBLRD + *(執行2)指令的流程圖; 圖 111 係、本發明之 TBLWT*、TBLWT*+、TBLWT*-與 TBLWT+*(擷取)指令的流程圖; 圖 112 係本發明之 TBLWT*、TBLWT*+、TBLWT*-與 TBLWT+*(執行)指令的流程圖; 圖 113 係本發明之 TBLWT*、TBLWT*+、TBLWT*-與 TBLWT+*(執行2)指令的流程圖; 圖114係本發明之指令解碼映射; 圖115係根據本發明原理之交替分頁方案之方塊圖。 圖116係根據本發明原理之交替分頁方案之方塊圖。 【主要元件符號說明】 22 資料記憶體 24 CPU 26 程式記憶體 34 CPU 36 資料與程式記憶體 100 微控器核心 102 位址鎖存器 104 資料記憶體 106 資料鎖存器 108 選擇電路 110 儲存庫 112 解碼器 96779.doc -52- 200530920Osss ssss "and Word 2 is" mi dddd dddd dddd ", and the" sss ssss "part of the first character of the command specifies a source, and the" dddd dddd dddd "part of the second character specifies the destination . When this instruction is called, the 7-bit text value is added to the value in FSR2 to obtain an 8-bit value source address', and then the source address is copied to a location specified by the 12-bit value d . The FSR2 value is not affected by the MOVSF instruction, and the state of the microcontroller is not affected. The "MOVSS" instruction copies one stack position to another stack position. The syntax of this instruction is "MOVSS s, d", where 0 < = s < = 127 and 0 < = d < = 127. The call of this instruction does not affect the state of the microcontroller. The instruction is encoded in two words, where Word 1 is "1110 1011 lsss ssss", and Word 2 is "1111 χχχχddd dddd", and the "sss ssss" portion of the first character of the instruction specifies a source , And the r ddd dddd "portion of the second character specifies the destination. When this instruction is called, a 7-bit text value is added to the value in FSR2 to obtain a source address of an 8-bit value. The source address is then copied to a single-bit address (the address is The 7-bit value is added to the value in FSR2 to determine the position specified). The FSR2 value is not affected by the MOVSS instruction and the state of the microcontroller is not affected. The "CALLW" command is an indirect call. The syntax of this command is "C ALLW". The call of this instruction does not affect the state of the microcontroller. The encoding of this command is "0 0 0 0 0 0 0 0 0 0 01 010 0". When this command is called, the address of the next instruction of 96779.doc • 45-200530920 is pushed onto the hardware stack. To be clear, copy the value from the first register (such as PCLATU: PCLATH) into the higher 16 bits of the program counter ("PC") and copy the second register (such as w register ( "WREG")) to the lower 8 bits of the pc. The present invention is thus well suited for carrying out this purpose, and obtains the above-mentioned objects and advantages, and others inherent therein. Although the invention has been described and defined with reference to exemplary embodiments thereof, such references do not represent a limitation of the invention, nor can it be inferred. As is known to those skilled in the art, the present invention can modify and change the equivalent type and function of the shell. The specific embodiments described and illustrated in the present invention are only for illustrative purposes, and are not intended to describe the scope of the present invention in detail. Therefore, the present invention is limited only by the spirit and scope of the scope of the appended patent application, and it fully grants equivalents in all respects. [Brief description of the drawings] Figure 1 is a schematic block diagram of a medium-sized microcontroller unit of the prior art; Figure 2 is a schematic block diagram of the Harvard architecture of the prior art; Figure 3 is a schematic block diagram of the vonNeumann architecture of the prior art; Timing chart of technology clock / instruction cycle; Figure 5 is a schematic diagram of executing multiple instructions; Figure 6 is a schematic block diagram of the microcontroller core of the present invention; Figure 7 is a timing diagram of Q cycle activities of the present invention; Figure 8 is Timing diagram of the clock / instruction cycle of the present invention; Figure 9 is a flowchart of the instruction pipeline of the present invention; Figure 10 is a flowchart of the instruction pipeline of the present invention; 96779.doc -46- 200530920 Figure 11 is a flowchart of the instruction pipeline of the present invention Figure 12 is a flowchart of the instruction pipeline of the present invention; Figure 13 is a flowchart of the instruction pipeline of the present invention; Figure 14 is a flowchart of the instruction pipeline of the present invention; Figure 15 is a block diagram of a state register of the present invention; 16 is a block diagram of the program counter of the present invention; FIG. 17 is a block diagram of the program counter of the present invention using CALL and GOTO instructions, FIG. 18 is a block diagram of a stack index register of the present invention, and FIG. 19 is the present invention. Block diagram of the top register of the stack top, Figure 20 is a block diagram of the stack top high register of the present invention; Figure 21 is a block diagram of the stack top low register of the present invention; Figure 2 2 illustrates the present invention Stack reset operation; FIG. 23 illustrates the first € 80 on the initial stack of the present invention; FIG. 24 illustrates the second consecutive call on the stack of the present invention; and FIG. 25 illustrates the 31st and The 32nd continuous CALL ·; Take FIG. 26 to explain a pop operation on the stack of the present invention; FIG. 27 illustrates a stack return that causes a stack underflow condition in the present invention; FIG. 28 illustrates a stack on the stack of the present invention pUSH instruction; FIG. 29 illustrates a pop instruction on the stack of the present invention; FIG. 30 is a block diagram of the program memory mapping and stacking of the present invention; FIG. 31 is a block diagram of the memory mapping of the present invention; Block diagram of the memory map of the invention; 96779.doc -47- 200530920 Figure 33 is a block diagram of the device memory map of the invention in different program modes; Figure 34 is a MEMCON register of the invention Block diagram; Figure 35 is an illustration Block diagram of the invention's coNFIGi state byte; Figure 36 is a schematic block diagram of the 16-bit external memory connection configuration of the present invention; Figure 37 is a diagram of the 8-bit external memory connection configuration of the present invention Block diagram; Figure 38 is a list of typical port functions of the present invention; Figure 39 is a timing diagram of the external program memory bus in the 16-bit mode of the invention; Figure 40 is an external program memory in the 8-bit mode of the invention Figure 41 is a timing diagram of the external bus cycle type of the present invention; Figure 42 is a schematic block diagram of the data memory mapping and instruction "&" bit of the present invention; Figure 43 is the present invention. Mapping of special function register; Figure 44 is a schematic diagram of the core special function register of the present invention; Figure 45 is a continuation of the core special function register of Figure 44; Figure 46 is a schematic diagram of the direct short addressing mode of the present invention Block diagram, Figure 47 is a schematic block diagram of the BSR operation of the present invention; Figure 48 is a schematic block diagram of the BSR operation of the present invention during the simulation / test mode; ^ Figure 49 is a schematic block of the direct forced addressing mode of the present invention Figure; 50 is a schematic block diagram of the direct strong addressing mode of the present invention; 96779.doc -48- 200530920 Figure 51 is a schematic block diagram of the direct long addressing mode of the present invention; Figure 52 is a schematic block diagram of the indirect addressing mode of the present invention Figure 53 is a schematic block diagram of the indirect addressing mode of the present invention; Figure 54 is an illustrative list operation code field of the present invention; Figure 55 is a list of indirect addressing symbols of the present invention; Figure 56 illustrates the generality of the instructions of the present invention Format; Figure 57 is a partial list of the instruction set of the present invention; Figure 58 is a partial list of the instruction set of the present invention; Figure 59 is a partial list of the instruction set of the present invention; Figure 60 is a byte-oriented file of the present invention Flow chart of register operation; Figure 61 is a flowchart of byte-oriented file register operation (execution) of the present invention; Figure 62 is a flowchart of CLRF, NEGF, SETF (fetch) instructions of the present invention; Figure 63 is a flowchart of the CLRF, NEGF, SETF (execute) instructions of the present invention, Figure 64 is a flowchart of the DECFSZ, DCFSNZ, INCFSZ, ICFSNZ (fetch) instructions of the present invention; Figure 65 is a DECFSZ of the present invention , DCFSNZ INCFSZ, ICFSNZ (fetch) instruction flowchart; Figure 66 is a flowchart of the CPFSEQ'CPFSQT ^ CPFSLT ^ TSTFSZ ^ fetch) instruction of the present invention; Figure 67 is a CPFSEQ, CPFSQT, CPFSLT, and TSFTSZ (execution) of the present invention Instructions flow chart; 96779.doc -49- 200530920 Figure 68 is a flowchart of the MULWF (retrieval) instruction of the present invention; Figure 69 is a flowchart of the MULWF (execute) instruction of the present invention; Figure 70 is a MULFF of the present invention (Fetch) instruction flowchart; Figure 71 is a flowchart of the MULFF (execute 1) instruction of the present invention; Figure 72 is a flowchart of the MULFF (execute 2) instruction of the present invention; and Figure 73 is a BCF and BSF of the present invention , BTG (fetch) instruction flowchart; Figure 74 is a flowchart of the BCF, BSF, BTG (fetch) instructions of the present invention; Figure 75 is a flowchart of the BTFSC and BTFSS (fetch) instructions of the present invention; 76 is a flowchart of the BTFSC and BTFSS (execute) instructions of the present invention; FIG. 77 is a flowchart of the text operation (retrieval) of the present invention; FIG. 78 is a flowchart of the text operation (execution) of the present invention; Flow chart of the LFSR (fetch) instruction of the present invention; FIG. 80 shows the LFSR (execution 1) of the present invention Instructions flow chart; Figure 81 is a flowchart of the LFSR (execute 2) instruction of the present invention; Figure 82 is a flowchart of the DAW (fetch) instruction of the present invention; Figure 83 is a flow of the DAW (execute) instruction of the present invention Figures; Figure 84 is a flowchart of the MULLW instruction of the present invention; Figure 85 is a flowchart of the MULLW (execute) instruction of the present invention; Figure 86 is a CLRWDT, HALT, RESET, and SLEEP (retrieval) of the present invention ) Instructions flow chart, Figure 87 is a flowchart of the CLRWDT, HALT 'RESET and SLEEP (execute) instructions of the present invention; Figure 88 is a flowchart of the MOVELB (fetch) instruction of the present invention; Figure 89 is a MOVLB of the present invention (Execution) instruction flow chart; 96779.doc -50- 200530920 Fig. 90 is a flow chart of the branch operation (acquisition) of the present invention; Fig. 91 is a flow chart of the branch operation (execution) of the present invention; Flow chart of the BRA and RCALL (fetch) instructions of the invention; Figure 93 is a flow chart of the BRA and RCALL (execution) instructions of the invention; Figure 94 is a flow chart of the PUSH (fetch) instructions of the invention; Flow chart of the PUSH (execute) instruction of the present invention; FIG. 96 is a POP (fetch) of the present invention Fig. 97 is a flowchart of the POP (execute) instruction of the present invention; Fig. 98 is a flowchart of the RETURN and RETFIE (retrieve) instruction of the present invention; Fig. 99 is a RETURN and RETFIE (execute) of the present invention Instructions flow chart; Figure 100 is a flowchart of the RETLW (fetch) instruction of the present invention; Figure 101 is a flowchart of the RETLW (execute) instruction of the present invention; Figure 102 is a flow of the GOTO (retrieve) instruction of the present invention Fig. 103 is a flowchart of the GOTO (execute 1) instruction of the present invention; Fig. 104 is a flowchart of the GOTO (execute 2) instruction of the present invention; Fig. 105 is a flowchart of the CALL instruction of the present invention; Fig. 106 is a flowchart of the CALL (execute 1) instruction of the present invention; Fig. 107 is a flowchart of the CALL (execute 2) instruction of the present invention; Fig. 108 is a TBLRD *, TBLRD * +, TBLRD *-and TBLRD + * (fetch) instruction flowchart; Figure 109 is a flowchart of the TBLRD *, TBLRD * +, TBLRD *-and TBLRD + * (execute 1) instructions of the present invention; 96779.doc -51-200530920 Figure 110 Series The flowchart of the TBLRD *, TBLRD * +, TBLRD *-and TBLRD + * (execute 2) instructions of the present invention; FIG. 111 shows the present invention. TBLWT *, TBLWT * +, TBLWT *-and TBLWT + * (fetch) instructions flowchart; Figure 112 is a flowchart of the TBLWT *, TBLWT * +, TBLWT *-and TBLWT + * (execute) instructions of the present invention; Figure 113 is a flowchart of the TBLWT *, TBLWT * +, TBLWT *-and TBLWT + * (execute 2) instructions of the present invention; Figure 114 is the instruction decoding map of the present invention; Figure 115 is a block of the alternate paging scheme according to the principles of the present invention Illustration. FIG. 116 is a block diagram of an alternate paging scheme according to the principles of the present invention. [Description of Symbols of Main Components] 22 Data Memory 24 CPU 26 Program Memory 34 CPU 36 Data and Program Memory 100 Microcontroller Core 102 Address Latch 104 Data Memory 106 Data Latch 108 Selection Circuit 110 Repository 112 decoder 96779.doc -52- 200530920
118 儲存庫選擇暫存器 120 FSR 121 FSR 122 FSR 124 表格鎖存器 126 IR鎖存器 128 乘積暫存器 134 硬體乘法器 136 工作(W)暫存器 140 算術與邏輯單元(ALU) 142 算術與邏輯單元(ALU) 144 指令解碼器 148 表格指標 152 ROM鎖存器 154 系統匯流排 158 資料鎖存器 160 資料或程式記憶體 162 位址鎖存器 168 程式計數器(PC) 170 堆疊 172 堆疊指標 174 資料匯流排 176 PCLATU 178 PCLATH118 Bank selection register 120 FSR 121 FSR 122 FSR 124 Table latch 126 IR latch 128 Product register 134 Hardware multiplier 136 Working (W) register 140 Arithmetic and logic unit (ALU) 142 Arithmetic and Logic Unit (ALU) 144 Instruction decoder 148 Table pointer 152 ROM latch 154 System bus 158 Data latch 160 Data or program memory 162 Address latch 168 Program counter (PC) 170 Stack 172 Stack Indicator 174 Data bus 176 PCLATU 178 PCLATH
96779.doc -53- 20053092096779.doc -53- 200530920
180 PCU 182 PCH 184 PCL180 PCU 182 PCH 184 PCL
96779.doc -54- 20053092096779.doc -54- 200530920
附件AAnnex A
96779.doc 20053092096779.doc 200530920
ADDLW :將文字添力π至W 語法:[標記]:ADDLW k 運算元:0^1^255 運算:(W)+k—W 受影響的狀態:N,OV,C,DC,Z 0000 1111 kkkk kkkk 說明:將W的内容添加至8位元文字V,並將結果置於W中。 Words : 1 週期數:1 Q週期活動:ADDLW: Add text to π to W Syntax: [Mark]: ADDLW k Operand: 0 ^ 1 ^ 255 Operation: (W) + k—W Affected states: N, OV, C, DC, Z 0000 1111 kkkk kkkk Description: Add the contents of W to the 8-bit text V and place the result in W. Words: 1 Cycles: 1 Q cycle activity:
Q1 Q2 Q3 Q4 解碼 讀取文字’k1 處理資料 寫入至W 範例:ADDLW 0x15 指令前 W=0xl0 指令後 W=0x25 ADDWF :將W添力口至f 語法··[標記]:ADDWF f,d,a 運算元:0SfS255 cK〇,l] a 畔〇,1] 運算:(W)+(f)->dest 96779.doc 200530920Q1 Q2 Q3 Q4 Decode and read the text 'k1 Processed data is written to W Example: ADDLW 0x15 Before the instruction W = 0xl0 After the instruction W = 0x25 ADDWF: Add W to f Syntax ·· [Mark]: ADDWF f, d , A operand: 0SfS255 cK〇, l] a bank 0, 1] operation: (W) + (f)-&d; dest 96779.doc 200530920
受影響的狀態:N,OV,C,DC,Z 0010 Olda ffff ffff 說明:將W添加至暫存器,f。如果’d’係0,則將結果儲存於W中。 如果’d’係1,則將結果儲存回暫存器T中(預設)。如果fa’ 係0,則將選擇虛擬儲存庫。如果’af係1,則不覆蓋BSR(預 設)。Affected states: N, OV, C, DC, Z 0010 Olda ffff ffff Description: Add W to the scratchpad, f. If 'd' is 0, the result is stored in W. If 'd' is 1, the result is stored back in register T (default). If fa ’is 0, the virtual repository will be selected. If 'af is 1, the BSR (preset) is not covered.
Words · 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器’f 處理資料 寫入至目的地 範例:ADDWF REG,0, 0 指令前 W=0xl7 REG=0xC2 指令後Words · 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decoding Read register'f Process data Write to destination Example: ADDWF REG, 0, 0 Before the instruction W = 0xl7 REG = 0xC2 After the instruction
W=0xD9 REG=0xC2 ADDWF : C將W與進位位元添力α至f 語法:[標記]ADDWFC f,d,a 運算元:0SfS255 d,,l] a,,l] 96779.doc 200530920W = 0xD9 REG = 0xC2 ADDWF: C adds W to the carry bit α to f Syntax: [Mark] ADDWFC f, d, a Operand: 0SfS255 d ,, l] a ,, l] 96779.doc 200530920
運算:(W)+(f)=(C)—dest 受影響的狀態:N,OV,C,DC,Z 0010 OOda ffff ffff 說明:添加W、Carry Flag與資料記憶體位置T。如果’df係0,則 將結果置於W中。如果’d’係1,則將結果置於資料記憶體 位置T中。如果乂係0,則將選擇虛擬儲存庫。如果’aW系1, 則不覆蓋BSR。Operation: (W) + (f) = (C) —dest Affected states: N, OV, C, DC, Z 0010 OOda ffff ffff Description: Add W, Carry Flag and data memory position T. If 'df is 0, the result is placed in W. If 'd' is 1, the result is placed in data memory location T. If it is not 0, the virtual repository will be selected. If 'aW is 1, BSR is not covered.
Words · 1 週期數:1 Q週期活動: οι Q2 Q3 04 解碼 讀取暫存器τ 處理資料 寫入至目的地 範例·· ADDWFC : REG,0, 1 指令前 進位位元=1 REG=0x02Words · 1 Cycles: 1 Q cycle activity: οι Q2 Q3 04 Decode Read register τ Process data Write to destination Example · ADDWFC: REG, 0, 1 Carry bit before instruction = 1 REG = 0x02
W=0x4D 指令後 進位位元=0 REG= 0x02 W= 0x50 ANDLW : AND文字與 W 語法:[標記]ANDLWk 96779.doc 200530920W = 0x4D Carry bit after instruction = 0 REG = 0x02 W = 0x50 ANDLW: AND text and W Syntax: [Mark] ANDLWk 96779.doc 200530920
運算元:0^1^255 運算··(W).AND.k—W 受影響的狀態:N,Z 0000 1011 kkkk kkkkOperand: 0 ^ 1 ^ 255 Operation ... (W) .AND.k—W Affected state: N, Z 0000 1011 kkkk kkkk
說明:將W的内容與8位元文字’k’進行AND運算。將結果置於W 中〇Explanation: The content of W is ANDed with the 8-bit character 'k'. Place the result in W.
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取文字’k’ 處理資料 寫入至w 範例:ANDLW 0x5F 指令前 W=0xA3 指令後 W=0x03Words: 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decode Read text ‘k’ Process data Write to w Example: ANDLW 0x5F Before instruction W = 0xA3 After instruction W = 0x03
ANDWF : AND W與 f 語法:[標記]ANDWF f,d,a 運算元:0<f^255 d,,l] a,,l]ANDWF: AND W and f Syntax: [Mark] ANDWF f, d, a Operand: 0 < f ^ 255 d ,, l] a ,, l]
運算:(W).AND· (f)—dest 受影響的狀態:N,Z 96779.doc 200530920 0001 01 da ffff ffff 說明:將w的内容與暫存器τ進行AND運算 m 又禾d係ο,則脾 ^果儲存於W中。如果,,則將結果儲存回暫存_ 中(預設)。如果V係〇,則將選擇虛擬儲存庫。如果,/ 則不覆蓋BSR(預設)。 ° &’係1,Operation: (W) .AND · (f) —dest Affected state: N, Z 96779.doc 200530920 0001 01 da ffff ffff Description: AND operation is performed on the contents of w and the register τ m and d. , The spleen fruit is stored in W. If yes, the result is stored back in staging_ (default). If V is 0, the virtual repository will be selected. If, / does not overwrite the BSR (default). ° & ’系 1,
Words · 1 週期數:1 Q週期活動: Q3Words · 1 Cycles: 1 Q Cycle Activities: Q3
^——疼理資 範例:ANDWF : REG,0, 〇 ^〜 指令前 W=0xl7 REG=0xC2 指令後 W=0x02 REG=0xC2^ —— Pay for asset management Example: ANDWF: REG, 0, 〇 ^ ~ Before the instruction W = 0xl7 REG = 0xC2 After the instruction W = 0x02 REG = 0xC2
BC :如果進位,則分支 語法:[標記]BC η 運算元:-128<η^127 運算:如果進位位元’1,,則(PC)+2+2n~>Pc 受影響的狀態:無 1110 0010 nnnn ηηηιΓ 96779.doc 200530920 說明:如果進位位元係’r,則程式將分支。 將2的補數f2n’添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words : 1 週期數:1(2) Q週期活動: 如果跳轉:BC: if carry, branch syntax: [mark] BC η operand: -128 < η ^ 127 operation: if carry bit '1, then (PC) + 2 + 2n ~> Pc Affected state: None 1110 0010 nnnn ηηηιΓ 96779.doc 200530920 Description: If the carry bit is' r, the program will branch. 2's complement f2n 'is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words: 1 Cycles: 1 (2) Q cycle activity: If jump:
Ql Q2 Q3 04 解碼 讀取文字fn’ 處理貧料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Q1 Q2 Q3 Q4 解碼 讀取文字’η’ 處理資料 無操作 範例:HERE BC 5 指令前 PC=address(HERE) 指令後 如果 Carry=l ; PC=address(HERE+12) 如果Carry=0 ; PC=address(HERE+2) BCF :清除f中的位元 語法:[標記]BCF f,b,a 運算元:0^f^255 96779.doc 200530920 0^b<7 a,,l] 運算:0—f<b> 受影響的狀態:無 1001 bbba ffff ffff 說明:清除暫存器T中的位元’b’。如果’a’係0,則將選擇虛擬儲 存庫,覆蓋BSR值。如果’a’係1,則將按照BSR值選擇該 儲存庫(預設)。Ql Q2 Q3 04 Decode read text fn 'Process lean write to PC No operation No operation No operation No operation If there is no jump: Q1 Q2 Q3 Q4 Decode read text' η 'Processing data without operation Example: HERE BC 5 instruction Before PC = address (HERE) instruction If Carry = 1; PC = address (HERE + 12) If Carry = 0; PC = address (HERE + 2) BCF: Clear bit syntax in f: [mark] BCF f , B, a Operand: 0 ^ f ^ 255 96779.doc 200530920 0 ^ b < 7 a ,, l] Operation: 0—f < b > Affected state: None 1001 bbba ffff ffff Description: Clear register Bit 'b' in T. If 'a' is 0, the virtual bank will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器τ 處理貧料 寫入暫存器’f 範例·· BCF FLAGJRJEG,7, 0 指令前 FLAG—REG=0xC7 # 指令後 FLAG_REG=0x47 BN :如果負,則分支 語法:[標記]BN η 運算元:-128Snd27 運算:如果負位元係’1’,則(PC)+2+2n—PC 受影響的狀態:無 96779.doc 200530920 1110 0110 ηηηη ηηηη 說明:如果負位元係τ,則程式將分支。 將2的補數’2η’添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words : 1 週期數:1(2) Q週期活動: 如果跳轉: οι 02 03 04 解碼 讀取文字土’ 處理資料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Q1_Q2_Q3_Q4 解碼 讀取文字’nf 處理貧料 無操作 範例:HERE BN Jump 指令前 POaddress(HERE) 指令後 如果 Negative =1 ; PC=address(Jump) 如果Negative =0 ; PC=Address(HERE+2) BNC :如果不進位,則分支 語法:[標記]BNC η 96779.doc 200530920 運算元:-128灯<127 運算··如果進位位元係’〇’,則(PC)+2+2n—PC 受影響的狀態:無 1110 0011 nnnn nnnn 說明:如果進位位元係’0’,則程式將分支。 將2的補數’2n’添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。Words: 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decoding read register τ Processing lean write register 'f Example ·· BCF FLAGJRJEG, 7, 0 FLAG—REG = 0xC7 # instruction before instruction Post FLAG_REG = 0x47 BN: If negative, branch syntax: [Mark] BN η Operand: -128Snd27 Operation: If negative bit system is '1', then (PC) + 2 + 2n—PC Affected state: None 96779.doc 200530920 1110 0110 ηηηη ηηηη Note: If the negative bit system is τ, the program will branch. 2's complement '2η' is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words: 1 Cycles: 1 (2) Q cycle activity: If jump: οι 02 03 04 Decode read text soil 'Process data written to PC No operation No operation No operation No operation If no jump: Q1_Q2_Q3_Q4 Decode read text 'nf Example of processing lean material without operation: HERE BN Jump instruction before POaddress (HERE) instruction if Negative = 1; PC = address (Jump) if Negative = 0; PC = Address (HERE + 2) BNC: if no carry, Then the branch syntax: [Mark] BNC η 96779.doc 200530920 Operand: -128 lights < 127 operation · · If the carry bit system is '〇', then (PC) + 2 + 2n—PC Affected state: None 1110 0011 nnnn nnnn Description: If the carry bit is '0', the program will branch. 2's complement '2n' is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction.
Words : 1 Φ 週期數:1(2) Q週期活動: 如果跳轉:Words: 1 Φ Number of cycles: 1 (2) Q cycle activity: If jump:
Ql Q2 Q3 Q4 解碼 讀取文字’nf 處理資料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Ql Q2 03 Q4 解碼 讀取文字’nf 處理資料 無操作 範例:HERE BNC Jump 指令前 PC=address(HERE) 指令後 如果 Carry=0 ; PC=address(Jump) 如果 Carry=l ; 96779.doc -10- 200530920 PC=address(HERE+2) BNN :如果非負,則分支 語法:[標記]ΒΝΝη 運算元:-128<fS127Ql Q2 Q3 Q4 Decode read text 'nf processed data written to PC No operation no operation No operation No operation if no jump: Ql Q2 03 Q4 Decode read text' nf processed data No operation Example: PC before HERE BNC Jump instruction = address (HERE) If Carry = 0 after the instruction; PC = address (Jump) If Carry = 1; 96779.doc -10- 200530920 PC = address (HERE + 2) BNN: If non-negative, branch syntax: [mark] ΒΝΝη Operand: -128 < fS127
運算:如果負位元係’〇’,則(PC)+2+2n—PC 受影響的狀態 :無 編石馬 · 1110 0111 nnnn nnnn 說明:如果負位元係f0f,則程式將分支。 將2的補數添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words : 1 週期數:1(2) Q週期活動: 如果跳轉: Q1 Q2 Q3 Q4 解碼 讀取文字’η’ 處理資料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Q1 Q2 Q3 Q4 解碼 讀取文字 處理資料 無操作 範例:HERE BNN Jump 指令前 PC=address(HERE) 96779.doc -11 - 200530920 指令後 如果Negative =0 ; PC=address(Jump) 如果 Negative =1 ; PC=address(HERE+2) BNV :如果不上溢,則分支 語法:[標記]BNVn 運算元:-128<η<127 運算:如果上溢位元係’0’,則(PC)+2+2n—PC 受影響的狀態:無 1110 0101 nnnn nnnn 說明:如果上溢位元係’0’,則程式將分支。 將2的補數’2nf添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。Operation: If the negative bit system is ‘〇’, then (PC) + 2 + 2n—PC Affected state: None Editing stone horse · 1110 0111 nnnn nnnn Description: If the negative bit system is f0f, the program will branch. Add 2's complement to PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words: 1 Number of cycles: 1 (2) Q cycle activity: If jump: Q1 Q2 Q3 Q4 Decode read text 'η' Process data written to PC No operation No operation No operation No operation If no jump: Q1 Q2 Q3 Q4 No operation example for decoding and reading word processing data: PC = address (HERE) 96779.doc -11-200530920 before instruction, if Negative = 0; PC = address (Jump) if Negative = 1; PC = address ( HERE + 2) BNV: if there is no overflow, branch syntax: [mark] BNVn operand: -128 < η < 127 operation: if the overflow bit is '0', then (PC) + 2 + 2n—PC Affected status: None 1110 0101 nnnn nnnn Description: If the overflow bit is '0', the program will branch. A 2's complement of 2nf is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction.
Words : 1 週期數:1(2) Q週期活動: 如果跳轉:Words: 1 Cycles: 1 (2) Q cycle activity: If jump:
Ql Q2 Q3 Q4 解碼 讀取文字 處理貢料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Q1 Q2 Q3 Q4 解碼 讀取文字’η’ 處理資料 無操作 96779.doc •12- 200530920 範例:HERE BNV Jump 指令前 POaddress(HERE) 指令後 如果 Overflow=0 ; PC=address(Jump) 如果 Overflow=l ; PC=address(HERE+2) BNZ :如果非零,則分支 語法··[標記]BNZ η 運算元·· -128<η<127 運算:如果零位元係'〇’,則(PC)+2+2n—PC 受影響的狀態:無 編石馬 · 1110 0001 nnnn nnnn 說明:如果零位元係’0’,則程式將分支。 將2的補數’2n’添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words : 1 週期數:1(2) Q週期活動: 如果跳轉:Ql Q2 Q3 Q4 Decoding and reading text processing data is written to PC No operation No operation No operation No operation If there is no jump: Q1 Q2 Q3 Q4 Decoding reading text 'η' Processing data without operation 96779.doc • 12- 200530920 Example : HERE BNV Jump instruction before POaddress (HERE) instruction If Overflow = 0; PC = address (Jump) If Overflow = 1; PC = address (HERE + 2) BNZ: If non-zero, branch syntax ·· [mark] BNZ η Operand ·· -128 < η < 127 Operation: If the zero bit system is '〇', then (PC) + 2 + 2n—PC Affected state: No stone horse · 1110 0001 nnnn nnnn Explanation: If If the zero bit is '0', the program will branch. 2's complement '2n' is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words: 1 Cycles: 1 (2) Q cycle activity: If jump:
Ql Q2 Q3 Q4 解碼 讀取文字’nf 處理資料 寫入至PC 96779.doc • 13 - 200530920 無操作 無操作 無操作 無操作 如果無跳轉 Q1 Q2 Q3 Q4 解碼 讀取文字'1^ 處理貧料 無操作 範例:HERE BNZ Jump 指令前 PC=address(HERE) 指令後Ql Q2 Q3 Q4 Decode read text 'nf Process data written to PC 96779.doc • 13-200530920 No operation No operation No operation No operation If there is no jump Q1 Q2 Q3 Q4 Decode read text' 1 ^ Processing lean material No operation Example: Before HERE BNZ Jump instruction PC = address (HERE) instruction
如果 Zero=0 ; PC=address(Jump) 如果 Zero=l ; PC=address(HERE+2) BRA :無條件分支 語法:[標記]BRA η 運算元:-1024<nS1023 運算:(PC)+2+2n->PC 0 受影響的狀態:無 1101 Onnn nnnn nnnn 說明:將2的補數’2n’添加至PC。因為PC已遞增至擷取下一指令, 故新的位址將係PC+2+2n。此指令為一二週期指令。 Words : 1 週期數:2 Q週期活動: 96779.doc 14- 200530920 Q1 Q2 Q3 Q4 解碼 讀取文字土’ 處理資料 寫入至PC 無操作 無操作 無操作 無操作 範例:HERE BRA Jump 指令前 POaddress(HERE) 指令後 PC=address(Jump) BSF :設定f中的位元 語法··[標記]BSF f,b,a 運算元·· 0^f^255 〇^b<7 a,,l] 運算:1—f<b〉 受影響的狀態:無 1000 bbba ffff ffff 說明:設定暫存器’f中的位元’b’。如果乂係0,則將選擇虛擬儲 存庫,覆蓋BSR值。如果Y係1,則將按照BSR值選擇該儲 存庫。If Zero = 0; PC = address (Jump) if Zero = 1; PC = address (HERE + 2) BRA: unconditional branch syntax: [tag] BRA η operand: -1024 < nS1023 operation: (PC) +2+ 2n- > PC 0 Affected state: None 1101 Onnn nnnn nnnn Description: Add 2's complement '2n' to the PC. Because the PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a two-cycle instruction. Words: 1 Number of cycles: 2 Q cycle activities: 96779.doc 14- 200530920 Q1 Q2 Q3 Q4 Decode and read text soil 'Process data written to PC No operation No operation No operation No operation Example: POaddress (before the HERE BRA Jump instruction HERE) After the instruction PC = address (Jump) BSF: Set the bit syntax in f ·· [marker] BSF f, b, a operand ·· 0 ^ f ^ 255 〇 ^ b < 7 a ,, l] operation : 1—f < b> Affected state: None 1000 bbba ffff ffff Description: Set bit 'b' in register 'f. If it is not 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, the bank will be selected according to the BSR value.
Words ·· 1 週期數:1 Q週期活動:Words ·· 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器 處理資料 寫入暫存器T 96779.doc -15- 200530920 範例:BSF FLAG_REG,7, 1 指令前Ql Q2 Q3 Q4 Decoding Read register Processing data Write register T 96779.doc -15- 200530920 Example: BSF FLAG_REG, 7, 1 Before the instruction
FLAG_REG=0x0A 指令後FLAG_REG = 0x0A After the instruction
FLAG_REG=0x8A BTFSC :位元測試才當案,如果清除貝跳過 語法:[標記]BTFSC f,b,a 運算元·· 〇sfS255 0邮7 a,,l] 運算:如果(f<b〉)=0則跳過 受影響的狀態:無 1011 bbba ffff ffff 說明:如果暫存器T中的位元’b’為0,則跳過下一指令。 如果位元七’為0,則捨棄在目前指令執行期間所擷取的 下一指令,並且代之以執行NOP,從而使其為一二週期指 令。如果’a’係0,則將選擇虛擬儲存庫,覆蓋BSR值。如 果’a’係1,則將按照BSR值選擇該儲存庫(預設)。FLAG_REG = 0x8A BTFSC: Only the bit test is accepted. If cleared, the syntax is skipped: [tag] BTFSC f, b, a operand · 〇sfS255 0 post 7 a ,, l] operation: if (f < b> ) = 0 Skip the affected states: None 1011 bbba ffff ffff Description: If bit 'b' in register T is 0, skip the next instruction. If bit seven 'is 0, the next instruction fetched during the current instruction execution is discarded and NOP is executed instead, making it a one- or two-cycle instruction. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動: 96779.doc -16- 200530920Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2-word instruction, it will be 3 cycles Q cycle activity: 96779.doc -16- 200530920
Ql Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 無操作 如果跳過: Ql Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Ql Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例·· HERE BTFSC FLAG,1,0 FALSE: TRUE: 指令前 PC=address(HERE) 指令後 如果 FLAG<1〉=0 ; PC=address(TRUE) 如果 FLAG<1>=1 ; POaddress(FALSE) ❿ BTFSS :位元測試稽案,如果設定貝U跳過 語法:[標記]BTFSS f,b,a 運算元:0<fS255 0<b<7 a,,l] 96779.doc -17- 200530920 運算:如果(f<b>)=l則跳過 受影響的狀態:無 1010 bbba ffff ffff 說明:如果暫存器T中的位元’b’為1,則跳過下一指令。 如果位元%’為1,則捨棄在目前指令執行期間所擷取的 下一指令,並且代之以執行NOP,從而使其為一二週期指 令。如果乂係0,則將選擇虛擬儲存庫,覆蓋BSR值。如 果乂係1,則將按照BSR值選擇該儲存庫(預設)。Ql Q2 Q3 Q4 Decode Read Register T Process data without operation if skipped: Ql Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Ql Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation example · HERE BTFSC FLAG, 1, 0 FALSE: TRUE: PC = address (HERE) before the instruction If FLAG < 1> = 0 after the instruction; PC = address (TRUE) If FLAG < 1 > = 1; POaddress (FALSE) ❿ BTFSS: bit test audit, if set U skip syntax: [tag] BTFSS f, b, a Operand: 0 < fS255 0 < b < 7 a ,, l] 96779.doc -17- 200530920 Operation: If (f < b >) = l then skip the affected states: None 1010 bbba ffff ffff Note: If bit 'b' in register T is 1, skip the next instruction. If bit% 'is 1, the next instruction fetched during the current instruction execution is discarded and NOP is executed instead, making it a one- or two-cycle instruction. If it is not 0, the virtual repository will be selected, overriding the BSR value. If it is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動:Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles Q cycle activity:
Ql Q2 03 Q4 解碼 讀取暫存器’f 處理貧料 無操作 如果跳過: Ql Q2 03 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Ql Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE BTFSS FLAG,1,0 FALSE: TRUE: 指令前 96779.doc -18- 200530920 PC=address(HERE) 指令後 如果 FLAG<1>=0 ; PC=address(FALSE) 如果 FLAG<1〉=1 ; POaddress(TRUE) BTG :觸發f的位元 語法:[標記]BTG f,b,a 運算元·· 〇sfS255 0<b<7 ae[〇,l] 運算:(/<6>)->(f<b〉) 受影響的狀態:無 0111 bbba ffff ffff 說明:反轉資料記憶體位置T中的位元七1。如果fa’係0,則將選 擇虛擬儲存庫,覆蓋BSR值。如果’a’係1,則將按照BSR 值選擇該儲存庫(預設)。Ql Q2 03 Q4 Decode read register 'f Handle lean material No operation if skipped: Ql Q2 03 Q4 No operation No operation No operation No operation If skipped and followed by 2 word instruction: Ql Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE BTFSS FLAG, 1, 0 FALSE: TRUE: Before the instruction 96779.doc -18- 200530920 PC = address (HERE) If FLAG < 1 > = after the instruction 0; PC = address (FALSE) if FLAG < 1〉 = 1; POaddress (TRUE) BTG: bit syntax to trigger f: [tag] BTG f, b, a operand ·· 〇sfS255 0 < b < 7 ae [0,1] Operation: (/ < 6 >)-> (f < b>) Affected state: None 0111 bbba ffff ffff Description: Reverses bit seven 1 in the data memory position T. If fa 'is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the repository will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: οι Q2 Q3 Q4 解碼 讀取暫存器 T 處理貧料 寫入暫存器 範例:BTG P0RTC,4, 0 96779.doc 19 200530920 指令前 PORTC=0111 0101[0x75] 指令後 PORTC=0110 0101[0x65] BV :如果上溢,則分支 語法··[標記]BV η 運算元:-128Snd27 運算:如果上溢位元為'Γ,則(PC)+2+2n—PC 受影響的狀態:無 編石馬· 1110 0100 nnnn nnnn 說明:如果上溢位元係’Γ,則程式將分支。 將2的補數’2n’添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words · 1 週期數:1(2) Q週期活動: 如果跳轉:Words: 1 Number of cycles: 1 Q cycle activity: οι Q2 Q3 Q4 Decoding read register T Processing lean write register Example: BTG P0RTC, 4, 0 96779.doc 19 200530920 PORTC = 0111 0101 before instruction 0x75] PORTC = 0110 0101 [0x65] BV: if overflow, branch syntax ·· [mark] BV η Operand: -128Snd27 Operation: If the overflow bit is' Γ, then (PC) +2+ 2n—PC Affected state: No knitting horse · 1110 0100 nnnn nnnn Description: If the overflow bit system is' Γ, the program will branch. 2's complement '2n' is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words · 1 Cycles: 1 (2) Q cycle activity: If jump:
Ql Q2 Q3 Q4 解碼 讀取文字’nf 處理資料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Q1_Q2_Q3_Q4 解碼 讀取文字’η’ 處理貧料 無操作 96779.doc -20- 200530920 範例:HERE BV Jump 指令前 POaddress(HERE) 指令後 如果 Overflow=l ; PC=address(Jump) 如果 Overflow=0; PC=address(HERE+2) BZ :如果為零,則分支 語法·[標記]BZ η 運算元:-128^1^127 運算:如果零位元係Τ,則(PC)+2+2n—PC 受影響的狀態:無 1110 0000 nnnn nnnn 說明:如果零位元係’Γ,則程式將分支。 將2的補數’2nf添加至PC。因為PC已遞增至擷取下一指 令,故新的位址將係PC+2+2n。此指令則為一二週期指令。 Words : 1 週期數:1(2) Q週期活動: 如果跳轉: 96779.doc -21 - 200530920Ql Q2 Q3 Q4 Decoded read text 'nf Processed data written to PC No operation No operation No operation No operation If there is no jump: Q1_Q2_Q3_Q4 Decode read text' η 'Process lean material No operation 96779.doc -20- 200530920 Example: HERE BV Jump instruction before POaddress (HERE) after instruction if Overflow = 1; PC = address (Jump) if Overflow = 0; PC = address (HERE + 2) BZ: if zero, branch syntax · [mark] BZ η Operand: -128 ^ 1 ^ 127 Operation: If the zero bit system is T, then (PC) + 2 + 2n—PC Affected state: None 1110 0000 nnnn nnnn Explanation: If the zero bit system is' Γ, the program Will branch. A 2's complement of 2nf is added to the PC. Because PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n. This instruction is a one or two cycle instruction. Words: 1 Number of cycles: 1 (2) Q cycle activities: If jump: 96779.doc -21-200530920
Qj_Q2_Q3_Q4 解碼 讀取文字’nf 處理資料 寫入至PC 無操作 無操作 無操作 無操作 如果無跳轉: Ql Q2 Q3 Q4 解碼 讀取文字’nf 處理貧料 無操作 範例:HERE BZ Jump 指令前 PC=address(HERE) 指令後 如果 Zero=l ; PC=address(Jump) 如果 Zero=0 ; PC=address(HERE+2) CALL :子常式呼叫 語法:[標記]CALL k,s 運算元:〇Skd048575 se[0,l] 運算:(PC)+4—TOS, k->PC<20:l>? 如果s=l (w)—ws, (STATUS)—STATUSS, 96779.doc -22- 200530920Qj_Q2_Q3_Q4 Decode read text 'nf Process data written to PC No operation No operation No operation No operation If there is no jump: Ql Q2 Q3 Q4 Decode read text' nf Processing lean material without operation Example: PC = address before the HERE BZ Jump instruction (HERE) If Zero = l; PC = address (Jump) If Zero = 0; PC = address (HERE + 2) CALL: Subroutine call syntax: [Mark] CALL k, s Operand: 〇Skd048575 se [0, l] Operation: (PC) + 4-TOS, k- > PC < 20: l >? If s = l (w) -ws, (STATUS) -STATUSS, 96779.doc -22- 200530920
(BSR)—BSRS 受影響的狀態:無(BSR) —BSRS Affected Status: None
說明:整個2M位元組記憶體範圍 位址(PC+4)推到返回堆聶μ 于吊式呼叫。首先,將返回Note: The entire 2M byte memory range address (PC + 4) is pushed to the return heap Nie μ for hanging calls. First, it will return
旦上。如果,sf=l,亦將w、STATUS 與BSR暫存器推到其個別陰影暫存器—、3丁八丁仍8與 BSRS中。如果V=〇,則無更新發生⑽設)。接著將劝位 το值’k’載入PC<20:1>中。CALL為一二週期指令。Once on. If sf = 1, the w, STATUS, and BSR registers are also pushed to their individual shadow registers — 3, 8 and 8 and BSRS. If V = 0, no update occurs). The persuasion το value 'k' is then loaded into the PC < 20: 1 >. CALL is a two-cycle instruction.
Words : 2 週期數:2 Q週期活動: 解碼 讀取文字 ,k,<7:0> ____ Q4 將PC推入至 堆疊 讀取文字 ,k,<19:8> 寫入至PC 無操作 無操作 無操作 無操作 範例:HERE CALL THERE,Fast 指令前 PC=address(HERE) 指令後 PC=address(THERE) TOS=address(HERE+4)Words: 2 Number of cycles: 2 Q cycle activity: Decode read words, k, < 7: 0 > ____ Q4 Push the PC to the stack to read the words, k, < 19: 8 > Write to PC No operation No operation No operation No operation Example: HERE CALL THERE, PC = address (HERE) before the instruction PC = address (THERE) TOS = address (HERE + 4) after the instruction
WS=WWS = W
BSRS=BSR 96779.doc -23- 200530920BSRS = BSR 96779.doc -23- 200530920
STATUSS=STATUS CLRF :清除f 語法:[標記]CLRF f,a 運算元·· 0SfS255 ae[0,l]STATUSS = STATUS CLRF: Clear f Syntax: [Mark] CLRF f, a Operand ·· 0SfS255 ae [0, l]
運算:OOOh—f 1->Z 受影響的狀態:z 0110 101a ffff ffff 說明:清除指定暫存器的内容。如果’a’係0,則將選擇虛擬儲存 庫,覆蓋BSR值。如果’a’係1,則將按照BSR值選擇該儲 存庫(預設)。Operation: OOOh—f 1- > Z Affected state: z 0110 101a ffff ffff Description: Clear the contents of the specified register. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 寫入暫存器’f 範例:CLRF FLAG_REG,1 指令前Ql Q2 Q3 Q4 Decode Read Register T Process Data Write Register ‘f Example: CLRF FLAG_REG, 1 before instruction
FLAG_REG=0x5A 指令後 FLAG REG=0x00 96779.doc -24- 200530920 CLRWDT:清除監視計時器 語〉去:[標言己]CLHWDT 運算元:無 運算:000h—WDT,000h—WDT後除器,1—历,1—兩 受影響的狀態:历,@ 編石馬· 0000 0000 0000 0100 說明:CLRWDT指令重設監視計時器。其亦重設WDT的後除器。 設定狀態位元%與两。 _FLAG_REG = 0x5A After the instruction FLAG REG = 0x00 96779.doc -24- 200530920 CLRWDT: clear watch timer words> go: [marker already] CLHWDT operand: no operation: 000h—WDT, 000h—WDT post divider, 1 —Calendar, 1—Two affected states: Calendar, @ 编 石 马 · 0000 0000 0000 0100 Description: The CLRWDT instruction resets the watchdog timer. It also resets the WDT back-divider. Set status bits% and two. _
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 無操作 處理資料 無操作Ql Q2 Q3 Q4 Decoding No operation Processing data No operation
範例:CLRWDT 指令前 WDT計數器=? 指令後 WDT計數器=0x00 WDT後除器=0 Τδ = \ PD = \ COMF :補充f 語法:[標記]COMF f,d,a 96779.doc -25- 200530920Example: WDT counter before CLRWDT instruction =? After instruction WDT counter = 0x00 WDT post divider = 0 Τδ = \ PD = \ COMF: Supplementary f Syntax: [mark] COMF f, d, a 96779.doc -25- 200530920
運算元:〇sfS255 de[0,l] ae[0?l] 運算:(/)->dest 受影響的狀態:N,Z 0001 llda ffff ffff 說明:補充暫存器’f的内容。如果fd’係0,則將結果儲存於W中。 如果’df係1,則將結果儲存回暫存器T中(預設)。如果’a’ 係0,則將選擇虛擬儲存庫,覆蓋BSR值。如果’a’係1,則 將按照BSR值選擇該儲存庫(預設)。Operand: 0sfS255 de [0, l] ae [0? L] Operation: (/)-&d; dest Affected state: N, Z 0001 llda ffff ffff Description: Supplement the contents of register 'f. If fd 'is 0, the result is stored in W. If 'df is 1, the result is stored back in register T (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: Q1_Q2_Q3_Q4_ 解碼 讀取暫存器T 處理資料 寫入至目的地 範例:COMF REG,0, 0 指令前 REG=0xl3 指令後 REG=0xl3Words: 1 Number of cycles: 1 Q cycle activity: Q1_Q2_Q3_Q4_ Decoding Read register T process data Write to destination Example: COMF REG, 0, 0 Before instruction REG = 0xl3 After instruction REG = 0xl3
W=0xEC CPFSEQ :比較f與W,如果f=W則跳過 語法:[標記]CPFSEQ f,a 96779.doc -26- 200530920 運算元:0^f^255 a,,l] 運算:⑴-(W), 如果(f)=(W)(無符號比較)則跳過 受影響的狀態:無 編石焉 · 0110 001a ffff ffff 說明··藉由執行一無符號的減法來比較資料記憶體位置’f的内容 與W的内容。 如果T=W,則捨棄所擷取的指令,並且代之以執行一 NOP,使其為一二週期指令。如果faf係0,則將選擇虛擬 儲存庫,覆蓋BSR值。如果’a’係1,則將按照BSR值選擇 該儲存庫(預設)。W = 0xEC CPFSEQ: Compare f with W, if f = W then skip syntax: [mark] CPFSEQ f, a 96779.doc -26- 200530920 Operand: 0 ^ f ^ 255 a ,, l] Operation: ⑴- (W), if (f) = (W) (unsigned comparison), then skip the affected state: unedited stone 焉 0110 001a ffff ffff Description · Compare data memory by performing an unsigned subtraction The contents of position 'f and the contents of W. If T = W, the fetched instruction is discarded, and a NOP is executed instead, making it a two-cycle instruction. If faf is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動: Q1 Q2 Q3 04 解碼 讀取暫存器’f 處理資料 無操作 如果跳過: Qi Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Qi Q2 03 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 96779.doc -27- 200530920 範例:HERE CPFSEQ REG,0 NEQUAL: EQUAL: 指令前 PC=address(HERE) W=? REG=? 指令後 如果REG=W ; PC=Address(EQUAL) 如果REG^W ; PC=Address(NEQUAL) CPFSGT :比較f與W,如果貝跳過 語法:[標記]CPFSGT f,a 運算元:0^f^255 a,,l] 運算··(f)-(W),如果⑴〉(W)(無符號比較)則跳過 受影響的狀態:無 編石馬 · 0110 010a ffff ffff 說明:藉由執行一無符號的減法來比較資料記憶體位置ff的内容 與W的内容。 如果T的内容大於W的内容,則捨棄所擷取的指令,並 且代之以執行一NOP,使其為一二週期指令。如果’aW系0, 96779.doc -28- 200530920 則將選擇虛擬儲存庫,覆蓋BSR值。如果’af係1,則將按 照BSR值選擇該儲存庫(預設)。Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles of Q cycle activity: Q1 Q2 Q3 04 Decode Read Register 'f No operation if processing data Skip: Qi Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Qi Q2 03 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation 96779.doc- 27- 200530920 Example: HERE CPFSEQ REG, 0 NEQUAL: EQUAL: Before the instruction PC = address (HERE) W =? REG =? After the instruction if REG = W; PC = Address (EQUAL) If REG ^ W; PC = Address ( NEQUAL) CPFSGT: Compare f with W, if Bie skip syntax: [mark] CPFSGT f, a operand: 0 ^ f ^ 255 a ,, l] operation · (f)-(W), if ⑴> ( W) (unsigned comparison) skips the affected states: no knitting horse · 0110 010a ffff ffff Description: Compares the contents of the data memory location ff with the contents of W by performing an unsigned subtraction. If the content of T is greater than the content of W, the fetched instruction is discarded and a NOP is executed instead, making it a two-cycle instruction. If ‘aW is 0, 96779.doc -28- 200530920, the virtual repository will be selected, overriding the BSR value. If 'af is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動:Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器’f 處理貧料 無操作 如果跳過: Ql Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Q1_Q2_Q3_Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE CPFSGT REG,0 NGREATER: GREATER: 指令前 PC=address(HERE) W=? 指令後 如果REG〉W ; POAddress(GREATER) 如果REG^W ; 96779.doc -29- 200530920 PC=Address(NGREATER) CPFSLT :比較f與W,如果f<W貝兆過 語法:[標記]CPFSLT f,a 運算元:〇Sf<255 a,,l] 運算:(f>(w),如果(f)<(W)(無符號比較)則跳過 受影響的狀態:無 編石馬 · 0110 000a ffff ffff 說明:藉由執行一無符號的減法來比較資料記憶體位置T的内容 與W的内容。 如果T的内容大於W的内容,則捨棄所擷取的指令,並 且代之以執行一NOP,使其為一二週期指令。如果乂係0, 則將選擇虛擬儲存庫,覆蓋BSR值。如果’a’係1,則將按 照BSR值選擇該儲存庫(預設)。Ql Q2 Q3 Q4 Decoding read register 'f Handle lean material No operation if skipped: Ql Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Q1_Q2_Q3_Q4 No operation No operation No Operation No operation No operation No operation No operation No operation No operation Example: HERE CPFSGT REG, 0 NGREATER: GREATER: PC = address (HERE) W =? Before the instruction If REG> W after the instruction; POAddress (GREATER) If REG ^ W; 96779 .doc -29- 200530920 PC = Address (NGREATER) CPFSLT: compare f with W, if f < W is too grammatical: [tag] CPFSLT f, a operand: 0Sf < 255 a ,, l] operation: ( f > (w), if (f) < (W) (unsigned comparison), skip the affected states: no kishima · 0110 000a ffff ffff Description: compare data by performing an unsigned subtraction The contents of the memory location T and the contents of W. If the contents of T are greater than the contents of W, the fetched instruction is discarded and a NOP is executed instead to make it a two-cycle instruction. If it is not 0, then A virtual repository will be selected, overriding the BSR value. If 'a' is 1, then BSR according to the selected value repository (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動:Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles Q cycle activity:
Qi Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 無操作 如果跳過: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 96779.doc -30- 200530920 如果跳過並繼之以2字指令:Qi Q2 Q3 Q4 Decoding Read register T processing data No operation If skipped: Q1 Q2 Q3 Q4 No operation No operation No operation No operation 96779.doc -30- 200530920 If skipped and followed by 2 word instruction:
Ql Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE CPFSLT REG,1 NLESS: LESS: 指令前Ql Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE CPFSLT REG, 1 NLESS: LESS: Before the instruction
PC=Address(HERE) W=? 指令後 如果REG<W ; PC=Address(LESS) 如果REG>W ; PC=Address(NLESS) DAW :調整W暫存器的小數 語法:[標記]DAW 運算元:無 運算:如果[W<3:0〉〉9]或[DC=1],則(W<3:0>)+6-^W<3:0> ; 否貝HW<3:0>)4W<3:0> ; 如果[\¥<7:4>〉9]或[01],貝|1(\¥<7:4>)=6->界<7:4>; 否貝UW<7:4〉)—W<7:4> ;PC = Address (HERE) W =? If REG < W after the instruction; PC = Address (LESS) If REG &W;W; PC = Address (NLESS) DAW: Adjust the decimal syntax of the W register: [mark] DAW operand : No operation: if [W < 3: 0 >> 9] or [DC = 1], then (W < 3: 0 >) + 6- ^ W < 3: 0 >; No HW < 3: 0 > ) 4W < 3: 0 >; If [\ ¥ < 7: 4 >> 9] or [01], Bay1 | (\ ¥ < 7: 4 >) = 6- > Boundary < 7: 4 >; No UW < 7: 4〉) — W < 7: 4 >;
受影響的狀態:C 96779.doc -31 - 200530920 編碼:1 0000 丨 0000 丨 0000 I 0111 說明:DAW調整W中從兩個變數(每個均為包裝BCD格式)之先前 加法得到的八位元值並且產生一正確的包裝BCD結果。 Words : 1 週期數:1 Q週期活動:Affected status: C 96779.doc -31-200530920 Code: 1 0000 丨 0000 丨 0000 I 0111 Description: DAW adjusts the octet obtained from the previous addition of two variables (each in packed BCD format) in W Value and produce a correct packed BCD result. Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器w 處理資料 寫入wQl Q2 Q3 Q4 Decode Read register w Process data Write w
範例1 : DAW 指令前 W=0xA5 C=0 DC=0 指令後 W=0x05 C=1 DC=0 範例2 : 指令前 W=0xCE C=0 DC=0 指令後 W=0x34 C=1 96779.doc -32- 200530920 DC=0 DECF ··遞減 f 語法:[標記]DECF f,d,a 運算元:0<f<255 d,,l] ae[0,l] 運算:(f>l —destExample 1: Before DAW instruction W = 0xA5 C = 0 DC = 0 After instruction W = 0x05 C = 1 DC = 0 Example 2: Before instruction W = 0xCE C = 0 DC = 0 After instruction W = 0x34 C = 1 96779. doc -32- 200530920 DC = 0 DECF ·· Decreasing f Syntax: [Mark] DECF f, d, a Operand: 0 < f < 255 d ,, l] ae [0, l] Operation: (f > l — dest
受影響的狀態:C,DC,N,OV,Z 0000 Olda ffff ffff 說明:遞減暫存器T。如果fcT係0,則將結果儲存於W中。如果’d’ 係1,則將結果儲存回暫存器T中(預設)。如果’a’係0,則 將選擇虛擬儲存庫,覆蓋BSR值。如果fa’係1,則將按照 BSR值選擇該儲存庫(預設)。Affected states: C, DC, N, OV, Z 0000 Olda ffff ffff Description: Decrement register T. If fcT is 0, the result is stored in W. If 'd' is 1, the result is stored back in the register T (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If fa ’is 1, the bank will be selected according to the BSR value (default).
Words ·· 1 週期數:1 Q週期活動:Words ·· 1 Cycles: 1 Q cycle activity:
Ql Q2 03 Q4 解碼 讀取暫存器τ 處理貧料 寫入至目的地 範例:DECF CNT,1,0 指令前 CNT=0x01 Z=0 指令後 96779.doc -33- 200530920 CNT=0x00 Z=0 DECFSZ :遞減f,如果為0,貝〇兆過 語法··[標記]DECFSZ f,d,a 運算元·· 〇SfS255 d,,l] ae[0,l] 運算:(f>l —dest,如果結果=0,則跳過 受影響的狀態:無 編石馬· 0010 1 Ida ffff ffff 說明:遞減暫存器T的内容。如果’土係0,則將結果置於W中。 如果’d’係1,則將結果放置回暫存器T中(預設)。 如果結果為0,則捨棄已擷取的下一指令,並代之以執 行一 NOP,使其為一二週期指令。如果fa’係0,則將選擇 虛擬儲存庫,覆蓋BSR值。如果Y係1,則將按照BSR值 選擇該儲存庫(預設)。Ql Q2 03 Q4 Decoding and reading register τ Processing lean write to the destination Example: DECF CNT, 1, 0 before the instruction CNT = 0x01 Z = 0 after the instruction 96779.doc -33- 200530920 CNT = 0x00 Z = 0 DECFSZ: Decrement f, if it is 0, megabytes grammar ... [mark] DECFSZ f, d, a operand 〇 SfS255 d ,, l] ae [0, l] Operation: (f > l —dest If the result = 0, then the affected state is skipped: no stone horse · 0010 1 Ida ffff ffff Description: Decrements the contents of the temporary register T. If 'Earth 0, the result is placed in W. If' If d 'is 1, the result is placed back in register T (default). If the result is 0, the next fetched instruction is discarded and a NOP is executed instead, making it a two-cycle instruction If fa 'is 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, then the repository will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動:Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器’f 處理資料 無操作 如果跳過: 96779.doc -34- 200530920Ql Q2 Q3 Q4 Decoding Read register’f Process data No operation If skipped: 96779.doc -34- 200530920
01 02 Q3 04 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE DECFSZ CNT,1,1 GOTO LOOP CONTINUE 指令前 PC=Address(HERE) 指令後 CNT=CNT-1 如果CNT=0 ; PC=Address(CONTINUE) 如果CNT^O ; PC=Address(HERE+2) DCFSNZ :遞減f,士口果3^0 ,貝兆過 語法:[標記]DCFSNZ f,d,a 運算元:0<f<255 de[05l] ae[0?l] 運算:(f>l—dest,如果結果々0,則跳過 受影響的狀態:無 說明:遞減暫存器T的内容。如果’d’係0,則將結果置於W中。 0100 llda ffff ffff 96779.doc -35- 200530920 如果’d’係1,則將結果放置回暫存器T中(預設)。 如果結果為0,則捨棄已掘取的下一指令,並代之以執 行一NOP,使其為一二週期指令。如果’a’係0,則將選擇 虛擬儲存庫,覆蓋BSR值。如果faf係1,則將按照BSR值 選擇該儲存庫(預設)。01 02 Q3 04 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Q1 Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE DECFSZ CNT, 1 , 1 GOTO LOOP CONTINUE before instruction PC = Address (HERE) after instruction CNT = CNT-1 if CNT = 0; PC = Address (CONTINUE) if CNT ^ O; PC = Address (HERE + 2) DCFSNZ: Decrement f, Mouth fruit 3 ^ 0, Bei Zhao Guo syntax: [tag] DCFSNZ f, d, a operand: 0 < f < 255 de [05l] ae [0? L] operation: (f > l-dest, if the result is 々 0, skip the affected state: no description: decrement the contents of register T. If 'd' is 0, the result is placed in W. 0100 llda ffff ffff 96779.doc -35- 200530920 If 'd 'Department 1, the result is placed back into the register T (default). If the result is 0, the next instruction that has been mined is discarded, and a NOP is executed instead, making it a two-cycle instruction. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If faf is 1, the repository will be selected according to the BSR value (default .
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器’f 處理資料 無操作 如果跳過: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Q1 02 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE DCFSNZ TEMP,1,0 ZERO: NZERO: 指令前 TEMP=? 指令後 TEMP=TEMP-1, 如果 ΤΕΜΡ=0 ; 96779.doc -36- 200530920 POAddress(ZERO) 如果 ΤΕΜΡ=0 ; POAddress(NZERO) GOTO :無條件分支 語法··[標記]GOTO k 運算元:0处<1048575 運算:k—PC<20:l> 受影響的狀態:無 編碼··第一字元(k<7:0>)第二字元(k<19:8>) 1110 1111 k7kkk kkkk〇 1111 ki9kkk kkkk kkkk8 說明:GOTO允許在整個2M位元組記憶體範圍内任何位置進行 無條件分支。將20位元值’k’載入PC<20:1>中。GOTO始終 為一二 二週期指令。 Words : 2 週期數:2 Q週期活動: Ql Q2 Q3 04 解碼 讀取文字 ,k,<7:0> 將PC推入 至堆疊 讀取文字 ,k,<19:8〉,寫 入至PC 無操作 無操作 無操作 無操作 範例:GOTO THERE 指令後 PC=Address(THERE) 96779.doc -37- 200530920 HALT :暫停處理器 語法:[標記]HALT 運算元:無 運算:處理器在HALT指令之後暫停執行 受影響的狀態:無 0000 0000 0000 0000 說明:雖然在模擬槙式中發揮功能,但暫停指令的執行將暫停 處理器的執行。.觸發HALT接針或重設(MCZi?=〇)將使裝置 脫離暫停狀態。在非模擬模式中識別不出HALT指令。 Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 (2) Remarks: If skipped, and followed by a 2 word instruction, it is a 3 cycle Q cycle activity: Q1 Q2 Q3 Q4 Decoding read register 'f No operation if processing data Skip: Q1 Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Q1 02 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE DCFSNZ TEMP , 1,0 ZERO: NZERO: TEMP before the instruction =? TEMP = TEMP-1 after the instruction, if TEMP = 0; 96779.doc -36- 200530920 POAddress (ZERO) if TESMP = 0; POAddress (NZERO) GOTO: unconditional Branch syntax ·· [mark] GOTO k operand: 0 < 1048575 Operation: k—PC < 20: l > Affected state: no encoding ·· first character (k < 7: 0 >) second Character (k < 19: 8 >) 1110 1111 k7kkk kkkk〇1111 ki9kkk kkkk kkkk8 Description: GOTO allows unconditional branching anywhere in the entire 2M byte memory range. The 20-bit value 'k' is loaded into the PC < 20: 1 >. GOTO is always a one-two two-cycle instruction. Words: 2 cycles: 2 Q cycle activities: Ql Q2 Q3 04 decode and read the text, k, < 7: 0 > push the PC into the stack to read the text, k, < 19: 8>, write to PC No operation No operation No operation No operation Example: PC = Address (THERE) after GOTO THERE instruction 96779.doc -37- 200530920 HALT: Halt processor syntax: [mark] HALT operand: No operation: processor in HALT instruction Suspended execution afterwards Affected state: None 0000 0000 0000 0000 Description: Although it functions in the simulation mode, execution of the pause instruction will suspend the execution of the processor. Triggering the HALT header or resetting (MCZi? = 〇) will take the device out of pause. The HALT instruction is not recognized in non-analog mode. Words: 1 Cycles: 1 Q cycle activity:
Qi Q2 Q3 Q4 解碼 無操作 無操作 暫停 INCF :遞增f 語法:[標記]INCF f,d,a 運算元:〇sfS255 de[0?l] ae[0,l] 運算:(f)+l->destQi Q2 Q3 Q4 Decoding no operation no operation pause INCF: increment f Syntax: [mark] INCF f, d, a Operand: 0sfS255 de [0? L] ae [0, l] Operation: (f) + l- > dest
受影響的狀態:C,DC,N,OV,Z 96779.doc -38- 200530920 0010 lOda ffff ffff 說明:遞增暫存器ff的内容。如果’d’係0,則將結果置於W中。 如果’d’係1,則將結果放置回暫存器T中(預設)。如果’a’ 係0,則將選擇虛擬儲存庫,覆蓋BSR值。如果faf係1,則 將按照BSR值選擇該儲存庫(預設)。Affected states: C, DC, N, OV, Z 96779.doc -38- 200530920 0010 lOda ffff ffff Description: Increment the content of register ff. If 'd' is 0, the result is placed in W. If 'd' is 1, the result is placed back in the register T (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If faf is 1, the bank will be selected according to the BSR value (default).
Words · 1 週期數:1 Q週期活動: Q1 02 Q3 04 解碼 讀取暫存器T 處理貧料 寫入至目的地 範例:INCF CNT,1,0 指令前Words · 1 Number of cycles: 1 Q cycle activity: Q1 02 Q3 04 Decoding Read register T to process lean data Write to destination Example: INCF CNT, 1, 0 Before instruction
CNT=0xFF Z=0 C=? DC=?CNT = 0xFF Z = 0 C =? DC =?
指令後 CNT=0x00 Z=1 C=1 DC=1 INCFSZ :遞增f,士口果為0 ,貝兆過 語法:[標記]INCFSZ f,d,a 運算元:0<fS255 96779.doc -39- 200530920 de[05l] ae[0,l] 運算:(f)+l->dest,如果結果#0,則跳過 受影響的狀態:無 編碼· 0011 llda ffff ffff 說明:遞減暫存器T的内容。如果fd’係0,則將結果置於W中。 如果fd’係1,則將結果放置回暫存器T中(預設)。 如果結果為0,則捨棄已擷取的下一指令,並代之以執 行一NOP,使其為一二週期指令。如果’a’係0,則將選擇 虛擬儲存庫,覆蓋BSR值。如果Y係1,則將按照BSR值 選擇該儲存庫(預設)。After the instruction, CNT = 0x00, Z = 1, C = 1, DC = 1, INCFSZ: Increment f, and the fruit is 0. The syntax is: [Mark] INCFSZ f, d, a Operand: 0 < fS255 96779.doc -39 -200530920 de [05l] ae [0, l] Operation: (f) + l- &d; dest, if the result is # 0, then the affected state is skipped: No coding · 0011 llda ffff ffff Description: Decrement register T content. If fd 'is 0, the result is placed in W. If fd 'is 1, the result is placed back in the register T (default). If the result is 0, the next fetched instruction is discarded and a NOP is executed instead, making it a one or two cycle instruction. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一2字指令,則為3週期 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 無操作 如果跳過: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Q1_Q2_Q3_Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE INCFSZ CNT,1,0 96779.doc -40- 200530920 NZERO: ZERO: 指令前 PC=Address(HERE) 指令後 CNT=CNT+1 如果CNT=0 ;Words: 1 Cycles: 1 (2) Remarks: If skipped, and followed by a 2 word instruction, it will be 3 cycles of Q cycle activity: Q1 Q2 Q3 Q4 Decoding read register T processing data no operation if skip Over: Q1 Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction: Q1_Q2_Q3_Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE INCFSZ CNT, 1, 0 96779.doc -40- 200530920 NZERO: ZERO: PC = Address (HERE) before the instruction CNT = CNT + 1 if the CNT = 0;
PC=Address(ZERO) If CNT^O; PC=Address(NZERO) INFSNZ ··遞增f,如果非為0,則跳過 語法:[標記]INFSNZ f,d,a 運算元:〇sf<255 de[0?l] ae[0,l] 運算:(f)+l->dest,如果結果#0,則跳過 受影響的狀態:無 編石馬· 0100 10da ffff ffff 說明:遞減暫存器T的内容。如果’d’係0,則將結果置於W中。 如果’d’係1,則將結果放置回暫存器T中(預設)。 如果結果為0,則捨棄已擷取的下一指令,並代之以執 行一 NOP,使其為一二週期指令。如果V係0,則將選擇 96779.doc -41 - 200530920 虛擬儲存庫,覆蓋BSR值。如果’a’係1,則將按照BSR值 選擇該儲存庫(預設)。PC = Address (ZERO) If CNT ^ O; PC = Address (NZERO) INFSNZ ·· Increment f, if it is not 0, skip syntax: [tag] INFSNZ f, d, a Operand: 0sf < 255 de [0? L] ae [0, l] Operation: (f) + l- &d; dest, if the result is # 0, then the affected state is skipped: no stone horse · 0100 10da ffff ffff Description: Decrement temporary storage Contents of the device T. If 'd' is 0, the result is placed in W. If 'd' is 1, the result is placed back in the register T (default). If the result is 0, the next fetched instruction is discarded and a NOP is executed instead, making it a one or two cycle instruction. If V is 0, the 96779.doc -41-200530920 virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1(2) 備註:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動: Q1_Q2_Q3_Q4_Words: 1 Cycles: 1 (2) Remarks: If skipped and followed by a 2 word instruction, it will be 3 cycles Q cycle activity: Q1_Q2_Q3_Q4_
解碼 讀取暫存器 處理資料 無操作 T 如果跳過: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 如果跳過並繼之以2字指令: Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE INFSNZ REG,1,0 ZERO: NZERO: 指令前 POAddress(HERE) 指令後 REG=REG+1, 如果REG々0 ; PC=Address(NZERO) 如果REG=0 ; 96779.doc -42- 200530920 PC=Address(ZERO) IORLW :將文字與W進行内含式OR運算 語法:[標記]IORLWk 運算元:0^1^255Decode and read register processing data without operation T If skipped: Q1 Q2 Q3 Q4 No operation No operation No operation No operation If skipped and followed by 2 word instruction: Q1 Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE INFSNZ REG, 1, 0 ZERO: NZERO: POAddress (HERE) before the instruction REG = REG + 1 after the instruction, if REG々0; PC = Address (NZERO) if the REG = 0 ; 96779.doc -42- 200530920 PC = Address (ZERO) IORLW: Integer OR operation between text and W Syntax: [Mark] IORLWk Operand: 0 ^ 1 ^ 255
運算:(W)· OR· k—WOperation: (W) · OR · k—W
受影響的狀態:N,Z 0000 1001 kkkk kkkkAffected status: N, Z 0000 1001 kkkk kkkk
說明··將W的内容與八位元文字V進行OR運算。將結果置於W 中。Explanation ... OR the contents of W and the octet character V. Place the result in W.
Words ·· 1 週期數:1 Q週期活動:Words ·· 1 Cycles: 1 Q cycle activity:
Qi Q2 Q3 Q4 解碼 讀取文字T 處理貧料 寫入至w 範例·· IORLW 0x35 指令前Qi Q2 Q3 Q4 Decode Read text T Process poor data Write to w Example · IORLW 0x35 Before instruction
W=0x9A 指令後After W = 0x9A instruction
W=0xBF IORWF :將W與f進行内含式OR運算 語法:[標記]IORWF f,d,a 運算元·· 〇sfS255 96779.doc -43- 200530920 de[0?l] ae[0,l]W = 0xBF IORWF: W and f are included in the OR operation. Syntax: [label] IORWF f, d, a operand ... 〇sfS255 96779.doc -43- 200530920 de [0? L] ae [0, l ]
運算:(W).OR.(f)—dest 受影響的狀態:N,Z 0001 OOda ffff ffff 說明:將W與暫存器T進行内含式OR運算。如果’d’係0,則將結 果置於W中。如果係1,則將結果放置回暫存器T中(預 設)。如果faf係0,則將選擇虛擬儲存庫,覆蓋BSR值。如 果Y係1,則將按照BSR值選擇該儲存庫(預設)。Operation: (W) .OR. (F) —dest Affected state: N, Z 0001 OOda ffff ffff Description: Performs an OR operation on W and the register T. If 'd' is 0, the result is placed in W. If it is 1, the result is placed back in the register T (default). If faf is 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, the bank will be selected according to the BSR value (default).
Words · 1 週期數:1 Q週期活動:Words · 1 cycle: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 寫入至目的地 範例:IORWF RESULT,0, 1 指令前 RESULT=0xl3 W=0x91 指令後 RESULT=0xl3 W=0x93 MOVF :移動f 語法:[標記]MOVF f,d,a 96779.doc -44- 200530920Ql Q2 Q3 Q4 Decode and read register T process data to write to the destination Example: IORWF RESULT, 0, 1 Before instruction RESULT = 0xl3 W = 0x91 After instruction RESULT = 0xl3 W = 0x93 MOVF: Move f Syntax: [Mark ] MOVF f, d, a 96779.doc -44- 200530920
運算元:〇SfS255 de[05l] ae[0?l] 運算:f->dest 受影響的狀態:N,Z 0101 OOda ffff ffff 說明:根據’d’的狀態將暫存器T的内容移動至一目的地。如果’d’ 係0,則將結果置於W中。如果’士係1,則將結果放置回暫 存器’f中(預設)。位置T可以係256位元組之儲存庫中的任 何位置。如果’a’係0,則將選擇虛擬儲存庫,覆蓋BSR值。 如果’a’係1,則將按照BSR值選擇該儲存庫(預設)。Operand: 〇SfS255 de [05l] ae [0? L] Operation: f- > dest Affected state: N, Z 0101 OOda ffff ffff Description: Move the contents of the register T according to the state of 'd' To a destination. If 'd' is 0, the result is placed in W. If 'Shi Department 1', the result is placed back in the register 'f (default). The position T can be any position in the 256-byte bank. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words ' 1 週期數:1 Q週期活動:Words' 1 Cycles: 1 Q cycle activity:
Qi Q2 Q3 04 解碼 讀取暫存器T 處理貧料 寫入w 範例:MOVF REG 0, 0 指令前 REG=0x22Qi Q2 Q3 04 Decoding Read register T Handle lean data Write w Example: MOVF REG 0, 0 Before instruction REG = 0x22
W=0xFF 指令後 REG=0x22 W=0x22 96779.doc -45 - 200530920 MOVFF :移動f至f 語法:[標記]MOVFF fs,fd 運算元:0<fs<4095, 0<fd^4095 運算:(fs)—fd 受影響的狀態:無 編石馬· 第一字元(源) 1100 ffff ffff ffffs 第二字元(目的地) 1111 ffff ffff ffffd 說明:將源暫存器,fs,的内容移動至目的地暫存器,fd,。源暫存器 fs的位置可在4096位元組資料空間(⑻仙至即仙)的任何 處’並且目的地暫存器’fd’的位置亦可在從⑼仙至砰而的 任何處。 源或目的地暫存器可為W暫存器(一有用的特殊情況)。 對於傳送一資料記憶體位置至一周邊暫存器(例如傳送 暫存器或一I/O埠),MOVFF係特別有用。 MOVFF指令無法使用PCL、TOSU、TOSH或TOSL作為 目的地暫存器。After W = 0xFF instruction, REG = 0x22 W = 0x22 96779.doc -45-200530920 MOVFF: Move f to f Syntax: [Mark] MOVFF fs, fd Operand: 0 < fs < 4095, 0 < fd ^ 4095 Operation: ( fs) —fd Affected state: No stone horse · First character (source) 1100 ffff ffff ffffs Second character (destination) 1111 ffff ffff ffffd Description: Move the contents of the source register, fs, To the destination register, fd. The location of the source register fs can be anywhere in the 4096-byte data space (Xianxian to Jixian) ', and the location of the destination register' fd 'can also be anywhere from Xingxian to Bang. The source or destination register can be a W register (a useful special case). MOVFF is particularly useful for transferring a data memory location to a peripheral register (such as a transfer register or an I / O port). The MOVFF instruction cannot use PCL, TOSU, TOSH, or TOSL as destination registers.
Words : 2 週期數:2(3) Q週期活動: 解碼 讀取暫存器|f(src) 處理資料 Q4 無操作 解碼 無操作 無虛設讀取 無操作 寫入暫存器ff(dest) 96779.doc 200530920 範例:MOVFF REGl,REG2 指令前 REGl=0x33 REG2=0xll 指令後 REGl=0x33, REG2=0x33Words: 2 Number of cycles: 2 (3) Q cycle activity: decode read register | f (src) process data Q4 no operation decode no operation no dummy read no operation write to register ff (dest) 96779. doc 200530920 Example: MOVFF REGl, REG1 = 0x33 before REG2, REG2 = 0xll, REGl = 0x33, REG2 = 0x33 after instruction
MOVLB :移動文字至BSR中的下半位元組 語法:[標記]MO VLB k 運算元·· 0^1^255MOVLB: Move text to the lower nibble in BSR Syntax: [Mark] MO VLB k Operand ·· 0 ^ 1 ^ 255
運算:k—BSR 受影響的狀態:無 0000 0001 kkkk kkkkOperation: k—BSR Affected state: None 0000 0001 kkkk kkkk
說明:將8位元文字1k’載入儲存庫選擇暫存器(BSR)。 Words · 1 週期數:1 Q週期活動:Description: Load 8-bit text 1k ’into the bank selection register (BSR). Words · 1 cycle: 1 Q cycle activity:
Q1 Q2 Q3 Q4 解碼 讀取文字’kf 處理資料 寫入文字 ’k,至 BSR 範例:MOVLB 5 指令前 BSR暫存器=0x02 96779.doc -47- 200530920 指令後 BSR暫存器=〇x〇5 LFSR :移動文字至FSR 語法:[標記]LFSR f,k 運算元:〇sfS2 0<k<4095 運算:k->FSRf 受影響的狀態:無 編碼: 1110 1110 OOff Knkkk 1111 0000 k7kkk kkkk 說明:將12位元文字,k,載入,f所指向的檔案選擇暫存器。 Words : 2 週期數:2 Q週期活動:Q1 Q2 Q3 Q4 Decode and read text 'kf Process data write text' k to BSR Example: MOVLB 5 BSR register before instruction = 0x02 96779.doc -47- 200530920 BSR register after instruction = 0x〇5 LFSR: Move text to FSR Syntax: [Mark] LFSR f, k Operand: 0sfS2 0 < k < 4095 Operation: k- > FSRf Affected state: No coding: 1110 1110 OOff Knkkk 1111 0000 k7kkk kkkk Description: Load the 12-bit text, k, load, and file pointed by f to the register. Words: 2 Cycles: 2 Q cycle activities:
解碼 讀取文字1’MSB Xi__ 處理資料 Q4 寫入文字V MSB至FSRfH 解碼 讀取文 處理資料 寫入文字V至FSRfL 範例·· LFSR2, 0χ3ΑΒ 指令後Decode Read text 1’MSB Xi__ Process data Q4 Write text V MSB to FSRfH Decode Read text Process data Write text V to FSRfL Example · LFSR2, 0χ3ΑΒ After the instruction
FSR2H=0x03FSR2H = 0x03
FSR2L=0xAB MOVLW :移動文字至W 語法:[標記]MOVLWk 96779.doc -48- 200530920 運算元:0^1^255 運算:k->W 受影響的狀態:無 0000 1110 kkkk kkkk 說明:將八位元文字’k’載入W。FSR2L = 0xAB MOVLW: Move text to W Syntax: [Mark] MOVLWk 96779.doc -48- 200530920 Operand: 0 ^ 1 ^ 255 Operation: k- > W Affected state: None 0000 1110 kkkk kkkk Explanation: will The octet literal 'k' is loaded into W.
Words : 1 週期數:1 Q週期活動: Q1_Q2_Q3_Q4Words: 1 cycle number: 1 Q cycle activity: Q1_Q2_Q3_Q4
解碼 讀取文字’k’ 處理資料 寫入至WDecode Read text 'k' Process data Write to W
範例:MOVLW 0x5A 指令後Example: After MOVLW 0x5A instruction
W=0x5A MOVWF :移動W至f 語法:[標記]MOVWF f,a 運算元:〇sf<255 ae[0,l] 運算:(W) 受影響的狀態:無 0110 1101a ffff ffff 說明:將資料從W移動至暫存器T。位置’f可以係256位元組之 儲存庫中的任何位置。如果fa’係0,則將選擇虛擬儲存庫, 覆蓋BSR值。如果’a’=l,則將按照BSR值選擇該儲存庫(預 96779.doc -49- 200530920 設)。W = 0x5A MOVWF: Move W to f Syntax: [Mark] MOVWF f, a Operand: 0sf < 255 ae [0, l] Operation: (W) Affected state: None 0110 1101a ffff ffff Description: Data Move from W to register T. Position 'f can be any position in the 256-byte bank. If fa 'is 0, the virtual repository will be selected, overriding the BSR value. If 'a' = 1, the repository will be selected according to the BSR value (pre-set 96779.doc -49- 200530920).
Words · 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器’f 處理貧料 寫入暫存器’f 範例:MOVWF REG,0 指令前 W=0x4F #Words · 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decoding Read register ‘f Process poor data Write register’ f Example: MOVWF REG, 0 before the instruction W = 0x4F #
REG=0xFF 指令後 W=0x4F REG=0x4F MULLW :將文字乘以W 語法:[標記]MULLWk 運算元:0%255 ·After REG = 0xFF instruction W = 0x4F REG = 0x4F MULLW: Multiply text by W Syntax: [Mark] MULLWk Operand: 0% 255 ·
運算:(W)xk—PRODH:PRODL 受影響的狀態:無 編石馬· 0000 1101 kkkk kkkk 說明:在W的内容與8位元文字T之間執行一無符號乘法。將16 位元結果置於PRODH:PRODL暫存器對中。PRODH包含 高位元組。W不變。 狀態旗標皆不受影響。應注意,在此操作中不可能有 96779.doc -50- 200530920 上溢與進位。可能會有零結果,但偵測不到。 Words · 1 週期數:1 Q週期活動:Operation: (W) xk—PRODH: PRODL Affected state: None. Shima · 0000 1101 kkkk kkkk Description: Perform an unsigned multiplication between the content of W and the 8-bit text T. Place the 16-bit result in the PRODH: PRODL register pair. PRODH contains high-order bytes. W is unchanged. None of the status flags are affected. It should be noted that it is not possible to have 96779.doc -50- 200530920 overflow and carry in this operation. There may be zero results, but they are not detected. Words · 1 cycle: 1 Q cycle activity:
Q1 Q2 03 Q4 解碼 讀取文字’k’ 處理資料 寫入暫存器PRODH:PRODL 範例:MULLW 0xC4 指令前 W=0xE2 φ PRODH=? PRODL=? 指令後 W=0xE2Q1 Q2 03 Q4 Decode Read text ‘k’ Process data Write to register PRODH: PRODL Example: MULLW 0xC4 Before instruction W = 0xE2 φ PRODH =? PRODL =? After instruction W = 0xE2
PRODH=OxAD PRODL=0x08 MULWF ··將 W乘以 f Φ 語法:[標記]MULWF f,a 運算元:0^ί^255 ae[0,l]PRODH = OxAD PRODL = 0x08 MULWF ·· Multiply W by f Φ Syntax: [Mark] MULWF f, a Operand: 0 ^ ί ^ 255 ae [0, l]
運算:(W)x(f) ~>PRODH:PRODL 受影響的狀態:無 0000 001a ffff ffff 說明:在W的内容與暫存器檔案位置T之間執行一無符號乘法。 96779.doc -51 - 200530920 將丨6位元結果儲存於PR〇DH:PR〇DL暫存器對中。 PRODH包含高位心。不變。狀態旗標皆不受影 響應'主思,在此操作中不可能有上溢與進位。可能會 有零^果,但偵測不到。如果,a,係〇,則將選擇虛擬财子 庫後盖BSR值。如果,a,=:i,則將按照BSR值選擇該儲存 庫(預設)。Operation: (W) x (f) ~> PRODH: PRODL Affected state: None 0000 001a ffff ffff Description: Perform an unsigned multiplication between the contents of W and the register file position T. 96779.doc -51-200530920 Store the 6-bit result in the PRODH: PRODL register pair. PRODH contains a high mind. constant. The status flags are not affected. Respond to the main idea, there is no overflow or carry in this operation. There may be no results, but no detection. If, a, is 0, the BSR value of the back cover of the virtual wealth subbank will be selected. If a, =: i, the repository will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: Q1 Q2 _ -1-| 寫入暫存器PRODH:PRODr^ 範例:MULWF REG,1 指令前 W=0xC4 REG=0xB5 PRODH=? PRODL=? 指令後 W=0xC4 REG=0xB5Words: 1 Cycles: 1 Q Cycle Activity: Q1 Q2 _ -1- | Write to register PRODH: PRODr ^ Example: MULWF REG, 1 before instruction W = 0xC4 REG = 0xB5 PRODH =? PRODL =? After instruction W = 0xC4 REG = 0xB5
PRODH=Ox8A PRODL=Ox94 NEGF :否定f 96779.doc • 52 · 200530920 語法··[標記]NEGF f,a 運算元:0SfS255 ae[0,l] 運算:(7)+l—fPRODH = Ox8A PRODL = Ox94 NEGF: Negative f 96779.doc • 52 · 200530920 Syntax · [Mark] NEGF f, a Operand: 0SfS255 ae [0, l] Operation: (7) + l—f
受影響的狀態:N,OV,C,DC,Z 編石馬· 0110 110a ffff ffff 說明:使用二的補數來否定位置’f。將結果置於資料記憶體位置 T中。如果’a’係0,則將選擇虛擬儲存庫,覆蓋BSR值。 如果,則將按照BSR值選擇該儲存庫。Affected states: N, OV, C, DC, Z. Shima · 0110 110a ffff ffff Description: Use two's complement to negate the position 'f. Place the result in data memory location T. If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If so, the repository will be selected according to the BSR value.
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器’f 處理貧料 寫入暫存器’f 範例:NEGF REG,1 指令前 REG=0011 1010[0x3A] 指令後 REG=1100 0110[0xC6] NOP :無操作 語法:[標記]NOP 運算元:無 運算:無操作 96779.doc -53- 200530920 受影響的狀態:無 編石馬·Words: 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decode read register 'f Process lean write register' f Example: NEGF REG, 1 before instruction REG = 0011 1010 [0x3A] After instruction REG = 1100 0110 [0xC6] NOP: no operation syntax: [mark] NOP operand: no operation: no operation 96779.doc -53- 200530920 Affected status: no stone horse
0000 0000 0000 0000 1111 XXXX XXXX XXXX 說明:無操作。0000 0000 0000 0000 1111 XXXX XXXX XXXX Description: No operation.
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4Words: 1 Cycles: 1 Q Cycle Activities: Q1 Q2 Q3 Q4
解碼 丨無操作 |無操作 丨無操作 範例:無。 POP :取出返回堆疊的頂部 語法:[標記]POP 運算元:無 運算:(TOS)—位元桶 受影響的狀態:無 編碼:1 0000 1 0000 1 0000 1 Olio 說明:從返回堆疊拉出TOS值並捨棄。TOS值接著變為被推入返 回堆叠的前一值。 提供此指令,以使使用者正確地管理返回堆疊,以併 入一軟體堆疊。Decoding 丨 No operation | No operation 丨 No operation Example: None. POP: Remove the top of the stack. Syntax: [Mark] POP Operand: No operation: (TOS) —Bit bucket Affected state: No coding: 1 0000 1 0000 1 0000 1 Olio Description: Pull TOS from the return stack Value and discard. The TOS value then becomes the previous value that was pushed back into the stack. This instruction is provided so that the user properly manages the return stack to merge into a software stack.
Words : 1 週期數:1 Q週期活動: 96779.doc -54- 200530920Words: 1 Cycles: 1 Q cycle activities: 96779.doc -54- 200530920
Q1 Q2 03 04 解碼 無操作 POP T0S值 無操作 範例:POPQ1 Q2 03 04 Decode No operation POP T0S value No operation Example: POP
GOTO NEW 指令前 TOS=0031A2hTOS = 0031A2h before GOTO NEW instruction
Stack(lolevel down)=014332h 指令後 TOS=014332h #Stack (lolevel down) = 014332h After instruction TOS = 014332h #
PONEWPONEW
PUSH :推入返回堆疊的頂部 語法··[標記]PUSH 運算元:無 運算:(PC+2) —TOS 受影響的狀態:無 編石馬 · 0000 0000 0000 0101 說明:將PC+2推入返回堆疊的頂部。將前一 TOS值向下推入該 堆疊。 此指令允許藉由修改T0S來實施一軟體堆疊,然後將其 推到返回堆疊上。PUSH: Push back to the top of the stack. Syntax [Mark] PUSH Operand: No operation: (PC + 2) —TOS Affected state: No stone horse. 0000 0000 0000 0101 Description: Push PC + 2 Return to the top of the stack. Push the previous TOS value down into the stack. This instruction allows a software stack to be implemented by modifying TOS and then pushing it onto the return stack.
Words : 1 週期數:1 Q週期活動: 96779.doc -55- 200530920 Q1 Q2 Q3 04 解碼 將PC+2推到返回堆疊上 無操作 無操作Words: 1 Cycles: 1 Q cycle activity: 96779.doc -55- 200530920 Q1 Q2 Q3 04 Decoding Push PC + 2 back to the stack No operation No operation
範例:PUSH 指令前 TOS=00345Ah PC=000124h 指令後 PC=000126h TOS=000126hExample: Before PUSH instruction TOS = 00345Ah PC = 000124h After instruction PC = 000126h TOS = 000126h
Stack(l level down)=00345Ah 態:無 1101 lnnn nnnn nnnn RCALL :分支次常式 語法:[標記]RCALLn 運算元:-1024<η<1023 運算:(PC)+2—TOS,(PC)+2+2n->PC 受影響的狀 編石馬·· 說明:從目前位置跳轉高達1K之次常式呼叫。首先,將返回位 址(PC+2)推到堆疊上。然後,將2的補數’2n’添加至PC。 因為PC已遞增至擷取下一指令,故新的位址將係 PC+2+2n 〇 itb 指♦為一 〇Stack (l level down) = 00345Ah State: None 1101 lnnn nnnn nnnn RCALL: branch subroutine syntax: [mark] RCALLn operand: -1024 < η < 1023 operation: (PC) + 2—TOS, (PC) + 2 + 2n- > PC affected stone horses Description: Jump to the next normal call up to 1K from the current position. First, push the return address (PC + 2) onto the stack. Then, 2's complement '2n' is added to the PC. Because the PC has been incremented to fetch the next instruction, the new address will be PC + 2 + 2n 〇 itb means ♦ is a 〇
Words : 1 週期數:2 Q週期活動: 96779.doc -56- 200530920 Q1 02 Q ,3 Q4 解碼 讀取文字fn’ 將PC推動至堆疊 處理資料 寫入至PC 無操作 無操作 無操作 無操作 範例·· HERE RCALL Jump 指令前 PC=Address(HERE) 指令後 PC=Address(Jump) TOS=Address(HERE+2) RESET :重設 語法:[標記]RESET 運算元:無 運算:重設受一^^重設影響的所有暫存器與旗標。 受影響的狀態:全部 0000 0000 1111 1111 說明:此指令提供一以軟體執行重設的方式。 Words · 1 週期數:1 Q週期活動: Q1 02 Q3 Q4 解碼 開始重設 無操作 無操作Words: 1 Number of cycles: 2 Q cycle activities: 96779.doc -56- 200530920 Q1 02 Q, 3 Q4 Decode and read the text fn 'Push the PC to the stack to process the data to write to the PC No operation No operation No operation No operation No operation example ·· PC = Address (HERE) before the HERE RCALL Jump instruction PC = Address (Jump) TOS = Address (HERE + 2) after the instruction RESET: Reset Syntax: [Mark] RESET Operand: None Operation: Reset is subject to ^ ^ Reset all registers and flags affected. Affected states: All 0000 0000 1111 1111 Description: This command provides a way to perform reset by software. Words · 1 Cycles: 1 Q Cycle Activity: Q1 02 Q3 Q4 Decoding Start reset No operation No operation
範例:RESET 指令後 96779.doc -57- 200530920Example: After RESET instruction 96779.doc -57- 200530920
Registers:重設值 Flags*=重設值 RETFIE ··從中斷返回 語法:[標記]RETFIE s 運算元:se[0.1] 運算:(TOS)^PC, 1 ->GIE/GIEH 或 PEIE/GIEL 如果s = 1 (WS) —W, (STATUSS)->STATIS, (BSRS)aBSR, PCLATU、PCLATH不變。 受影響的狀態:GIE/GIEH、PEIE/GIEL、STATUS reg。 0000 0000 0001 000s 說明:從中斷返回。對堆疊進行取出操作,並將堆疊頂部(TOS) 載入PC。藉由設定高或低優先權全域中斷致動位元來致 動中斷。如果’s,==l,影子暫存器的内容ws、STATUSS及 BSRS會載入其對應暫存器w、STATUS及BSR。如果 V=0,則此等暫存器不發生更新(預設)。Registers: Reset value Flags * = Reset value RETFIE ·· Return from interrupt Syntax: [Mark] RETFIE s Operand: se [0.1] Operation: (TOS) ^ PC, 1-> GIE / GIEH or PEIE / GIEL If s = 1 (WS) —W, (STATUSS)-> STATIS, (BSRS) aBSR, PCLATU and PCLATH remain unchanged. Affected states: GIE / GIEH, PEIE / GIEL, STATUS reg. 0000 0000 0001 000s Description: Return from interrupt. Remove the stack and load the top of the stack (TOS) into the PC. Interrupts are initiated by setting high or low priority global interrupt enable bits. If 's, == l, the contents of the shadow register ws, STATUSS and BSRS will be loaded into their corresponding registers w, STATUS and BSR. If V = 0, these registers are not updated (default).
Words : 1 週期數:2 Q週期活動: 96779.doc • 58 - 200530920 Q1 02 〇3_ Q4 解碼 無操作 無操作 從堆疊取出PC 設定GIEH或GIEL 無操作 無操作 操作 無操作 範例:RETFIE Fast 指令後Words: 1 Number of cycles: 2 Q cycle activities: 96779.doc • 58-200530920 Q1 02 〇3_ Q4 Decode No operation No operation Remove PC from the stack Set GIEH or GIEL No operation No operation Operation No operation Example: After the RETFIE Fast instruction
PC=TOS w=ws BSR=BSRS STATUS=STATUSS GIE/GIEH,PEIE/GIEL=1 RLCF :透過進位向左旋轉f 語法:[標記]RLCF f,d,a 運算元:〇^f^255 de[0,l] ae[0,l] 運算:(f<n>)4dest<n+1>,(f<7>)—c,(c) 4dest<〇> 受影響的狀態:C,N,Z 編石馬· ~oo 11 r〇Td^~\Jm I ffff 說明 如果PC = TOS w = ws BSR = BSRS STATUS = STATUSS GIE / GIEH, PEIE / GIEL = 1 RLCF: Rotate f to the left by carry Syntax: [Mark] RLCF f, d, a Operand: 〇 ^ f ^ 255 de [ 0, l] ae [0, l] Operation: (f < n >) 4dest < n + 1 >, (f < 7 >)-c, (c) 4dest < 〇 > Affected states: C, N , Z 石 石 马 · ~ oo 11 r〇Td ^ ~ \ Jm I ffff
透過進位旗標將暫存器T的内容向左旋轉 係〇,則將結果置於w中。如果w係1,則將結果健存 存器Τ中(預設)。如果’a’係0,則將選擇虛擬儲存庫,痒 BSR值。如果’a’=l,則將按照BSR值選擇該儲存庫(預額 96779.doc -59- 200530920Rotate the contents of the register T to the left by the carry flag through the carry flag, and the result is placed in w. If w is 1, the result is stored in the memory T (default). If 'a' is 0, the virtual repository will be selected and the BSR value will be ticked. If ‘a’ = l, the repository will be selected according to the BSR value (pre-emption 96779.doc -59- 200530920
cSi 暫存器f—HcSi register f—H
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Qi Q2 03 Q4 解碼 讀取暫存器T 處理資料 寫入至目的地 範例:RLCF REG,0, 0 指令前Qi Q2 03 Q4 Decode Read register T to process data Write to destination Example: RLCF REG, 0, 0 Before the instruction
REG=1110 0110 C=0 指令後 REG=1110 0110 W=1100 1100 C=1 RLNCF:向左旋轉f(無進位)REG = 1110 0110 C = 0 After the instruction REG = 1110 0110 W = 1100 1100 C = 1 RLNCF: rotate f to the left (no carry)
語法:[標記]RLNCF f,d,a 運算元:0^f^255 de[0,l] aG[0,l]Syntax: [Mark] RLNCF f, d, a Operand: 0 ^ f ^ 255 de [0, l] aG [0, l]
運算:(f<n〉)~>dest<n+l〉,(f<7>)->dest<0> 受影響的狀態:N,Z 0100 Olda ffff ffff 96779.doc -60· 200530920 說明:透過進位旗標將暫存器的内容向左旋轉一位元。如果’d’ 係0,則將結果置於W中。如果fd’係1,則將結果儲存回暫 存器τ中(預設)。如果乂係〇,則將選擇虛擬儲存庫,覆蓋 BSR值。如果1,則將按照BSR值選擇該儲存庫(預設)。 pH暫存器FkiOperation: (f < n>) ~ > dest < n + l>, (f < 7 >)-&d; dest < 0 > Affected state: N, Z 0100 Olda ffff ffff 96779.doc -60 · 200530920 Explanation: Use the carry flag to rotate the contents of the register one bit to the left. If 'd' is 0, the result is placed in W. If fd 'is 1, the result is stored back in the register τ (default). If it is not 0, the virtual repository will be selected, overriding the BSR value. If 1, the repository will be selected according to the BSR value (default). pH register Fki
Words · 1 週期數:1 Q週期活動:Words · 1 cycle: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器’f 處理資料 寫入至目的地 範例:RLNCF REG,1,0 指令前 REG=1010 1011 指令後 REG=0101 0111Ql Q2 Q3 Q4 Decoding Read register’f Process data Write to destination Example: RNLCF REG, 1, 0 Before the instruction REG = 1010 1011 After the instruction REG = 0101 0111
RRCF :透過進位向右旋轉f 語法:[標記]RRCF f,d,a 運算元:0^f^255 de[0,l] ae[0,l]RRCF: Rotate f right by carry Syntax: [Mark] RRCF f, d, a Operand: 0 ^ f ^ 255 de [0, l] ae [0, l]
運算:(f<n〉)->dest<n-l〉,(f<0〉)->C,(C)->dest<7> 受影響的狀態:C,N,Z 0011 OOda ffff ffff 96779.doc -61 - 200530920 說明:透過進位旗標將暫存器T的内容向左旋轉一位元。如果’d’ 係0,則將結果置於W中。如果’df係1,則將結果儲存回暫 存器T中(預設)。如果fa’係0,則將選擇虛擬儲存庫,覆蓋 BSR值。如果’a’= 1,則將按照BSR值選擇該儲存庫(預設)。 H1K 暫存器fOperation: (f < n>)-> dest < nl〉, (f < 0>)-> C, (C)-> dest < 7 > Affected states: C, N, Z 0011 OOda ffff ffff 96779.doc -61-200530920 Description: Use the carry flag to rotate the contents of the register T one bit to the left. If 'd' is 0, the result is placed in W. If 'df is 1, the result is stored back in register T (default). If fa 'is 0, the virtual repository will be selected, overriding the BSR value. If 'a' = 1, the repository will be selected according to the BSR value (default). H1K register f
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 寫入至目的地 範例:RRCF REG,0, 0 指令前 REG=1110 0110 C=0 指令後 REG=1110 0110 W=0111 0011 C=0 RRNCF :向右旋轉f(無進位) 語法:[標記]RRNCF f,d,a 運算元:〇sfS255 dE[0,l] ae[0,l] 96779.doc -62- 200530920 運算:(f<n〉)~^dest<n+l〉,(f<0〉)->dest<7> 受影響的狀態:N,Z 編石馬· 0100 OOda ffff ffff 說明:透過進位旗標將暫存器〒的内容向左旋轉一位元。如果fd’ 係0,則將結果置於W中。如果’士係1,則將結果儲存回暫 存器T中(預設)。如果’a’係0,則將選擇虛擬儲存庫,覆蓋 BSR值。如果fa’=l,則將按照BSR值選擇該儲存庫(預設)。 f 暫存器.Ql Q2 Q3 Q4 Decode and read register T process data to write to the destination Example: RRCF REG, 0, 0 REG = 1110 0110 before the instruction C = 0 REG = 1110 0110 W = 0111 0011 after the instruction C = 0 RRNCF: Rotate f (without carry) to the right Syntax: [Mark] RRNCF f, d, a Operand: 0sfS255 dE [0, l] ae [0, l] 96779.doc -62- 200530920 Operation: (f < n> ) ~ ^ Dest < n + l〉, (f < 0〉)-&d; dest < 7 > Affected states: N, Z Stone horse · 0100 OOda ffff ffff Description: Register will be saved by the carry flag 〒 The content is rotated one bit to the left. If fd 'is 0, the result is placed in W. If ′ is Department 1, the result is stored back in register T (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If fa '= l, the repository will be selected according to the BSR value (default). f Register.
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Qi Q2 Q3 Q4 解碼 讀取暫存器τ 處理資料 寫入至目的地 範例 1 : RRNCF REG,1,0 指令前 REG=1101 0111 指令後 REG=1110 1011 範例2 : RRNCF REG,0, 0 指令前 W=? REG=1101 0111 指令後 W=1110 1011 96779.doc -63- 200530920 REG=1101 0111 SETF :設定f 語法:[標記]SETF f,a 運算元:〇sf<255 de[0,l] ae[0,l]Qi Q2 Q3 Q4 Decode and read register τ Processing data is written to the destination Example 1: RRNCF REG, 1, 0 REG before the command = 1101 0111 REG after the command = 1110 1011 Example 2: RRNCF REG, 0, 0 before the command W =? REG = 1101 0111 After the instruction W = 1110 1011 96779.doc -63- 200530920 REG = 1101 0111 SETF: Set f Syntax: [Mark] SETF f, a Operand: 0sf < 255 de [0, l] ae [0, l]
運算:FFh->f 受影響的狀態:無 0110 100a ffff ffff 說明:將指定暫存器之内容設定為FFh。如果fa’係0,則將選擇 虛擬儲存庫,覆蓋BSR值。如果Y係1,則將按照BSR值 選擇該儲存庫(預設)。Operation: FFh- > f Affected state: None 0110 100a ffff ffff Description: Set the content of the specified register to FFh. If fa 'is 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 03 Q4 解碼 讀取暫存器’f 處理資料 寫入暫存器’f 範例:SETF REG,1 指令前Ql Q2 03 Q4 Decode Read Register ‘f Process Data Write Register’ f Example: SETF REG, 1 before instruction
REG=0x5A 指令後After REG = 0x5A instruction
REG=0xFF 96779.doc -64- 200530920 SLEEP :進入SLEEP模式 語法··[標記]SLEEP 運算元:無 0000 0000 0000 0011 運算:OOh — WDT、0—WDT後除器、、0 —兩 受影響的狀態:¥5 編石馬 · 說明:清除省電狀態位元(%)。設定超時狀態位元(ra)。清除監 視計時器及其後除器。 使處理器進入SLEEP模式,同時停用振盪器。REG = 0xFF 96779.doc -64- 200530920 SLEEP: Enter SLEEP mode syntax ... [mark] SLEEP operand: None 0000 0000 0000 0011 Operation: OOh — WDT, 0 — WDT post-divider, 0 — both affected Status: ¥ 5 Editing Stone Horse Description: Clear the power saving status bit (%). Set the timeout status bit (ra). Clear the watchdog timer and its divider. Put the processor into SLEEP mode and disable the oscillator.
Words · 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 無操作 處理資料 進入睡眠狀態Words · 1 Cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decoding No operation Processing data Go to sleep
範例:SLEEP 指令前 ΊΌ=Ί ρό=ί 指令後 ΊΌ = \ + PD=0 +如果WDT引起喚醒,則清除此位元 SUBFWB :使用借位從W減去f 96779.doc -65- 200530920 語法:[標記]SUBFWB f,d,a 運算元:〇sfS255 de[0,l] ae[0?l]Example: Before the SLEEP instruction ΊΌ = Ί ρό = ί After the instruction ΊΌ = \ + PD = 0 + If WDT causes wake-up, clear this bit SUBFWB: Use borrow to subtract f 96779.doc -65- 200530920 Syntax: [Label] SUBFWB f, d, a operand: 〇sfS255 de [0, l] ae [0? L]
運算:(W)-(f)-(0)->dest 受影響的狀態:N,OV,C,DC,Z 編石馬 · 0101 01 da ffff ffff 說明:從W減去暫存器T與進位旗標(借位)(2的補數方法)。如果 ,d’係0,則將結果儲存於W中。如果fd’係1,則將結果儲存 於暫存器T中(預設)。如果faf係0,則將選擇虛擬儲存庫, 覆蓋BSR值。如果Y係1,則將按照BSR值選擇該儲存庫 (預設)。Operation: (W)-(f)-(0)-&d; dest Affected states: N, OV, C, DC, Z. Shima · 0101 01 da ffff ffff Description: Subtract register T from W With carry flag (borrow) (2's complement method). If, d 'is 0, the result is stored in W. If fd 'is 1, the result is stored in the register T (default). If faf is 0, the virtual repository will be selected, overriding the BSR value. If Y is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Ql Q2 Q3 04 解碼 讀取暫存器T 處理資料 寫入至目的地Ql Q2 Q3 04 Decode Read register T Process data Write to destination
SUBFWB 範例 1 : SUBFWB REG,1,0 指令前 REG=3 W=2 C=1 96779.doc -66- 200530920 指令後SUBFWB Example 1: SUBFWB REG, 1, 0 Before the instruction REG = 3 W = 2 C = 1 96779.doc -66- 200530920 After the instruction
REG=FF W=2 C=0 Z=0REG = FF W = 2 C = 0 Z = 0
N=1 ;結果為負 範例2 : SUBFWB REG,0, 0 指令前 REG=2 W=5 C=1 指令後 REG=2 W=3 C=1N = 1; The result is negative Example 2: SUBFWB REG, 0, 0 Before the instruction REG = 2 W = 5 C = 1 After the instruction REG = 2 W = 3 C = 1
z=o N=0,結果為正 範例 3 : SUBFWB REG,1,0 指令前 REG=1 W=2 C=0 指令後 REG=0 96779.doc -67- 200530920 W=2 C=1 Z= 1,結果為零 N=0 SUBLW :從文字減去W 語法:[標記]SUBLWk 運算元:0^1^255 運算:k-(W)->W 受影響的狀態:N,OV,C,DC,Z 編石馬· 0000 1000 kkkk kkkk 說明:從八位元文字’k’減去W。將結果置於W中。 Words · 1 週期數:1 Q週期活動:z = o N = 0, the result is positive Example 3: SUBFWB REG, 1, 0 REG = 1 before the instruction = W = 2 C = 0 REG = 0 after the instruction = 96779.doc -67- 200530920 W = 2 C = 1 = 1, the result is zero N = 0 SUBLW: Subtract W from text Syntax: [Mark] SUBLWk Operand: 0 ^ 1 ^ 255 Operation: k- (W)-> W Affected states: N, OV, C , DC, Z Editing Shima · 0000 1000 kkkk kkkk Description: Subtract W from the octet text 'k'. Place the result in W. Words · 1 cycle: 1 Q cycle activity:
Qi Q2 Q3 Q4 解碼 讀取文字’k’ 處理資料 寫入至W 範例 1 : SUBLW0x02 指令前 W=1 〇? 指令後 W=1 C=1 ;結果為正 -68- 96779.doc 200530920 z=o N=0 範例2 : SUBLW 0x02 指令前 W=2 C=? 指令後 w=oQi Q2 Q3 Q4 Decode and read the text 'k' Processing data is written to W Example 1: SUBLW0x02 W = 1 before the instruction ○? W = 1 C = 1 after the instruction; the result is positive -68- 96779.doc 200530920 z = o N = 0 Example 2: SUBLW 0x02 W = 2 before the instruction C =? W = o after the instruction
C=1 ;結果為零 Z=1 N=0 範例3 : SUBLW 0x02 指令前 W=3 C=?C = 1; the result is zero Z = 1 N = 0 Example 3: SUBLW 0x02 W = 3 before the instruction C =?
指令後 W=FF ; (2的補數) c=o,結果為負 z=o N=1 SUBWF :從f減去W 語法:[標記]SUBWF f,d,a 運算元·· 0^f^255 96779.doc -69- 200530920 de[0,l] ae [0,1] 運算:(f)-(W)->destAfter the instruction W = FF; (2's complement) c = o, the result is negative z = o N = 1 SUBWF: Subtract W from f Syntax: [Mark] SUBWF f, d, a Operand ·· 0 ^ f ^ 255 96779.doc -69- 200530920 de [0, l] ae [0,1] Operation: (f)-(W)-&d; dest
受影響的狀態:N,OV,C,DC,Z 0101 llda ffff ffff 說明:從暫存器’f減去W(2的補數方法)。如果’d’係0,則將結果 儲存於W中。如果’d’係1,則將結果儲存回暫存器T中(預 設)。如果’a’係0,則將選擇虛擬儲存庫,覆蓋BSR值。如 果’a’係1,則將按照BSR值選擇該儲存庫(預設)。Affected states: N, OV, C, DC, Z 0101 llda ffff ffff Description: Subtract W (2's complement method) from register 'f. If 'd' is 0, the result is stored in W. If 'd' is 1, the result is stored back in register T (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器T 處理資料 寫入至目的地 範例 1 : SUBWF REG,1,0 指令前 REG=3 W=2 O? 指令後 REG=1 W=2 C=1 ;結果為正 z=o 96779.doc -70- 200530920 N=0 範例2 : SUBWF REG,0, 0 指令前 REG=2 W=2 C=? 指令後 REG=2 W=0 C=1 ;結果為零 ζ=ι N=0 範例 3 : SUB WF REG,1,0 指令前 REG=1 W=2 C=? 指令後 REG=FFh ; (2 的補數) W=2 c=o,結果為負 z=o N=l 96779.doc 200530920 SUBWFB :使用借位從f減去W 語法:[標記]SUBWFB f,d,a 運算元:〇sf<255 de[0?l] ae[0?l]Words: 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decode and read register T process data to write to the destination Example 1: SUBWF REG, 1, 0 REG = 3 before the instruction W = 2 O? After the instruction REG = 1 W = 2 C = 1; The result is positive z = o 96779.doc -70- 200530920 N = 0 Example 2: SUBWF REG, 0, 0 REG = 2 before the instruction W = 2 C =? REG = after the instruction 2 W = 0 C = 1; the result is zero ζ = ι N = 0 Example 3: SUB WF REG, 1, 0 REG = 1 before the instruction W = 2 C =? REG = FFh after the instruction; (2's complement) W = 2 c = o, the result is negative z = o N = l 96779.doc 200530920 SUBWFB: Subtract W from f using borrowing Syntax: [Mark] SUBWFB f, d, a Operand: 0sf < 255 de [ 0? L] ae [0? L]
運算:(f>(WH5)->dest 受影響的狀態:N,OV,C,DC,Z 0101 10da ffff ffff 說明:從暫存器T減去W與進位旗標(借位)(2的補數方法)。如果 係0,則將結果儲存於W中。如果’d’係1,貝將結果儲存 回暫存器T中(預設)。如果’a’係0,則將選擇虛擬儲存庫, 覆蓋BSR值。如果’a’係1,則將按照BSR值選擇該儲存庫 (預設)。Operation: (f > (WH5)-&d; dest Affected states: N, OV, C, DC, Z 0101 10da ffff ffff Description: Subtract W and carry flag (borrow) from register T (2) Complement method). If it is 0, the result is stored in W. If 'd' is 1, Beck stores the result back to register T (default). If 'a' is 0, it will be selected Virtual repository, which overrides the BSR value. If 'a' is 1, the repository will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動:Words: 1 Cycles: 1 Q cycle activity:
Qi Q2 Q3 04 解碼 讀取暫存器’f 處理資料 寫入至目的地Qi Q2 Q3 04 Decoding Read register’f Process data Write to destination
SUBWFB 範例 1 : SUBWFB REG,1,0 指令前 REG=0xl9 (0001 1001) W=0x0D (0000 1101) 96779.doc -72- 200530920 c=i 指令後 REG=0x0C (0000 1011) W=0x0D (0000 1101) C=1 Z=0SUBWFB Example 1: SUBWFB REG, 1, 0 REG = 0xl9 (0001 1001) W = 0x0D (0000 1101) 96779.doc -72- 200530920 c = i REG = 0x0C (0000 1011) W = 0x0D (0000 1101) C = 1 Z = 0
N=0,結果為正 範例2 : SUBWFB REG, 0, 0 指令前 REG=0xlB (0001 1011) W=0xlA(0001 1010) C=0 指令後 REG=0xlB (0001 1011) W=0x00N = 0, the result is positive Example 2: SUBWFB REG, 0, 0 Before the instruction REG = 0xlB (0001 1011) W = 0xlA (0001 1010) C = 0 After the instruction REG = 0xlB (0001 1011) W = 0x00
C=1 Z= 1,結果為零 N=0 範例3 : SUBWFB REG,1,0 指令前 REG二0x03 (0000 0011) W=0x0E (0000 1101) C=1 指令後 96779.doc -73- 200530920 REG=0xF5 (1111 0100) (2的補數) W=0x0E (0000 1101) C=0 Z=0 N=1 ;結果為負 SWAPF :交換f 語法:[標記]SWAPF f,d,a 運算元:0SfS255 de[0?l] ae[0?l] 運算··(f<3:0〉)->dest<7:4〉,(f<7:4>)4dest<3:0〉 受影響的狀態:無 0011 10da ffff ffff 說明:交換暫存器,f的上半與下半位元組。如果fd’係0,則將結 果置於W中。如果W係1,則將結果置於暫存器T中(預 設)。如果Y係0,則將選擇虛擬儲存庫,覆蓋BSR值。如 果’af係1,則將按照BSR值選擇該儲存庫(預設)。C = 1 Z = 1, the result is zero N = 0 Example 3: SUBWFB REG, 1, 0 REG before the instruction 0x03 (0000 0011) W = 0x0E (0000 1101) C = 1 after the instruction 96779.doc -73- 200530920 REG = 0xF5 (1111 0100) (2's complement) W = 0x0E (0000 1101) C = 0 Z = 0 N = 1; the result is negative SWAPF: exchange f syntax: [mark] SWAPF f, d, a operand : 0SfS255 de [0? L] ae [0? L] operation ·· (f < 3: 0〉)-> dest < 7: 4〉, (f < 7: 4 >) 4dest < 3: 0> accept Affected state: None 0011 10da ffff ffff Description: Swap the register, the upper and lower nibble of f. If fd 'is 0, the result is placed in W. If W is 1, the result is placed in register T (default). If Y is 0, the virtual repository will be selected, overriding the BSR value. If 'af is 1, the bank will be selected according to the BSR value (default).
Words : 1 週期數:1 Q週期活動: Q1 Q2 Q3 Q4 解碼 讀取暫存器T 處理貧料 寫入至目的地 範例 1 : SWAPF REG,1,0 96779.doc -74- 200530920 指令前 REG=0x53 指令後 REG=0x35 TBLRD :表格讀取 語法:[標記]TBLRD (*;*+;*-,+*) 運算元:無 運算:如果TBLRD*,貝丨“Prog Mem (TBLPTR)) ^TABLAT ; TBLPTR-無變化; 如果 TBLRD*+,則(Prog Mem (TBLPTR)) ->TABLAT ; (TBLPTR)+1^TBLPTR ; 如果TBLRD*-,貝丨J(Pr〇g Mem (TBLPTR)) ->TABLAT ; (TBLPTR)-1->TBLPTR ; 如果TBLRD+*,則(TBLPTR)+1—TBLPTR ; (Prog Mem (TBLPTR)) ->TABLAT ; 受影響的狀態:無 編碼: 0000 0000 0000 10nn nm=0* =1*+ =2*- =3+* 說明·· TBLRD指令有四個選項決定21位元表格指標(TBLPTR)發 生的情況:無變化、後遞增、後遞減與預遞增。決定目 前的選項,並適當地修改TBLPTR,並將TBLPTR所指向 96779.doc -75- 200530920 的程式記憶體位置之内容載入8位元表格鎖存器 (TABLAT)。TBLPTR的LSb選擇將讀取哪種類型的程式記 憶體位置。如果LSb=l,將高位元組載入TABLAT。如果 LSb=0,將低位元組載入TABLAT 〇 Words : 1 週期數:2 Q週期活動:Words: 1 Number of cycles: 1 Q cycle activity: Q1 Q2 Q3 Q4 Decoding read register T Processing lean data to write to the destination Example 1: SWAPF REG, 1, 0 96779.doc -74- 200530920 REG = before instruction 0x53 REG = 0x35 after instruction TBLRD: Table read syntax: [Mark] TBLRD (*; * +; *-, + *) Operand: No operation: If TBRRD *, "Prog Mem (TBLPTR)) ^ TABLAT TBLPTR- no change; if TBLRD * +, then (Prog Mem (TBLPTR))-> TABLAT; (TBLPTR) + 1 ^ TBLPTR; if TBRRD *-, J (Pr0g Mem (TBLPTR))- >TABLAT; (TBLPTR) -1- >TBLPTR; if TBLRD + *, then (TBLPTR) + 1-TBLPTR; (Prog Mem (TBLPTR))->TABLAT; Affected status: No coding: 0000 0000 0000 10nn nm = 0 * = 1 * + = 2 *-= 3 + * Explanation ·· The TBLRD instruction has four options to determine what happens to the 21-bit table index (TBLPTR): no change, post-increment, post-decrement, and pre-increment . Decide the current option, modify TBLPTR appropriately, and load the contents of the program memory location pointed by TBLPTR to 96779.doc -75- 200530920 into the 8-bit table latch (TA BLAT). The LSb of TBLPTR selects which type of program memory location will be read. If LSb = 1, load the high byte into TABLAT. If LSb = 0, load the low byte into TABLAT 〇Words: 1 number of cycles : 2 Q cycle activities:
Qi Q2 03 04 解碼 無操作 無操作 無操作 無操作 無操作 無操作 無操作 (位址匯流排上 的表格指標) (涵變低) TABLAT 更新 TBLRD :表格讀取 範例 1 : TBLRD *+; 指令前 TABLAT=0x55 · TBLPTR=0x00A358 MEMORY(OxOOA356)=Ox34 指令後 TABLAT=0x34 TBLPTR=0x00A357 範例2 : TBLRD +* ; 指令前Qi Q2 03 04 Decoding No operation No operation No operation No operation No operation No operation No operation No operation (Operation on the table of the address bus) (Han becomes low) TABLAT Update TBLRD: Table reading example 1: TBLRD * +; Before the instruction TABLAT = 0x55 · TBLPTR = 0x00A358 MEMORY (OxOOA356) = Ox34 After the instruction TABLAT = 0x34 TBLPTR = 0x00A357 Example 2: TBLRD + *; Before the instruction
TABLAT=0xAA 96779.doc -76- 200530920 TBLPTR=0x01A357 MEMORY(0x01A357)=0xl2 MEMORY(0x01A358)=0x34 指令後 TABLAT=0x34 TBLPTR=0x01A358 TBLWT :表格寫入 語法:[標記]TBLWT (*;*+;*-,+*) 運算元:無 運算:如果TBLWT*,(TABLAT)-»(ProgMem(TBLPTR); TBLPTR-無變化; 如果TBLWT*+,(TABLAT)->(Pr〇g Mem (TBLPTR); (TBLPTR)+1 ->TBLPTR ; 如果 TBLWT*-,(TABLAT)-> (Prog Mem (TBLPTR); (TBLPTR)-l ->TBLPTR ; 如果 TBLWT+*,(TBLPTR)+1 -> TBLPTR ; (TABLAT) ->Prog Mem(TBLPTR); 受影響的狀態:無 編碼: 0000 0000 0000 linn ηη=0* =1 *+ =2*-=3+* 說明:TBLWT指令有四種選擇決定21位元表格指標(TBLPTR)發 96779.doc -77- 200530920 生的情況··無變化、後遞增、後遞減與預遞增。決定目 前的選項,並適當地修改TBLPTR。 將表格鎖存器(TABLAT)的内容寫入TBLPTR所指向的 程式記憶體位置。 如果丁BLPTR指向一外部程式記憶體位置,貝〇亥指令分 兩個週期執行。 因為TABLAT僅係一位元組寬,因此必須執行二的倍數 之TBLWT指令,以程式化内部記憶體位置。例如,如果 將裝置定義成一次程式化一字,則按下列方式程式化一 内部記憶體位置: 1) 將TBLPTR設定為一偶數類型TABLAT = 0xAA 96779.doc -76- 200530920 TBLPTR = 0x01A357 MEMORY (0x01A357) = 0xl2 MEMORY (0x01A358) = 0x34 TABLAT = 0x34 TBLPTR = 0x01A358 TBLWT: Table write syntax: [Mark] TBLWT (*; * +; *-, + *) Operand: No operation: If TBLWT *, (TABLAT)-»(ProgMem (TBLPTR); TBLPTR-No change; if TBLWT * +, (TABLAT)-> (Pr〇g Mem (TBLPTR ); (TBLPTR) +1->TBLPTR; if TBLWT *-, (TABLAT)-> (Prog Mem (TBLPTR); (TBLPTR) -l->TBLPTR; if TBLWT + *, (TBLPTR) +1- >TBLPTR; (TABLAT)-> Prog Mem (TBLPTR); Affected status: No coding: 0000 0000 0000 linn ηη = 0 * = 1 * + = 2 *-= 3 + * Explanation: There are four TBLWT instructions The choice determines the 21-bit table index (TBLPTR) issue 96779.doc -77- 200530920. No change, post-increment, post-decrement, and pre-increment. Decide on the current options and modify the TBLPTR appropriately. Lock the table The contents of the register (TABLAT) are written into the program memory location pointed to by TBLPTR. If the BLPTR is pointed to an external program memory location, the Bayer instruction is executed in two cycles. Because TABLAT is only one byte wide, you must execute a multiple of two TBLWT instructions to program the internal memory location. For example, if you define the device as one word at a time, program an internal memory as follows Body position: 1) Set TBLPTR to an even number type
2) 將低位元組寫入TABLAT 3) 執行TBLWT*+ (2週期)2) Write low byte to TABLAT 3) Execute TBLWT * + (2 cycles)
4) 將高位元組寫入TABLAT 5) 執行TBLWT*+ (長寫入) 當接收到一中斷時,終止對一内部EPROM位置的長寫 入。後遞增TBLWT指令係推薦用於内部記憶體寫入的唯 一TBLWT指令。(唯有64或更多接針之裝置才能使用對内 部EPROM的寫入。)4) Write high byte to TABLAT 5) Execute TBLWT * + (long write) When an interrupt is received, long write to an internal EPROM location is terminated. The post-increment TBLWT instruction is the only TBLWT instruction recommended for internal memory writes. (Only devices with 64 or more pins can use the internal EPROM.)
Words : 1 TBLWT表格寫入 週期數:2 (如果長寫入係針對EPROM程式記憶體,則需許多週 期) 96779.doc -78- 200530920 Q週期活動:Words: 1 TBLWT table write cycle number: 2 (If long write is for EPROM program memory, it takes many cycles) 96779.doc -78- 200530920 Q cycle activities:
Ql Q2 Q3 04 解碼 無操作 無操作 無操作 無操作 無操作 無操作 無操作 (位址匯流排上的 (位址匯流排上的表格 表格指標) 鎖存器,·變低) 範例 1 : TBLWT *+; 指令前Ql Q2 Q3 04 Decode No operation No operation No operation No operation No operation No operation No operation No operation (Operation on the address bus (Table table index on the address bus) Latch, · Go low) Example 1: TBLWT * +; Before order
TABLAT=0x55 TBLPTR=0x00A356 MEMORY(OxOOA356)=OxFF 指令後(表格寫入完成) TABLAT=0x55 TBLPTR=0x00A357 MEMORY(OxOOA356)=Ox55 範例2 : TBLWT +*; 指令前TABLAT = 0x55 TBLPTR = 0x00A356 MEMORY (OxOOA356) = OxFF After the instruction (table writing is completed) TABLAT = 0x55 TBLPTR = 0x00A357 MEMORY (OxOOA356) = Ox55 Example 2: TBLWT + *; before the instruction
TABLAT=0x34 TBLPTR=0x01389A MEMORY(OxO 13 89B)=0xFF MEMORY(0x01389A)=0xFF 指令後(表格寫入完成) TABLAT=0x34 TBLPTR=0x01389B MEMORY(OxO 13 89 A)=0xFF 96779.doc -79 200530920 MEMORY(0x01389B)=0x34 TRAP :調試次常式呼叫 語法··[標記]TRAP 運算元:無TABLAT = 0x34 TBLPTR = 0x01389A MEMORY (OxO 13 89B) = 0xFF MEMORY (0x01389A) = 0xFF After the instruction (table writing is completed) TABLAT = 0x34 TBLPTR = 0x01389B MEMORY (OxO 13 89 A) = 0xFF 96779.doc -79 200530920 MEMORY (0x01389B) = 0x34 TRAP: debug subnormal call syntax ·· [mark] TRAP operand: None
運算:(PC)+2->TOS,000028h->PC<20:l> 受影響的狀態:INBUG 0000 0000 1110 0000 說明:將陷阱調試到〇〇〇28h。首先,將返回位址(PC+2)推到返 回堆疊上。接著將20位元值’000028h’載入PC<20:1>中。 設定INBUG狀態位元。TRAP為一二週期指令。Operation: (PC) + 2- > TOS, 000028h- > PC < 20: l > Affected state: INBUG 0000 0000 1110 0000 Description: Debug the trap to 0028h. First, push the return address (PC + 2) onto the return stack. The 20-bit value '000028h' is then loaded into the PC < 20: 1 >. Set the INBUG status bit. TRAP is a two-cycle instruction.
Words : 1 週期數:2 Q週期活動:Words: 1 Cycles: 2 Q cycle activities:
Ql 02 Q3 04 解碼 將PC推動至堆疊 無操作 將000028h寫入PC 無操作 無操作 無操作 無操作Ql 02 Q3 04 Decoding Push PC to stack No operation Write 000028h to PC No operation No operation No operation No operation
範例:HERE TRAP 指令前 PC=Address(HERE) 指令後 PC=000028h TOS=Address(HERE+2) INBUG=1 96779.doc -80- 200530920Example: Before HERE TRAP instruction PC = Address (HERE) After instruction PC = 000028h TOS = Address (HERE + 2) INBUG = 1 96779.doc -80- 200530920
TRET :自次常式之陷阱返回 語法··[標記]TRET 運算元:無 運算:(T〇s)->PC PCLATU、PCLATH不變 受影響的狀態:INBUG 編碼: 0000 0000 1110 0001 說明:從調試陷阱返回。堆疊進行取出操作,並將堆疊頂部(TOS) 載入程式計數器。清除INBUG狀態位元。TRET: Trap return syntax from the next normal ... [Mark] TRET operand: no operation: (T〇s)-> PC PCLATU, PCLATH is not affected Affected state: INBUG code: 0000 0000 1110 0001 Explanation: Return from debug trap. The stack is taken out and the top of the stack (TOS) is loaded into the program counter. Clear the INBUG status bit.
Words : 1 週期數:2 Q週期活動: Q1 Q2 03 Q4 解碼 無操作 無操作 從堆疊取出PC 無操作 無操作 無操作 無操作Words: 1 Number of cycles: 2 Q cycle activity: Q1 Q2 03 Q4 Decoding No operation No operation Remove the PC from the stack No operation No operation No operation No operation
範例:TRET 中斷後Example: After TRET interrupt
PC=TOS INBUG=0 TSTFSZ :湏ij試f, 士口果為0 ,貝兆過 語法:[標記]TSTFSZ f,a 運算元:0^0255 96779.doc -81- 200530920 a,,l] 運算:如果f=〇,則跳過 受影響的狀態:無 0110 011a ffff ffff 說明:如果τ=ο,則捨棄在目前指令執行期間所擷取的下一指 令,並且執行ΝΟΡ,從而使其為一二週期指令。如果W 係0,則將選擇虛擬儲存庫,覆蓋BSR值。如果’a’係1,則 將按照BSR值選擇該儲存庫(預設)。PC = TOS INBUG = 0 TSTFSZ: 湏 ij try f, the fruit is 0, and the grammar is over: [tag] TSTFSZ f, a Operand: 0 ^ 0255 96779.doc -81- 200530920 a ,, l] operation : If f = 〇, skip the affected state: None 0110 011a ffff ffff Description: If τ = ο, discard the next instruction fetched during the current instruction execution and execute NOP to make it a Two-cycle instruction. If W is 0, the virtual repository will be selected, overriding the BSR value. If 'a' is 1, the bank will be selected according to the BSR value (default).
Words · 1 週期數:1(2) 注意:如果跳過,並且繼之以一 2字指令,則為3週期 Q週期活動: Q1 Q2_Q3_Q4 解碼 讀取暫存器τ 處理資料 無操作 如果跳過: Q1 02 Q3 Q4 無操作無操作 無操作 無操作 如果跳過並繼之以2字指令 • Q1 Q2 Q3 Q4 無操作 無操作 無操作 無操作 無操作 無操作 無操作 無操作 範例:HERE TSTFSZ CNT,1 NZERO: ZERO: 指令前 96779.doc -82- 200530920 POAddress(HERE) 指令後 如果 CNT=0x00, POAddress(ZERO) 如果 CNT=0x00, PC=Address(NZERO) XORLW :將文字與W進行互斥式OR運算 語法:[標記]XORLWk 運算元:0处<255Words · 1 Cycles: 1 (2) Note: If skipped, followed by a 2-word instruction, it is a 3-cycle Q cycle activity: Q1 Q2_Q3_Q4 Decode Read Register τ Processing data No operation If skipped: Q1 02 Q3 Q4 No operation No operation No operation No operation If skipped and followed by a 2-word instruction • Q1 Q2 Q3 Q4 No operation No operation No operation No operation No operation No operation No operation No operation No operation Example: HERE TSTFSZ CNT, 1 NZERO: ZERO: 96779.doc before the instruction -82- 200530920 After the POAddress (HERE) instruction, if CNT = 0x00, POAddress (ZERO) If the CNT = 0x00, PC = Address (NZERO) XORLW: Mutually exclusive OR of text and W Operation syntax: [Mark] XORLWk Operand: 0 place < 255
運算··(W) .XOR. k->WOperation ·· (W) .XOR. K- > W
受影響的狀態:N,Z 0000 1010 kkkk kkkk 說明:將W的内容與8位元文字V進行X0R運算。將結果置於W 中。Affected states: N, Z 0000 1010 kkkk kkkk Description: Perform X0R operation on the content of W and the 8-bit text V. Place the result in W.
Words : 1Words: 1
週期數:1 Q週期活動:Number of cycles: 1 Q cycle activities:
Q1 Q2 Q3 Q4 解碼 讀取文字’k’ 處理資料 寫入至W 範例:XORLW OxAF 指令前 W=0xB5 指令後Q1 Q2 Q3 Q4 Decode Read text “k” Process data Write to W Example: Before XORLW OxAF instruction W = 0xB5 After instruction
W=0xlA 96779.doc -83- 200530920 XORWF:將W與f進行互斥式OR運算 語法:[標記]XORWF f,d,a 運算元:〇sfS255 de[05l] ae[0?l]W = 0xlA 96779.doc -83- 200530920 XORWF: mutually exclusive OR operation between W and f Syntax: [Mark] XORWF f, d, a Operand: 〇sfS255 de [05l] ae [0? L]
運算:(W) .XOR· (f)—dest 受影響的狀態:N,Z 0001 10da ffff ffff 說明:將W的内容與暫存器T進行互斥式OR運算。如果fd’係0, 則將結果儲存於W中。如果’d’係1,則將結果儲存回暫存 器〒中(預設)。如果’a’係0,則將選擇虛擬儲存庫,覆蓋 BSR值。如果’a1係1,則將按照BSR值選擇該儲存庫(預設)。 Words · 1 週期數:1 Q週期活動:Operation: (W) .XOR · (f) —dest Affected state: N, Z 0001 10da ffff ffff Description: Perform a mutually exclusive OR operation on the contents of W and the register T. If fd 'is 0, the result is stored in W. If 'd' is 1, the result is stored back in the scratchpad (default). If 'a' is 0, the virtual repository will be selected, overriding the BSR value. If 'a1 is 1', the repository will be selected according to the BSR value (default). Words · 1 cycle: 1 Q cycle activity:
Ql Q2 Q3 Q4 解碼 讀取暫存器T 處理貢料 寫入至目的地 範例:XORWF REG,1,0 指令前Ql Q2 Q3 Q4 Decode Read register T Process tribute Write to destination Example: XORWF REG, 1, 0 Before the instruction
REG=0xAF W=0xB5 指令後REG = 0xAF W = 0xB5 After the instruction
REG=0xlA W=0xB5 96779.doc •84-REG = 0xlA W = 0xB5 96779.doc • 84-
Claims (1)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US51391003P | 2003-10-23 | 2003-10-23 | |
US10/796,771 US7203818B2 (en) | 1999-03-26 | 2004-03-09 | Microcontroller instruction set |
Publications (2)
Publication Number | Publication Date |
---|---|
TW200530920A true TW200530920A (en) | 2005-09-16 |
TWI339354B TWI339354B (en) | 2011-03-21 |
Family
ID=37610221
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW093132265A TWI339354B (en) | 2003-10-23 | 2004-10-22 | Microcontroller instruction set |
Country Status (3)
Country | Link |
---|---|
KR (1) | KR100960095B1 (en) |
CN (1) | CN1898641B (en) |
TW (1) | TWI339354B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI426451B (en) * | 2006-08-24 | 2014-02-11 | Kernelon Silicon Inc | Work processing device |
US9495165B2 (en) | 2009-12-17 | 2016-11-15 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
TWI707272B (en) * | 2019-04-10 | 2020-10-11 | 瑞昱半導體股份有限公司 | Electronic apparatus can execute instruction and instruction executing method |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7996651B2 (en) * | 2007-11-30 | 2011-08-09 | Microchip Technology Incorporated | Enhanced microprocessor or microcontroller |
US8799552B2 (en) * | 2009-02-11 | 2014-08-05 | Microchip Technology Incorporated | Microcontroller with special banking instructions |
KR102514717B1 (en) * | 2016-10-24 | 2023-03-27 | 삼성전자주식회사 | Memory controller and memory system including the same |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6708268B1 (en) * | 1999-03-26 | 2004-03-16 | Microchip Technology Incorporated | Microcontroller instruction set |
-
2004
- 2004-10-18 KR KR1020087012887A patent/KR100960095B1/en not_active Expired - Lifetime
- 2004-10-18 CN CN200480038058.XA patent/CN1898641B/en not_active Expired - Lifetime
- 2004-10-22 TW TW093132265A patent/TWI339354B/en not_active IP Right Cessation
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI426451B (en) * | 2006-08-24 | 2014-02-11 | Kernelon Silicon Inc | Work processing device |
US9495165B2 (en) | 2009-12-17 | 2016-11-15 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
US9495166B2 (en) | 2009-12-17 | 2016-11-15 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
US9501281B2 (en) | 2009-12-17 | 2016-11-22 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
TWI575456B (en) * | 2009-12-17 | 2017-03-21 | 英特爾股份有限公司 | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
US9747105B2 (en) | 2009-12-17 | 2017-08-29 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
US10684855B2 (en) | 2009-12-17 | 2020-06-16 | Intel Corporation | Method and apparatus for performing a shift and exclusive or operation in a single instruction |
TWI707272B (en) * | 2019-04-10 | 2020-10-11 | 瑞昱半導體股份有限公司 | Electronic apparatus can execute instruction and instruction executing method |
Also Published As
Publication number | Publication date |
---|---|
KR20080053960A (en) | 2008-06-16 |
CN1898641A (en) | 2007-01-17 |
CN1898641B (en) | 2015-03-25 |
TWI339354B (en) | 2011-03-21 |
KR100960095B1 (en) | 2010-05-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6708268B1 (en) | Microcontroller instruction set | |
KR100327777B1 (en) | Data processing device using multiple instruction sets | |
CN103562856B (en) | The pattern that strides for data element is assembled and the scattered system of the pattern that strides of data element, device and method | |
CN104011647B (en) | Floating-point rounding treatment device, method, system and instruction | |
KR100328162B1 (en) | Information Processing Circuits and Microcomputers and Electronic Devices | |
TWI861131B (en) | Apparatuses, methods, and systems for instructions of a matrix operations accelerator | |
CN104145245B (en) | Floating-point rounding-off amount determines processor, method, system and instruction | |
TWI518588B (en) | Broadcast operation on mask register | |
TWI455024B (en) | Unique packed data element identification processors, methods, systems, and instructions | |
JPS6339931B2 (en) | ||
JPH0766324B2 (en) | Data processing device | |
US7546442B1 (en) | Fixed length memory to memory arithmetic and architecture for direct memory access using fixed length instructions | |
US4945511A (en) | Improved pipelined processor with two stage decoder for exchanging register values for similar operand instructions | |
EP0729605A1 (en) | Processing system with word-aligned branch target | |
JP2018500666A (en) | Method and apparatus for performing vector bit gathering | |
CN1318957C (en) | Device and method for realizing changes in program control stream | |
TW200530920A (en) | Microcontroller instruction set | |
JPH04260926A (en) | Bit retrieving circuit and data processor provided with the same | |
TWI737650B (en) | Processor, system and method for retrieving elements from a linked structure | |
EP1706817B1 (en) | Microcontroller with a virtual memory bank | |
Nelson | Computer Architecture | |
JPH0769801B2 (en) | Data processing device | |
JPS62297939A (en) | data processing equipment | |
JPH081600B2 (en) | Data processing device | |
JPH0351915A (en) | Data processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
MK4A | Expiration of patent term of an invention patent |