PrincetonUniversity / ILAng

A Modeling and Verification Platform for SoCs using ILAs
https://bo-yuan-huang.gitbook.io/ilang/
MIT License
75 stars 18 forks source link

Inconsistency between generated SystemC code with the description of ILA model for the New ILAtor #198

Closed LeeOHzzZ closed 4 years ago

LeeOHzzZ commented 4 years ago

Describe the bug Inconsistency between generated SystemC code with the description of ILA model. Example: In a transpose operation in flexnlp gb_attention_child_bmm_tp instruction:

for (auto i = 0; i < GB_CORE_SCALAR; i++) {
      for (auto j = 0; j < GB_CORE_SCALAR; j++) {
        auto reg_i_j = child.state(GBGetVectorName2D(i, j, GB_ATTENTION_DP0));
        auto reg_j_i = child.state(GBGetVectorName2D(j, i, GB_ATTENTION_DP0));
        instr.SetUpdate(reg_i_j, reg_j_i);
      }
    }

The state update for reg_i_j in systemc should have a non-blocking assignment behavior in RTL, to be consistent with the generated verilog behaviors. However, in the generated systemc code, it lacks a variable to hold the temporary value during the value exchange.

Ex. (reg_0_1, reg_1_0) = (1, 0) at the start, and should be (0,1) after transpose, but the result is (0, 0) in the current output.

LeeOHzzZ commented 4 years ago

code example:

