Skip to content
Snippets Groups Projects
Select Git revision
  • c3aac0e84ec74dac94cdb51ce4a3e9dd15c5edf0
  • SAR-150_add_transaction_id_in_all_logs default protected
  • master
  • sar-293_fix_lint_issue
  • sar-259/Testing-skallop-docs
  • sar-255/Publish-package-to-CAR
  • test-package
  • SAR-189-use-single-namespace-for-package-naming
  • revert-52d118c0
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
15 results

transactions.py

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    util.h 2.27 KiB
    /* *************************************************************************
    * Copyright 2020
    * ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
    * P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    * *********************************************************************** */
    
    /* *************************************************************************
    * Author:
    * . Leon Hiemstra
    * . Pieter Donker
    * Purpose:
    * . opc-ua to ucp translator
    * Description:
    * . 
    * *********************************************************************** */
    
    #ifndef __UTIL_H__
    #define __UTIL_H__
    
    #include <string>
    #include <vector>
    #include <ctime>
    #include <sstream>
    #include <chrono>
    #include <cstring>
    
    #include "../registers.h"
    
    class Tictoc {
    private:
      std::string name;
      std::clock_t c_start;
      std::chrono::high_resolution_clock::time_point t_start;
    public:
      Tictoc() {};
      ~Tictoc() {};
      void tic(std::string idstr="");
      void toc(void);
    };
    
    class TermOutput {
    public:
    
    #define SIZE400K    400000
    #define SIZE1STRING 100
    
      char val[SIZE400K];
      unsigned int nof_vals;
      int datatype;
    
      TermOutput() {}
      ~TermOutput() {};
    
      void clear(void) {
          nof_vals = 0;
          datatype = 0;
          std::memset((void *)val, 0, SIZE400K);
      }
    };
    
    
    unsigned int next_power_of_2(unsigned int v);
    unsigned int ceil_log2(unsigned int val);
    unsigned int ceil_div(unsigned int num, unsigned int den);
    std::vector<uint> unique_and_sort(std::vector<uint> v);
    void probe(std::string s);
    uint select_get_msb_downto_lsb(uint input, uint bit_msb, uint bit_lsb);
    uint select_set_msb_downto_lsb(uint input, uint bit_msb, uint bit_lsb);
    std::vector<std::vector<uint>> transpose(std::vector<std::vector<uint>> Rin);
    bool find_in_vector(std::vector<uint>& V, uint p);
    
    #endif // __UTIL_H__