Research Article

Embedded Microprocessor Extension Design and Optimization for Real-Time Edge Computing

Pseudocode 1

Pseudocode of hardware thread scheduling.
Input: slots_last, tmodes_last
Output: tid, valid, slots_last, tmodes_last
1 valid, s ⟵ NEXT_ENABLED_SLOT(slots_last) // round-robin
2 if valid then
3  slot ⟵ CSR_slot(s)
4  if slot != S and (CSR_tmode(slot) == HA or CSR_tmode(slot) == SA) then
5    tid ⟵ slot
6  else
7   valid, t ⟵ NEXT_ACTIVE_SRTT(tmodes_last)
8   if valid then
9     tid ⟵ t
10    tmodes_last ⟵ t
11   endif
12  endif
13  slots_last ⟵ s
14 endif