1 #include <flex.h>
  2 bool flex::decode_GB_ATTENTION_CHILD_gb_attention_child_bmm_tp() {
  3 sc_biguint<1> local_var_1 = 1;
  4 bool local_var_2 = (flex_gb_attention_child_valid_flag == local_var_1);
  5 sc_biguint<5> local_var_4 = 3;
  6 bool local_var_5 = (flex_gb_attention_child_state == local_var_4);
  7 bool local_var_6 = (local_var_2 & local_var_5);
  8 auto& univ_var_534 = local_var_6;
  9 return univ_var_534;
 10 }
 11 void flex::update_GB_ATTENTION_CHILD_gb_attention_child_bmm_tp() {
 12 sc_biguint<5> local_var_0 = 4;
 13 flex_gb_attention_child_state = local_var_0;
 14 GB_ATTENTION_CHILD_gb_attention_dp0_0_0 = GB_ATTENTION_CHILD_gb_attention_dp0_0_0;
 15 GB_ATTENTION_CHILD_gb_attention_dp0_0_1 = GB_ATTENTION_CHILD_gb_attention_dp0_1_0;
 16 GB_ATTENTION_CHILD_gb_attention_dp0_0_10 = GB_ATTENTION_CHILD_gb_attention_dp0_10_0;
 17 GB_ATTENTION_CHILD_gb_attention_dp0_0_11 = GB_ATTENTION_CHILD_gb_attention_dp0_11_0;
 18 GB_ATTENTION_CHILD_gb_attention_dp0_0_12 = GB_ATTENTION_CHILD_gb_attention_dp0_12_0;
 19 GB_ATTENTION_CHILD_gb_attention_dp0_0_13 = GB_ATTENTION_CHILD_gb_attention_dp0_13_0;
 20 GB_ATTENTION_CHILD_gb_attention_dp0_0_14 = GB_ATTENTION_CHILD_gb_attention_dp0_14_0;
 21 GB_ATTENTION_CHILD_gb_attention_dp0_0_15 = GB_ATTENTION_CHILD_gb_attention_dp0_15_0;
 22 GB_ATTENTION_CHILD_gb_attention_dp0_0_2 = GB_ATTENTION_CHILD_gb_attention_dp0_2_0;
 23 GB_ATTENTION_CHILD_gb_attention_dp0_0_3 = GB_ATTENTION_CHILD_gb_attention_dp0_3_0;
 24 GB_ATTENTION_CHILD_gb_attention_dp0_0_4 = GB_ATTENTION_CHILD_gb_attention_dp0_4_0;
 25 GB_ATTENTION_CHILD_gb_attention_dp0_0_5 = GB_ATTENTION_CHILD_gb_attention_dp0_5_0;
 26 GB_ATTENTION_CHILD_gb_attention_dp0_0_6 = GB_ATTENTION_CHILD_gb_attention_dp0_6_0;
 27 GB_ATTENTION_CHILD_gb_attention_dp0_0_7 = GB_ATTENTION_CHILD_gb_attention_dp0_7_0;
 28 GB_ATTENTION_CHILD_gb_attention_dp0_0_8 = GB_ATTENTION_CHILD_gb_attention_dp0_8_0;
 29 GB_ATTENTION_CHILD_gb_attention_dp0_0_9 = GB_ATTENTION_CHILD_gb_attention_dp0_9_0;
 30 GB_ATTENTION_CHILD_gb_attention_dp0_10_0 = GB_ATTENTION_CHILD_gb_attention_dp0_0_10;
 31 GB_ATTENTION_CHILD_gb_attention_dp0_10_1 = GB_ATTENTION_CHILD_gb_attention_dp0_1_10;
 32 GB_ATTENTION_CHILD_gb_attention_dp0_10_10 = GB_ATTENTION_CHILD_gb_attention_dp0_10_10;
 33 GB_ATTENTION_CHILD_gb_attention_dp0_10_11 = GB_ATTENTION_CHILD_gb_attention_dp0_11_10;
 34 GB_ATTENTION_CHILD_gb_attention_dp0_10_12 = GB_ATTENTION_CHILD_gb_attention_dp0_12_10;
 35 GB_ATTENTION_CHILD_gb_attention_dp0_10_13 = GB_ATTENTION_CHILD_gb_attention_dp0_13_10;
 36 GB_ATTENTION_CHILD_gb_attention_dp0_10_14 = GB_ATTENTION_CHILD_gb_attention_dp0_14_10;
 37 GB_ATTENTION_CHILD_gb_attention_dp0_10_15 = GB_ATTENTION_CHILD_gb_attention_dp0_15_10;
 38 GB_ATTENTION_CHILD_gb_attention_dp0_10_2 = GB_ATTENTION_CHILD_gb_attention_dp0_2_10;
 39 GB_ATTENTION_CHILD_gb_attention_dp0_10_3 = GB_ATTENTION_CHILD_gb_attention_dp0_3_10;
 40 GB_ATTENTION_CHILD_gb_attention_dp0_10_4 = GB_ATTENTION_CHILD_gb_attention_dp0_4_10;
 41 GB_ATTENTION_CHILD_gb_attention_dp0_10_5 = GB_ATTENTION_CHILD_gb_attention_dp0_5_10;
 42 GB_ATTENTION_CHILD_gb_attention_dp0_10_6 = GB_ATTENTION_CHILD_gb_attention_dp0_6_10;
 43 GB_ATTENTION_CHILD_gb_attention_dp0_10_7 = GB_ATTENTION_CHILD_gb_attention_dp0_7_10;
 44 GB_ATTENTION_CHILD_gb_attention_dp0_10_8 = GB_ATTENTION_CHILD_gb_attention_dp0_8_10;
 45 GB_ATTENTION_CHILD_gb_attention_dp0_10_9 = GB_ATTENTION_CHILD_gb_attention_dp0_9_10;
 46 GB_ATTENTION_CHILD_gb_attention_dp0_11_0 = GB_ATTENTION_CHILD_gb_attention_dp0_0_11;
 47 GB_ATTENTION_CHILD_gb_attention_dp0_11_1 = GB_ATTENTION_CHILD_gb_attention_dp0_1_11;
 48 GB_ATTENTION_CHILD_gb_attention_dp0_11_10 = GB_ATTENTION_CHILD_gb_attention_dp0_10_11;
 49 GB_ATTENTION_CHILD_gb_attention_dp0_11_11 = GB_ATTENTION_CHILD_gb_attention_dp0_11_11;
 50 GB_ATTENTION_CHILD_gb_attention_dp0_11_12 = GB_ATTENTION_CHILD_gb_attention_dp0_12_11;
 51 GB_ATTENTION_CHILD_gb_attention_dp0_11_13 = GB_ATTENTION_CHILD_gb_attention_dp0_13_11;
 52 GB_ATTENTION_CHILD_gb_attention_dp0_11_14 = GB_ATTENTION_CHILD_gb_attention_dp0_14_11;
 53 GB_ATTENTION_CHILD_gb_attention_dp0_11_15 = GB_ATTENTION_CHILD_gb_attention_dp0_15_11;
 54 GB_ATTENTION_CHILD_gb_attention_dp0_11_2 = GB_ATTENTION_CHILD_gb_attention_dp0_2_11;
 55 GB_ATTENTION_CHILD_gb_attention_dp0_11_3 = GB_ATTENTION_CHILD_gb_attention_dp0_3_11;
 56 GB_ATTENTION_CHILD_gb_attention_dp0_11_4 = GB_ATTENTION_CHILD_gb_attention_dp0_4_11;
 57 GB_ATTENTION_CHILD_gb_attention_dp0_11_5 = GB_ATTENTION_CHILD_gb_attention_dp0_5_11;
 58 GB_ATTENTION_CHILD_gb_attention_dp0_11_6 = GB_ATTENTION_CHILD_gb_attention_dp0_6_11;
 59 GB_ATTENTION_CHILD_gb_attention_dp0_11_7 = GB_ATTENTION_CHILD_gb_attention_dp0_7_11;
 60 GB_ATTENTION_CHILD_gb_attention_dp0_11_8 = GB_ATTENTION_CHILD_gb_attention_dp0_8_11;
 61 GB_ATTENTION_CHILD_gb_attention_dp0_11_9 = GB_ATTENTION_CHILD_gb_attention_dp0_9_11;
 62 GB_ATTENTION_CHILD_gb_attention_dp0_12_0 = GB_ATTENTION_CHILD_gb_attention_dp0_0_12;
 63 GB_ATTENTION_CHILD_gb_attention_dp0_12_1 = GB_ATTENTION_CHILD_gb_attention_dp0_1_12;
...

output log: bmm_tp before: dp0_0_1: 01b dp0_1_0: 009 bmm_tp after: dp0_0_1: 009 dp0_1_0: 009