Back
MASM : LUT : LUTSWITCH
LUTSWITCH:

Syntax:

Description:

The LUTSWITCH instruction selects the data from either registers Rs0 or Rs1 depending on the condition on the top of the stack. If the condition is TRUE, data on Rs0 is selected, otherwise data on Rs1 is selected:

Stack State Result
H = T L = T H=[Rs0].H L=[Rs0].L
H = T L = F H=[Rs0].H L=[Rs1].L
H = F L = T H=[Rs1].H L=[Rs0].L
H = F L = F H=[Rs1].H L=[Rs1].L

Note: [R].X denotes the data on bank X of register R; H denotes the high bank, while L denotes the low bank; T denotes TRUE, while F denotes FALSE.

The result of the LUTSWITCH operation is then written to register Rd3, via Port3 of the register file, according to the specified bank select Bs3.

Microcode Pattern:

Takes 4 cycles to execute.
    Example: LUTSWITCH 0xC 3 0xA 0xB

	  
	MPC  BS3 C3 P3 P2 P1 P0
	-----------------------
	SWT   0   0 00 00 0B 0A
	 -    0   0 00 00 00 00
	 -    0   0 00 00 00 00
	 -    3   0 0C 00 00 00

	  
Exceptions :

No exceptions.

Example :

!! Top of the stack:  H = T, L = F

LUTSWITCH 0xC 3 0xA 0xB !! Copies the high bank of register 
                        !! 0xA into the high bank of register 
                        !! 0xC and copies the low bank of 
                        !! register 0xB into the low bank of 
                        !! register 0xC

APE Group Zeuthen. 2003
$Id: lutswitch_masm.php,v 1.2 2004/08/04 09:43:31 noe Exp $
$Id: syntax.php,v 1.8 2004/08/04 09:25:34 noe Exp $