• 沒有找到結果。

14.1 Overview of Word logic instructions

Description

Word logic instructions compare pairs of words (16 bits) and double words (32 bits) bit by bit, according to Boolean logic.

If the result at output OUT does not equal 0, bit CC 1 of the status word is set to

"1".

If the result at output OUT does equal 0, bit CC 1 of the status word is set to "0".

The following word logic instructions are available:

• WAND_W (Word) AND Word

• WOR_W (Word) OR Word

• WXOR_W (Word) Exclusive OR Word

• WAND_DW (Word) AND Double Word

• WOR_DW (Word) OR Double Word

• WXOR_DW (Word) Exclusive OR Double Word

长沙工控帮教育科技有限公司整理

14.2 WAND_W (Word) AND Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 WORD I, Q, M, L, D First value for logic operation

IN2 WORD I, Q, M, L, D Second value for logic operation

OUT WORD I, Q, M, L, D Result word of logic operation

Description

WAND_W (AND Words) is activated by signal state "1" at the enable (EN) input and ANDs the two word values present at IN1 and IN2 bit by bit. The values are interpreted as pure bit patterns. The result can be scanned at the output OUT.

ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1". Only bits 0 to 3 of MW0 are relevant, the rest of MW0 is masked by the IN2 word bit pattern:

MW0 = 01010101 01010101

IN2 = 00000000 00001111

MW0 AND IN2 = MW2 = 00000000 00000101

Q4.0 is "1" if the instruction is executed.

长沙工控帮教育科技有限公司整理

14.3 WOR_W (Word) OR Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 WORD I, Q, M, L, D First value for logic operation

IN2 WORD I, Q, M, L, D Second value for logic operation

OUT WORD I, Q, M, L, D Result word of logic operation

Description

WOR_W (OR Words) is activated by signal state "1" at the enable (EN) input and ORs the two word values present at IN1 and IN2 bit by bit. The values are interpreted as pure bit patterns. The result can be scanned at the output OUT.

ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1". Bits 0 to 3 are set to "1", all other MW0 bits are not changed.

MW0 = 01010101 01010101

IN2 = 00000000 00001111

MW0 OR IN2=MW2 = 01010101 01011111

Q4.0 is "1" if the instruction is executed.

长沙工控帮教育科技有限公司整理

14.4 WAND_DW (Word) AND Double Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 DWORD I, Q, M, L, D First value for logic operation IN2 DWORD I, Q, M, L, D Second value for logic operation

OUT DWORD I, Q, M, L, D Result double word of logic

operation

Description

WAND_DW(AND Double Words) is activated by signal state "1" at the enable (EN) input and ANDs the two word values present at IN1 and IN2 bit by bit. The values are interpreted as pure bit patterns. The result can be scanned at the output OUT. ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1". Only bits 0 and 11 of MD0 are relevant, the rest of MD0 is masked by the IN2 bit pattern:

MD0 = 01010101 01010101 01010101 01010101

IN2 = 00000000 00000000 00001111 11111111

MD0 AND IN2 = MD4 = 00000000 00000000 00000101 01010101 Q4.0 is "1" if the instruction is executed.

长沙工控帮教育科技有限公司整理

14.5 WOR_DW (Word) OR Double Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 DWORD I, Q, M, L, D First value for logic operation IN2 DWORD I, Q, M, L, D Second value for logic operation

OUT DWORD I, Q, M, L, D Result double word of logic

operation

Description

WOR_DW (OR Double Words) is activated by signal state "1" at the enable (EN) input and ORs the two word values present at IN1 and IN2 bit by bit. The values are interpreted as pure bit patterns. The result can be scanned at the output OUT.

ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1". Bits 0 to 11 are set to "1", the remaining MD0 bits are not changed:

MD0 = 01010101 01010101 01010101 01010101

IN2 = 00000000 00000000 00001111 11111111

MD0 OR IN2 = MD4 = 01010101 01010101 01011111 11111111

长沙工控帮教育科技有限公司整理

14.6 WXOR_W (Word) Exclusive OR Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 WORD I, Q, M, L, D First value for logic operation

IN2 WORD I, Q, M, L, D Second value for logic operation

OUT WORD I, Q, M, L, D Result word of logic operation

Description

WXOR_W (Exclusive OR Word) is activated by signal state "1" at the enable (EN) input and XORs the two word values present at IN1 and IN2 bit by bit. The values are interpreted as pure bit patterns. The result can be scanned at the output OUT.

ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1":

MW0 = 01010101 01010101

IN2 = 00000000 00001111

MW0 XOR IN2 = MW2 = 01010101 01011010

Q4.0 is "1" if the instruction is executed.

长沙工控帮教育科技有限公司整理

14.7 WXOR_DW (Word) Exclusive OR Double Word

Parameter Data Type Memory Area Description

EN BOOL I, Q, M, L, D Enable input

ENO BOOL I, Q, M, L, D Enable output

IN1 DWORD I, Q, M, L, D First value for logic operation IN2 DWORD I, Q, M, L, D Second value for logic operation

OUT DWORD I, Q, M, L, D Result double word of logic

operation

Description

WXOR_DW(Exclusive OR Double Word) is activated by signal state "1" at the enable (EN) input and XORs the two word values present at IN1 and IN2 bit by bit.

The values are interpreted as pure bit patterns. The result can be scanned at the output OUT. ENO has the same logic state as EN.

Status word

The instruction is executed if I0.0 is "1":

MD0 = 01010101 01010101 01010101 01010101

IN2 = 00000000 00000000 00001111 11111111

MW2 = MD0 XOR IN2 = 01010101 01010101 01011010 10101010 Q4.0 is "1" if the instruction is executed.

长沙工控帮教育科技有限公司整理

长沙工控帮教育科技有限公司整理