Ignore:
Timestamp:
Jul 5, 2007, 5:50:19 PM (17 years ago)
Author:
rosiere
Message:

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter_vhdl_body.cpp

    r2 r42  
    1515
    1616
    17   void Shifter::vhdl_body (Vhdl & vhdl)
     17  void Shifter::vhdl_body (Vhdl * & vhdl)
    1818  {
    1919    //uint32_t log2_size_data = static_cast<uint32_t>(ceil(log2(_param._size_data)));
    2020
    21     vhdl.set_body ("-- Compute all case of shift");
     21    vhdl->set_body ("-- Compute all case of shift");
    2222
    2323    for (uint32_t i=0; i<_param._nb_port; i++)
     
    2525        //-----[ Shift logic Left ]--------------------------------------------
    2626        if (_param._have_shift_logic_left)
    27           vhdl.set_body ("shift_logic_left_"+toString(i)+"        <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sll CONV_INTEGER(shift_"+toString(i)+"));");
     27          vhdl->set_body ("shift_logic_left_"+toString(i)+"        <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sll CONV_INTEGER(shift_"+toString(i)+"));");
    2828        //-----[ Shift logic Right ]-------------------------------------------
    2929        if (_param._have_shift_logic_right)
    30           vhdl.set_body ("shift_logic_right_"+toString(i)+"       <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") srl CONV_INTEGER(shift_"+toString(i)+"));");
     30          vhdl->set_body ("shift_logic_right_"+toString(i)+"       <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) srl CONV_INTEGER(shift_"+toString(i)+"));");
    3131        //-----[ Shift arithmetic Left ]---------------------------------------
    3232        if (_param._have_shift_arithmetic_left)
    33           vhdl.set_body ("shift_arithmetic_left_"+toString(i)+"   <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sla CONV_INTEGER(shift_"+toString(i)+"));");
     33          vhdl->set_body ("shift_arithmetic_left_"+toString(i)+"   <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sla CONV_INTEGER(shift_"+toString(i)+"));");
    3434        //-----[ Shift arithmetic Right ]--------------------------------------
    3535        if (_param._have_shift_arithmetic_right)
    36           vhdl.set_body ("shift_arithmetic_right_"+toString(i)+"  <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") sra CONV_INTEGER(shift_"+toString(i)+"));");
     36          vhdl->set_body ("shift_arithmetic_right_"+toString(i)+"  <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) sra CONV_INTEGER(shift_"+toString(i)+"));");
    3737        //-----[ Rotate Left ]-------------------------------------------------
    3838        if (_param._have_rotate_left)
    39           vhdl.set_body ("rotate_left_"+toString(i)+"             <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") rol CONV_INTEGER(shift_"+toString(i)+"));");
     39          vhdl->set_body ("rotate_left_"+toString(i)+"             <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) rol CONV_INTEGER(shift_"+toString(i)+"));");
    4040        //-----[ Rotate Right ]------------------------------------------------
    4141        if (_param._have_rotate_right)
    42           vhdl.set_body ("rotate_right_"+toString(i)+"            <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_DATA_"+toString(i)+") ror CONV_INTEGER(shift_"+toString(i)+"));");
     42          vhdl->set_body ("rotate_right_"+toString(i)+"            <= TO_STDLOGICVECTOR(TO_BITVECTOR(in_SHIFTER_"+toString(i)+"_DATA) ror CONV_INTEGER(shift_"+toString(i)+"));");
    4343      }
    4444
    4545    if (_param._size_data_completion > 0)
    4646      {
    47         vhdl.set_body ("");
    48         vhdl.set_body ("-- Mask");
     47        vhdl->set_body ("");
     48        vhdl->set_body ("-- Mask");
    4949
    5050        for (uint32_t i=0; i<_param._nb_port; i++)
     
    5353           
    5454            if (_param._type_completion_bool == true)
    55               print_shifter_completion = "in_SHIFTER_CARRY_IN";
     55              print_shifter_completion = "in_SHIFTER_"+toString(i)+"_CARRY_IN";
    5656            else
    57               print_shifter_completion = "in_SHIFTER_COMPLETION";
     57              print_shifter_completion = "in_SHIFTER_"+toString(i)+"_COMPLETION";
    5858
    5959            if (_param._size_data == _param._size_data_completion)
    6060              {
    61                 vhdl.set_body ("shifter_completion_left_"+toString(i)+"  <= "+print_shifter_completion+"_"+toString(i)+";");
    62                 vhdl.set_body ("shifter_completion_right_"+toString(i)+" <= "+print_shifter_completion+"_"+toString(i)+";");
     61                vhdl->set_body ("shifter_completion_left_"+toString(i)+"  <= "+print_shifter_completion+";");
     62                vhdl->set_body ("shifter_completion_right_"+toString(i)+" <= "+print_shifter_completion+";");
    6363              }
    6464            else
    6565              {
    66                 vhdl.set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data_completion)+"  <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");
    67                 vhdl.set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data_completion                    )+"  <= "+print_shifter_completion+"_"+toString(i)+";");
    68 
    69                 vhdl.set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data-_param._size_data_completion)+" <= "+print_shifter_completion+"_"+toString(i)+";");
    70                 vhdl.set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-_param._size_data_completion                    )+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");
    71               }
    72            
    73             vhdl.set_body ("mask_completion_left_"+toString(i)+"     <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) sll CONV_INTEGER(shift_"+toString(i)+"));");
    74             vhdl.set_body ("mask_completion_right_"+toString(i)+"    <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) srl CONV_INTEGER(shift_"+toString(i)+"));");
     66                vhdl->set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data_completion)+"  <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");
     67                vhdl->set_body ("shifter_completion_left_"+toString(i)+std_logic_range(_param._size_data_completion                    )+"  <= "+print_shifter_completion+";");
     68
     69                vhdl->set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-1,_param._size_data-_param._size_data_completion)+" <= "+print_shifter_completion+";");
     70                vhdl->set_body ("shifter_completion_right_"+toString(i)+std_logic_range(_param._size_data-_param._size_data_completion                    )+" <= "+std_logic_others(_param._size_data-_param._size_data_completion,0)+";");
     71              }
     72           
     73            vhdl->set_body ("mask_completion_left_"+toString(i)+"     <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) sll CONV_INTEGER(shift_"+toString(i)+"));");
     74            vhdl->set_body ("mask_completion_right_"+toString(i)+"    <= TO_STDLOGICVECTOR(TO_BITVECTOR(cst_completion) srl CONV_INTEGER(shift_"+toString(i)+"));");
    7575          }
    7676      }
    7777             
    7878
    79     vhdl.set_body ("");
    80     vhdl.set_body ("-- Multiplexor");
     79    vhdl->set_body ("");
     80    vhdl->set_body ("-- Multiplexor");
    8181
    8282    for (uint32_t i=0; i<_param._nb_port; i++)
    8383      {
    84         vhdl.set_body ("out_SHIFTER_DATA_"+toString(i)+"       <=");
     84        vhdl->set_body ("out_SHIFTER_"+toString(i)+"_DATA       <=");
    8585        string print_else = "    ";
    8686
     
    9595              {
    9696                have_when = true;
    97                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_left ";
    98                 print_and = " and ";
    99               }
    100             if (_param._rotate      == external_rotate)
    101               {
    102                 have_when = true;
    103                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_shift ";
     97                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left ";
     98                print_and = " and ";
     99              }
     100            if (_param._rotate      == external_rotate)
     101              {
     102                have_when = true;
     103                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift ";
    104104                print_and = " and ";
    105105              }
     
    107107              {
    108108                have_when = true;
    109                 print_when += print_and+" in_SHIFTER_CARRY_"+toString(i)+" = cst_is_carry_arithmetic";
    110               }
    111 
    112             if (have_when)
    113               print_when = "when " + print_when;
    114 
    115             vhdl.set_body ("\t"+print_else+" shift_arithmetic_left_"+toString(i)+"   "+print_when);
     109                print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_arithmetic";
     110              }
     111
     112            if (have_when)
     113              print_when = "when " + print_when;
     114
     115            vhdl->set_body ("\t"+print_else+" shift_arithmetic_left_"+toString(i)+"   "+print_when);
    116116            print_else = "else";
    117117          }
     
    126126              {
    127127                have_when = true;
    128                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_right";
    129                 print_and = " and ";
    130               }
    131             if (_param._rotate      == external_rotate)
    132               {
    133                 have_when = true;
    134                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_shift ";
     128                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right";
     129                print_and = " and ";
     130              }
     131            if (_param._rotate      == external_rotate)
     132              {
     133                have_when = true;
     134                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift ";
    135135                print_and = " and ";
    136136              }
     
    138138              {
    139139                have_when = true;
    140                 print_when += print_and+" in_SHIFTER_CARRY_"+toString(i)+" = cst_is_carry_arithmetic";
    141               }
    142 
    143             if (have_when)
    144               print_when = "when " + print_when;
    145 
    146             vhdl.set_body ("\t"+print_else+" shift_arithmetic_right_"+toString(i)+"  "+print_when);
     140                print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_arithmetic";
     141              }
     142
     143            if (have_when)
     144              print_when = "when " + print_when;
     145
     146            vhdl->set_body ("\t"+print_else+" shift_arithmetic_right_"+toString(i)+"  "+print_when);
    147147            print_else = "else";
    148148          }
     
    157157              {
    158158                have_when = true;
    159                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_left ";
    160                 print_and = " and ";
    161               }
    162             if (_param._rotate      == external_rotate)
    163               {
    164                 have_when = true;
    165                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_shift ";
     159                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left ";
     160                print_and = " and ";
     161              }
     162            if (_param._rotate      == external_rotate)
     163              {
     164                have_when = true;
     165                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift ";
    166166                print_and = " and ";
    167167              }
     
    169169              {
    170170                have_when = true;
    171                 print_when += print_and+" in_SHIFTER_CARRY_"+toString(i)+" = cst_is_carry_logic     ";
     171                print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_logic     ";
    172172              }
    173173
     
    182182              print_expr_completion = "(shift_logic_left_"+toString(i)+"  and mask_completion_left_"+toString(i)+" ) or ( shifter_completion_left_"+toString(i)+"  and not mask_completion_left_"+toString(i)+" )";
    183183
    184             vhdl.set_body ("\t"+print_else+" "+print_expr_completion+"        "+print_when);
     184            vhdl->set_body ("\t"+print_else+" "+print_expr_completion+"        "+print_when);
    185185            print_else = "else";
    186186          }
     
    195195              {
    196196                have_when = true;
    197                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_right";
    198                 print_and = " and ";
    199               }
    200             if (_param._rotate      == external_rotate)
    201               {
    202                 have_when = true;
    203                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_shift ";
     197                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right";
     198                print_and = " and ";
     199              }
     200            if (_param._rotate      == external_rotate)
     201              {
     202                have_when = true;
     203                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_shift ";
    204204                print_and = " and ";
    205205              }
     
    207207              {
    208208                have_when = true;
    209                 print_when += print_and+" in_SHIFTER_CARRY_"+toString(i)+" = cst_is_carry_logic     ";
     209                print_when += print_and+" in_SHIFTER_"+toString(i)+"_CARRY = cst_is_carry_logic     ";
    210210              }
    211211
     
    220220              print_expr_completion = "(shift_logic_right_"+toString(i)+" and mask_completion_right_"+toString(i)+") or ( shifter_completion_right_"+toString(i)+" and not mask_completion_right_"+toString(i)+")";
    221221
    222             vhdl.set_body ("\t"+print_else+" "+print_expr_completion+"        "+print_when);
     222            vhdl->set_body ("\t"+print_else+" "+print_expr_completion+"        "+print_when);
    223223            print_else = "else";
    224224          }
     
    233233              {
    234234                have_when = true;
    235                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_left ";
    236                 print_and = " and ";
    237               }
    238             if (_param._rotate      == external_rotate)
    239               {
    240                 have_when = true;
    241                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_rotate";
    242                 print_and = " and ";
    243               }
    244 
    245             if (have_when)
    246               print_when = "when " + print_when;
    247 
    248             vhdl.set_body ("\t"+print_else+" rotate_left_"+toString(i)+"             "+print_when);
     235                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_left ";
     236                print_and = " and ";
     237              }
     238            if (_param._rotate      == external_rotate)
     239              {
     240                have_when = true;
     241                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_rotate";
     242                print_and = " and ";
     243              }
     244
     245            if (have_when)
     246              print_when = "when " + print_when;
     247
     248            vhdl->set_body ("\t"+print_else+" rotate_left_"+toString(i)+"             "+print_when);
    249249            print_else = "else";
    250250          }
     
    259259              {
    260260                have_when = true;
    261                 print_when += " in_SHIFTER_DIRECTION_"+toString(i)+" = cst_is_direction_right";
    262                 print_and = " and ";
    263               }
    264             if (_param._rotate      == external_rotate)
    265               {
    266                 have_when = true;
    267                 print_when += print_and+" in_SHIFTER_TYPE_"+toString(i)+" = cst_is_type_rotate";
    268                 print_and = " and ";
    269               }
    270 
    271             if (have_when)
    272               print_when = "when " + print_when;
    273 
    274             vhdl.set_body ("\t"+print_else+" rotate_right_"+toString(i)+"            "+print_when);
    275             print_else = "else";
    276           }
    277         vhdl.set_body (";");
     261                print_when += " in_SHIFTER_"+toString(i)+"_DIRECTION = cst_is_direction_right";
     262                print_and = " and ";
     263              }
     264            if (_param._rotate      == external_rotate)
     265              {
     266                have_when = true;
     267                print_when += print_and+" in_SHIFTER_"+toString(i)+"_TYPE = cst_is_type_rotate";
     268                print_and = " and ";
     269              }
     270
     271            if (have_when)
     272              print_when = "when " + print_when;
     273
     274            vhdl->set_body ("\t"+print_else+" rotate_right_"+toString(i)+"            "+print_when);
     275            print_else = "else";
     276          }
     277        vhdl->set_body (";");
    278278      }
    279279   
Note: See TracChangeset for help on using the changeset viewer.