From 712ea0ece32c6cae7e5523fe39622738512e979d Mon Sep 17 00:00:00 2001 From: guosran <165251838+guosran@users.noreply.github.com> Date: Fri, 26 Jun 2026 03:45:24 +0800 Subject: [PATCH 1/2] Add shared const opcode definitions --- lib/opt_type.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/lib/opt_type.py b/lib/opt_type.py index dec22b11..072e8ff7 100644 --- a/lib/opt_type.py +++ b/lib/opt_type.py @@ -115,6 +115,46 @@ OPT_GEP_CONST = OpCodeType( 89 ) OPT_GEP_2D = OpCodeType( 90 ) OPT_GEP_2D_CONST = OpCodeType( 91 ) +OPT_GRT_ONCE_CONST = OpCodeType( 92 ) +OPT_GTE_CONST = OpCodeType( 93 ) +OPT_LT_CONST = OpCodeType( 94 ) +OPT_GT_CONST = OpCodeType( 95 ) +OPT_REM_CONST = OpCodeType( 96 ) +OPT_AND_CONST = OpCodeType( 97 ) +OPT_OR_CONST = OpCodeType( 98 ) +OPT_LLS_CONST = OpCodeType( 99 ) + +OPT_USES_CONST_LIST = ( + OPT_CONST, + OPT_ADD_CONST, + OPT_SUB_CONST, + OPT_DIV_CONST, + OPT_EQ_CONST, + OPT_NE_CONST, + OPT_PHI_CONST, + OPT_LD_CONST, + OPT_STR_CONST, + OPT_MUL_CONST, + OPT_MUL_CONST_ADD, + OPT_ADD_CONST_LD, + OPT_INC_NE_CONST_NOT_GRT, + OPT_FADD_CONST, + OPT_FMUL_CONST, + OPT_VEC_ADD_CONST, + OPT_VEC_SUB_CONST, + OPT_VEC_ADD_CONST_COMBINED, + OPT_VEC_SUB_CONST_COMBINED, + OPT_GRT_ONCE_CONST, + OPT_GTE_CONST, + OPT_LT_CONST, + OPT_GT_CONST, + OPT_AND_CONST, + OPT_OR_CONST, + OPT_LLS_CONST, + OPT_REM_CONST, + OPT_GEP_CONST, + OPT_GEP_2D_CONST, +) OPT_SYMBOL_DICT = { OPT_START : "(start)", @@ -201,6 +241,14 @@ OPT_REM_INCLUSIVE_START : "(%st)", OPT_DIV_INCLUSIVE_END : "(/ed)", OPT_REM_INCLUSIVE_END : "(%ed)", + OPT_GRT_ONCE_CONST : "(grant_once')", + OPT_GTE_CONST : "(?>=')", + OPT_LT_CONST : "(?<')", + OPT_GT_CONST : "(?>')", + OPT_AND_CONST : "(&')", + OPT_OR_CONST : "(|')", + OPT_LLS_CONST : "(<<')", + OPT_REM_CONST : "(%')", OPT_LOOP_CONTROL : "(loop_ctrl)", OPT_STREAM_LD : "(streaming_ld)", From edbc506383e7be6ff74d2c7fd1aa69d3242e73dd Mon Sep 17 00:00:00 2001 From: guosran <165251838+guosran@users.noreply.github.com> Date: Fri, 26 Jun 2026 03:45:53 +0800 Subject: [PATCH 2/2] Support const left shifts --- fu/single/ShifterRTL.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fu/single/ShifterRTL.py b/fu/single/ShifterRTL.py index 9784ef0a..a6a97738 100644 --- a/fu/single/ShifterRTL.py +++ b/fu/single/ShifterRTL.py @@ -72,6 +72,17 @@ def comb_logic(): s.recv_in[s.in1_idx].rdy @= s.recv_all_val & s.send_out[0].rdy s.recv_opt.rdy @= s.recv_all_val & s.send_out[0].rdy + elif s.recv_opt.msg.operation == OPT_LLS_CONST: + s.send_out[0].msg.payload @= s.recv_in[s.in0_idx].msg.payload << s.recv_const.msg.payload + s.send_out[0].msg.predicate @= s.recv_in[s.in0_idx].msg.predicate & \ + s.recv_const.msg.predicate & \ + s.reached_vector_factor + s.recv_all_val @= s.recv_in[s.in0_idx].val & s.recv_const.val + s.send_out[0].val @= s.recv_all_val + s.recv_in[s.in0_idx].rdy @= s.recv_all_val & s.send_out[0].rdy + s.recv_const.rdy @= s.recv_all_val & s.send_out[0].rdy + s.recv_opt.rdy @= s.recv_all_val & s.send_out[0].rdy + elif s.recv_opt.msg.operation == OPT_LRS: s.send_out[0].msg.payload @= s.recv_in[s.in0_idx].msg.payload >> s.recv_in[s.in1_idx].msg.payload s.send_out[0].msg.predicate @= s.recv_in[s.in0_idx].msg.predicate & \