⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 assign_compare_macros.uc

📁 国内还比较新的network processor的微代码开发
💻 UC
📖 第 1 页 / 共 2 页
字号:
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_1_inc_src
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//
//
//	Size:
//		6 instructions
//
#macro compare_1_inc_src[src, in_data_0, pass, fail]
    alu[--, src, -, in_data_0]			; compare src and in_data_0
    bne[not_equal#], defer[1]			; not equal, before branch, increase 
										; src by one to save one cycle	
    alu[src, src, +, 1]					; increase src by one

    alu[pass, pass, +, 1]				; increase pass by one
    br[end_of_compare_1_inc_src_macro#]	; branch to end

not_equal#:		
	alu[fail, fail, +, 1]				; increase fail by one

end_of_compare_1_inc_src_macro#:

#endm

/////////////////////////////////////////////////////////////////////////////
// compare_2
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//
//	Size:
//		12 instructions
//
#macro compare_2[src, in_data_0, in_data_1 , pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_3
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//
//	Size:
//		18 instructions
//
#macro compare_3[src, in_data_0, in_data_1, in_data_2, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_4
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail,
//				 then do same stuff on src, in_data_3, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//			in_data_3			GPR 32-bit word
//
//	Size:
//		24 instructions
//
#macro compare_4[src, in_data_0, in_data_1, in_data_2, in_data_3, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_3, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_5
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail,
//				 then do same stuff on src, in_data_3, pass, and fail,
//				 then do same stuff on src, in_data_4, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//			in_data_3			GPR 32-bit word
//			in_data_4			GPR 32-bit word
//
//
//	Size:
//		30 instructions
//
#macro compare_5[src, in_data_0, in_data_1, in_data_2, in_data_3, in_data_4, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_3, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_4, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_6
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail,
//				 then do same stuff on src, in_data_3, pass, and fail,
//				 then do same stuff on src, in_data_4, pass, and fail,
//				 then do same stuff on src, in_data_5, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//			in_data_3			GPR 32-bit word
//			in_data_4			GPR 32-bit word
//			in_data_5			GPR 32-bit word
//
//	Size:
//		36 instructions
//
#macro compare_6[src, in_data_0, in_data_1, in_data_2, in_data_3, in_data_4, in_data_5, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_3, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_4, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_5, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_7
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail,
//				 then do same stuff on src, in_data_3, pass, and fail,
//				 then do same stuff on src, in_data_4, pass, and fail,
//				 then do same stuff on src, in_data_5, pass, and fail,
//				 then do same stuff on src, in_data_6, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//			in_data_3			GPR 32-bit word
//			in_data_4			GPR 32-bit word
//			in_data_5			GPR 32-bit word
//			in_data_6			GPR 32-bit word
//
//	Size:
//		42 instructions
//
#macro compare_7[src, in_data_0, in_data_1, in_data_2, in_data_3, in_data_4, in_data_5, in_data_6, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_3, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_4, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_5, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_6, pass, fail]	; call macro compare_1_inc_src
#endm

/////////////////////////////////////////////////////////////////////////////
// compare_8_inc_src
//
//	Description: compare src and in_data_0, if they are equal, increase pass
//               by one, else increase fail by one, then increase src by one,
//				 then do same stuff on src, in_data_1, pass, and fail,
//				 then do same stuff on src, in_data_2, pass, and fail,
//				 then do same stuff on src, in_data_3, pass, and fail,
//				 then do same stuff on src, in_data_4, pass, and fail,
//				 then do same stuff on src, in_data_5, pass, and fail,
//				 then do same stuff on src, in_data_6, pass, and fail,
//				 then do same stuff on src, in_data_7, pass, and fail
//                
//	Input/output:
//			src					GPR 32-bit word
//			pass				GPR 32-bit word
//			fail				GPR 32-bit word
//      
//	Input:
//			in_data_0			GPR 32-bit word
//			in_data_1			GPR 32-bit word
//			in_data_2			GPR 32-bit word
//			in_data_3			GPR 32-bit word
//			in_data_4			GPR 32-bit word
//			in_data_5			GPR 32-bit word
//			in_data_6			GPR 32-bit word
//			in_data_7			GPR 32-bit word
//
//	Size:
//		48 instructions
//
#macro compare_8[src, in_data_0, in_data_1, in_data_2, in_data_3, in_data_4, in_data_5, in_data_6, in_data_7, pass, fail]
    compare_1_inc_src[src, in_data_0, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_1, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_2, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_3, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_4, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_5, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_6, pass, fail]	; call macro compare_1_inc_src
    compare_1_inc_src[src, in_data_7, pass, fail]	; call macro compare_1_inc_src
#endm

#endif //ASSIGN_COMPARE_MACROS

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -