📄 sig_macros.uc
字号:
;------------------------------------------------------------------------------------
;
; I N T E L P R O P R I E T A R Y
;
; COPYRIGHT (c) 2001 BY INTEL CORPORATION. ALL RIGHTS
; RESERVED. NO PART OF THIS PROGRAM OR PUBLICATION MAY
; BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A
; RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER
; LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,
; MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT
; THE PRIOR WRITTEN PERMISSION OF :
;
; INTEL CORPORATION
;
; 2200 MISSION COLLEGE BLVD
;
; SANTA CLARA, CALIFORNIA 95052-8119
;
;------------------------------------------------------------------------------------
// File : sig_macros.uc
//
// Description :
//
// This file provides a set of simple macros used for signalling threads and micro engines.
// Signalling threads within the same ME, signalling neighbouring(next & previous) MEs and
// signalling any ME are covered.
//
#ifndef EXAMPLE_SIG_MACROS_UC
#define EXAMPLE_SIG_MACROS_UC
///////////////////////////////////////////////////////////////////////////////
// signal_next_ctx
// Description: Signal next context (thread) in the same ME. This macro is
// to be used by threads 0 to 6. (Thread 7 has no next thread). Behaviour
// undefined if used by thread 7. No error checking done on signal number.
//
// Outputs:
// None
//
// Inputs:
// in_sig Signal to wakeup next context. (declared using .sig)
//
// Size: 3 instructions
//
#macro signal_next_ctx[in_sig]
.begin
.reg _snc_temp, _msb
immed[_msb, 0x80] ; [7] = 1, NEXT_CONTEXT
alu_shf[_snc_temp, _msb, OR, &in_sig, <<3] ; [6:3] = SIGNAL_NUMBER
local_csr_wr[SAME_ME_SIGNAL, _snc_temp] ; Signal the next thread
.end
#endm
///////////////////////////////////////////////////////////////////////////////
// signal_first_ctx
// Description: Signal the first context (thread 0) in the same ME.
// Can be used by any thread. No error checking done on signal number.
//
// Outputs:
// None
//
// Inputs:
// in_sig Signal to wakeup first (0th) context. (declared using .sig)
//
// Size: 3 instructions
//
#macro signal_first_ctx[in_sig]
.begin
.reg _sfc_temp
; [7] = 0, ! NEXT_CONTEXT
alu_shf[_sfc_temp, --, B, &in_sig, <<3] ; [6:3] = SIGNAL_NUMBER
; [2:0] = 0x0, Context to signal
local_csr_wr[SAME_ME_SIGNAL, _sfc_temp] ; Signal thread 0
.end
#endm
///////////////////////////////////////////////////////////////////////////////
// signal_next_me
// Description: Signal context 0 (thread 0) in the next ME. This macro can
// be used by any but the last ME. (Last ME has no next ME). Behaviour
// undefined if used by last ME. No error checking done on signal number.
//
// Outputs:
// None
//
// Inputs:
// in_sig Signal to wakeup next ME. (declared using .sig)
//
// Size: 3 instructions
//
#macro signal_next_me[in_sig]
.begin
.reg _snm_temp
; [7] = 0, ! THIS_CONTEXT
alu_shf[_snm_temp, --, B, &in_sig, <<3] ; [6:3] = SIGNAL_NUMBER
; [2:0] = 0x0, Context to signal
local_csr_wr[NEXT_NEIGHBOR_SIGNAL, _snm_temp] ; Signal the thread 0 of next ME
.end
#endm
///////////////////////////////////////////////////////////////////////////////
// signal_prev_me
// Description: Signal context 0 (thread 0) in the previous ME. This macro
// can be used by any but the first ME. (First ME has no previous ME).
// Behaviour undefined if used by first ME. No error checking done on
// signal number.
//
// Outputs:
// None
//
// Inputs:
// in_sig Signal to wakeup previous ME. (declared using .sig)
//
// Size: 3 instructions
//
#macro signal_prev_me[in_sig]
.begin
.reg _spm_temp
; [7] = 0, ! THIS_CONTEXT
alu_shf[_spm_temp, --, B, &in_sig, <<3] ; [6:3] = SIGNAL_NUMBER
; [2:0] = 0x0, Context to signal
local_csr_wr[PREV_NEIGHBOR_SIGNAL, _spm_temp] ; Signal the thread 0 of previous ME
.end
#endm
///////////////////////////////////////////////////////////////////////////////
// signal_me
// Description: Signal context 0 (thread 0) of any ME. Note the way the MEs
// are numbered. The MEs are grouped into clusters. If there are 8 MEs, they
// are grouped into two clusters 0 & 1 and each cluster has 4 (0 to 3) MEs.
// Thus MEs numbered as 0,0; 0,1; 0,2; 0,3; 1,0; 1,1; 1,2 and 1,3 (cluster, me).
// If there are 16 MEs, they are grouped into two clusters 0 & 1 and each
// cluster has 8 MEs. No error checking done on signal number. Between the
// parameters me & sig, they should follow the op_A & op_B rules.
//
// Outputs:
// None
//
// Inputs:
// in_cluster Cluster number. (0-1). Can be constant or register
// in_me ME number.
// 0-3 for 8 ME processor
// 0-7 for 16 ME processor
// in_sig Signal to wakeup ME. (declared using .sig)
//
// Size: 4 instructions
//
#macro signal_me_cluster[in_cluster, in_me, in_sig]
.begin
.reg _signal_me_temp, _sig
alu[_sig,--, b, &in_sig] ; move to local register. allows in_sig to be immediate value.
alu[_signal_me_temp, _sig, OR, in_me, <<7] ; [11-7] = ME_NUMBER
alu[--, _signal_me_temp, OR, in_cluster, <<11] ; [6:4] = 0x0, THREAD_NUMBER
; [3:0] = SIGNAL
cap[fast_wr, ALU, INTERTHREAD_SIG] ; Signal the ME.
.end
#endm
///////////////////////////////////////////////////////////////////////////////
// signal_me
// Description: Signal context 0 (thread 0) of any ME. Note the way the MEs
// are numbered. The MEs are grouped into clusters. If there are 8 MEs, they
// are grouped into two clusters 0 & 1 and each cluster has 4 (0 to 3) MEs.
// MEs are are numbered as 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12 and 0x13 (for 8 MEs)
// If there are 16 MEs, they are grouped into two clusters 0 & 1 and each
// cluster has 8 MEs. (0x00, 0x01..0x07, 0x10, 0x11...0x17). This kind of numbering
// has the cluster number encoded in the ME number (that's how the h/w uses it)
//
// Outputs:
// None
//
// Inputs:
// in_me ME number.
// 0-0x1f. The cluster number should already be encoded in
// this ME number.(The MEs should be numbered as described above)
// in_sig Signal to wakeup ME. (declared using .sig)
//
// Size: 3 instructions
//
#macro signal_me[in_me, in_sig]
.begin
.reg _sig
alu[_sig,--, b, &in_sig] ; move to local register.
alu[--, _sig, OR, in_me, <<7] ; [11-7] = ME_NUMBER
; [6:4] = 0x0, THREAD_NUMBER
; [3:0] = SIGNAL
cap[fast_wr, ALU, INTERTHREAD_SIG] ; Signal the ME.
.end
#endm
#endif // EXAMPLE_SIG_MACROS_UC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -