工作記錄 | NY4系列IC的算術邏輯單元Arithmetic Logic Unit (ALU)

The NY4 series provides a 4-bit arithmetic logic unit with a 4-bit accumulator to perform logic, unsigned arithmetic, data transfer and conditional branch operation.
NY4系列提供了一個4位算術邏輯單元,該邏輯單元帶有一個4位累加器,用於執行邏輯、無符號算術、數據傳輸和條件分支操作。
We have two flags (carry and zero) to indicate the result of the operation.
我們有兩個標誌(進位和零)來指示操作的結果。
One or two operands will be the data sources of the ALU operation.
一個或兩個操作數將是ALU操作的數據源。
The operands can be ACC, RAM, register, or literal constant data
操作數可以是acc、ram、register或literal常量數據。

1、ALU Instruction Summary---ALU指令摘要

(1)邏輯指令

(2)算術指令

(3)數據傳輸指令

The width of the memory register address ‘r’ of MVRM, MVMR, and MVLR command is 2-bit and the MSB of the memory register is forced to be 0.
MVRM、MVMR和MVLR命令的內存寄存器地址“r”的寬度爲2位,內存寄存器的msb強制爲0。
So users can only use the three commands to handle RPT0~3.
所以用戶只能使用這三個命令來處理RPT0~3。
The width of the RAM or memory register address ‘m’ of MVRM, and MVMR command is 4-bit and the MSB 2-bit of the address is forced to be 0x3.
MVRM和MVMR命令的RAM或內存寄存器地址“m”的寬度爲4位,地址的msb 2位強制爲0x3。
Users can only use the two instructions to handle RAM or memory register of address 0x30~0x3F, but the RAM page is still working.
用戶只能使用這兩條指令來處理地址0x30~0x3F的RAM或內存寄存器,但RAM頁仍在工作。

(4)條件分支指令

A conditional branch instruction compares two data and skips next instruction if they are equal. The skip operation is making an instruction NOP, not jump across it.
條件分支指令比較兩個數據,如果它們相等,則跳過下一個指令。跳過操作即生成一個指令nop,而不是跳過它。

2、ALU Related Status Flag---ALU相關狀態標誌

符號 標誌 說明
C 進位標誌

C=1,加法操作後產生進位

C=0,減法操作後產生借位

Z 零標誌 Z=1,算術操作後結果爲0

Besides RSTC and SETC commands directly assign the value of the carry flag, C is influenced by the arithmetic result.
除了RSTC和SETC命令直接分配進位標誌的值之外,C還受算術結果的影響。
C means carry and also means the complement of borrow.
C表示進位,也表示借位。
If the addition operation larger than 0xF, C=1, and C=0 if the result ≦15.
如果加法運算大於0xF,則C=1,如果結果小於15,則C=0。
If the subtraction operation smaller than 0, C=0, and C=1 if the result ≧0.
如果減法運算小於0,則C=0,如果結果≥0,則C=1。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章