origen_std_lib 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/application.rb +13 -0
- data/config/version.rb +1 -1
- data/stdlib/v93k/origen/Debug/liborigen.so +0 -0
- data/stdlib/v93k/origen/Debug/makefile +63 -0
- data/stdlib/v93k/origen/Debug/objects.mk +8 -0
- data/stdlib/v93k/origen/Debug/origen.d +1477 -0
- data/stdlib/v93k/origen/Debug/origen.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/helpers/console.d +1483 -0
- data/stdlib/v93k/origen/Debug/origen/helpers/console.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/helpers/misc.d +1483 -0
- data/stdlib/v93k/origen/Debug/origen/helpers/misc.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/helpers/subdir.mk +27 -0
- data/stdlib/v93k/origen/Debug/origen/site.d +1469 -0
- data/stdlib/v93k/origen/Debug/origen/site.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/subdir.mk +24 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/dc_measurement.d +1501 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/dc_measurement.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/frequency_measurement.d +1502 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/frequency_measurement.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/functional_test.d +1501 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/functional_test.o +0 -0
- data/stdlib/v93k/origen/Debug/origen/test_method/subdir.mk +30 -0
- data/stdlib/v93k/origen/Debug/origen/utils/subdir.mk +24 -0
- data/stdlib/v93k/origen/Debug/origen/utils/version.d +4 -0
- data/stdlib/v93k/origen/Debug/origen/utils/version.o +0 -0
- data/stdlib/v93k/origen/Debug/sources.mk +32 -0
- data/stdlib/v93k/origen/Debug/subdir.mk +24 -0
- data/stdlib/v93k/origen/Debug/test_methods/ApplyBin.d +1487 -0
- data/stdlib/v93k/origen/Debug/test_methods/ApplyBin.o +0 -0
- data/stdlib/v93k/origen/Debug/test_methods/DCMeasurement.d +1508 -0
- data/stdlib/v93k/origen/Debug/test_methods/DCMeasurement.o +0 -0
- data/stdlib/v93k/origen/Debug/test_methods/FrequencyMeasurement.d +1508 -0
- data/stdlib/v93k/origen/Debug/test_methods/FrequencyMeasurement.o +0 -0
- data/stdlib/v93k/origen/Debug/test_methods/FunctionalTest.d +1511 -0
- data/stdlib/v93k/origen/Debug/test_methods/FunctionalTest.o +0 -0
- data/stdlib/v93k/origen/Debug/test_methods/RecordBin.d +1487 -0
- data/stdlib/v93k/origen/Debug/test_methods/RecordBin.o +0 -0
- data/stdlib/v93k/origen/Debug/test_methods/subdir.mk +36 -0
- data/stdlib/v93k/origen/origen.cpp +22 -0
- data/stdlib/v93k/origen/origen.hpp +22 -0
- data/stdlib/v93k/origen/origen/helpers.hpp +44 -0
- data/stdlib/v93k/origen/origen/helpers/console.cpp +105 -0
- data/stdlib/v93k/origen/origen/helpers/misc.cpp +305 -0
- data/stdlib/v93k/origen/origen/site.cpp +220 -0
- data/stdlib/v93k/origen/origen/site.hpp +51 -0
- data/stdlib/v93k/origen/origen/test_method.hpp +17 -0
- data/stdlib/v93k/origen/origen/test_method/base.hpp +151 -0
- data/stdlib/v93k/origen/origen/test_method/dc_measurement.cpp +182 -0
- data/stdlib/v93k/origen/origen/test_method/dc_measurement.hpp +59 -0
- data/stdlib/v93k/origen/origen/test_method/frequency_measurement.cpp +109 -0
- data/stdlib/v93k/origen/origen/test_method/frequency_measurement.hpp +48 -0
- data/stdlib/v93k/origen/origen/test_method/functional_test.cpp +119 -0
- data/stdlib/v93k/origen/origen/test_method/functional_test.hpp +51 -0
- data/stdlib/v93k/origen/origen/utils.hpp +12 -0
- data/stdlib/v93k/origen/origen/utils/version.cpp +79 -0
- data/stdlib/v93k/origen/origen/utils/version.hpp +64 -0
- data/stdlib/v93k/origen/test_methods/ApplyBin.cpp +41 -0
- data/stdlib/v93k/origen/test_methods/DCMeasurement.cpp +127 -0
- data/stdlib/v93k/origen/test_methods/FrequencyMeasurement.cpp +91 -0
- data/stdlib/v93k/origen/test_methods/FunctionalTest.cpp +92 -0
- data/stdlib/v93k/origen/test_methods/RecordBin.cpp +48 -0
- metadata +60 -1
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Automatically-generated file. Do not edit!
|
3
|
+
################################################################################
|
4
|
+
|
5
|
+
# Add inputs and outputs from these tool invocations to the build variables
|
6
|
+
CPP_SRCS += \
|
7
|
+
../test_methods/ApplyBin.cpp \
|
8
|
+
../test_methods/DCMeasurement.cpp \
|
9
|
+
../test_methods/FrequencyMeasurement.cpp \
|
10
|
+
../test_methods/FunctionalTest.cpp \
|
11
|
+
../test_methods/RecordBin.cpp
|
12
|
+
|
13
|
+
OBJS += \
|
14
|
+
./test_methods/ApplyBin.o \
|
15
|
+
./test_methods/DCMeasurement.o \
|
16
|
+
./test_methods/FrequencyMeasurement.o \
|
17
|
+
./test_methods/FunctionalTest.o \
|
18
|
+
./test_methods/RecordBin.o
|
19
|
+
|
20
|
+
CPP_DEPS += \
|
21
|
+
./test_methods/ApplyBin.d \
|
22
|
+
./test_methods/DCMeasurement.d \
|
23
|
+
./test_methods/FrequencyMeasurement.d \
|
24
|
+
./test_methods/FunctionalTest.d \
|
25
|
+
./test_methods/RecordBin.d
|
26
|
+
|
27
|
+
|
28
|
+
# Each subdirectory must supply rules for building sources it contributes
|
29
|
+
test_methods/%.o: ../test_methods/%.cpp
|
30
|
+
@echo 'Building file: $<'
|
31
|
+
@echo 'Invoking: GCC C++ Compiler'
|
32
|
+
g++ -D_TM_CDIR='"/home/nxa21353/devices/jn518x_test_program.1.0.0.pre16/origen_std_lib/v93k/src/origen"' -I/opt/hp93000/soc/prod_com/include -I"/home/nxa21353/devices/jn518x_test_program.1.0.0.pre16/origen_std_lib/v93k/src/origen" -I/opt/hp93000/soc/prod_com/include/MAPI -I/opt/hp93000/soc/testmethod/include -I/opt/hp93000/soc/com/include -I/opt/hp93000/soc/pws/lib -I/opt/hp93000/soc/segments/tml/include -I/opt/hp93000/soc/segments/tml/include/ext_include -I/opt/hp93000/soc/prod_com/rdi/include -O0 -g3 -Wall -c -fmessage-length=0 -fpic -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
|
33
|
+
@echo 'Finished building: $<'
|
34
|
+
@echo ' '
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
/** @file */
|
2
|
+
#include "origen.hpp"
|
3
|
+
|
4
|
+
namespace Origen {
|
5
|
+
|
6
|
+
Utils::Version version() {
|
7
|
+
Utils::Version v(ORIGEN_VERSION);
|
8
|
+
return v;
|
9
|
+
}
|
10
|
+
|
11
|
+
vector<Site> Sites;
|
12
|
+
|
13
|
+
|
14
|
+
Site& site() {
|
15
|
+
return Sites[CURRENT_SITE_NUMBER()];
|
16
|
+
}
|
17
|
+
|
18
|
+
Site& site(int site) {
|
19
|
+
return Sites[site];
|
20
|
+
}
|
21
|
+
|
22
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#ifndef ORIGEN_HPP_INCLUDED
|
2
|
+
#define ORIGEN_HPP_INCLUDED
|
3
|
+
|
4
|
+
#define ORIGEN_VERSION "0.8.0"
|
5
|
+
|
6
|
+
#ifndef debugger
|
7
|
+
#define debugger __asm__("int $3");
|
8
|
+
#endif
|
9
|
+
|
10
|
+
#include "origen/utils.hpp"
|
11
|
+
#include "origen/helpers.hpp"
|
12
|
+
#include "origen/site.hpp"
|
13
|
+
|
14
|
+
namespace Origen {
|
15
|
+
|
16
|
+
extern vector<Site> Sites;
|
17
|
+
Utils::Version version();
|
18
|
+
Site& site();
|
19
|
+
Site& site(int site);
|
20
|
+
|
21
|
+
}
|
22
|
+
#endif
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#ifndef ORIGEN_HELPERS_INCLUDED
|
2
|
+
#define ORIGEN_HELPERS_INCLUDED
|
3
|
+
|
4
|
+
#include "mapi.hpp"
|
5
|
+
#include "rdi.hpp"
|
6
|
+
#include <string>
|
7
|
+
|
8
|
+
using namespace std;
|
9
|
+
|
10
|
+
namespace Origen {
|
11
|
+
|
12
|
+
string extractPinsFromGroup(const string&);
|
13
|
+
void synchronize(double = 1);
|
14
|
+
double calculateFrequency(const ARRAY_I&, double);
|
15
|
+
double calculatePeriod(const ARRAY_I&, double);
|
16
|
+
void overlaySubroutine(string, string, uint64_t, int);
|
17
|
+
void reverseOverlaySubroutine(string, string, uint64_t, int);
|
18
|
+
int numberOfOnes(uint32_t);
|
19
|
+
int64_t toInt (string, int = 0);
|
20
|
+
uint64_t toUInt (string, int = 0);
|
21
|
+
vector<string> split(const string&, char);
|
22
|
+
void split(const string&, char, vector<string>&);
|
23
|
+
string toHex (const uint64_t&);
|
24
|
+
string toStr (const uint64_t&);
|
25
|
+
void initializeSites();
|
26
|
+
void logParametricTest(string, int, double, LIMIT, string);
|
27
|
+
void logFunctionalTest(string, int, bool, string);
|
28
|
+
bool isPass(double, LIMIT);
|
29
|
+
string loStr(LIMIT);
|
30
|
+
string hiStr(LIMIT);
|
31
|
+
string upcase(string);
|
32
|
+
string lpad(string, int, char);
|
33
|
+
string rpad(string, int, char);
|
34
|
+
bool isEven(uint64_t);
|
35
|
+
bool isOdd(uint64_t);
|
36
|
+
LIMIT noLimits();
|
37
|
+
uint64_t flip(uint64_t, int);
|
38
|
+
string ltrim(string, const char * remove_chars = " \n\t\r\f\v");
|
39
|
+
string rtrim(string, const char * remove_chars = " \n\t\r\f\v");
|
40
|
+
string trim(string, const char * remove_chars = " \n\t\r\f\v");
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
#endif
|
@@ -0,0 +1,105 @@
|
|
1
|
+
/** @file */
|
2
|
+
#include "../helpers.hpp"
|
3
|
+
#include <cerrno>
|
4
|
+
#include <stdlib.h>
|
5
|
+
#include "../../origen.hpp"
|
6
|
+
|
7
|
+
using namespace std;
|
8
|
+
|
9
|
+
namespace Origen {
|
10
|
+
|
11
|
+
/// Prints the result of a parametric test to the console
|
12
|
+
void logParametricTest(string name, int site, double result, LIMIT limits, string pin) {
|
13
|
+
|
14
|
+
cout << site << " ";
|
15
|
+
if (isPass(result, limits))
|
16
|
+
cout << " ";
|
17
|
+
else
|
18
|
+
cout << "FAIL ";
|
19
|
+
cout << left << setw(65) << setfill(' ') << name << " ";
|
20
|
+
cout << left << setw(20) << setfill(' ') << loStr(limits) << " ";
|
21
|
+
cout << left << setw(20) << setfill(' ') << result;
|
22
|
+
cout << left << setw(20) << setfill(' ') << hiStr(limits);
|
23
|
+
cout << pin << endl;
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
/// Returns a LIMIT object with no limits enabled
|
28
|
+
LIMIT noLimits() {
|
29
|
+
return LIMIT(TM::NA, 0, TM::NA, 0);
|
30
|
+
}
|
31
|
+
|
32
|
+
/// Prints the result of a functional test to the console
|
33
|
+
void logFunctionalTest(string name, int site, bool passed, string pattern) {
|
34
|
+
cout << site << " ";
|
35
|
+
if (passed)
|
36
|
+
cout << " ";
|
37
|
+
else
|
38
|
+
cout << "FAIL ";
|
39
|
+
cout << left << setw(65) << setfill(' ') << name << " ";
|
40
|
+
cout << pattern << endl;
|
41
|
+
}
|
42
|
+
|
43
|
+
/// Converts the low limit in the given LIMIT object into a string, where an empty string will be returned if the limit is not enabled
|
44
|
+
string loStr(LIMIT limits) {
|
45
|
+
double lo = 0.0;
|
46
|
+
double * plo = &lo;
|
47
|
+
TM::COMPARE clo;
|
48
|
+
|
49
|
+
clo = limits.getLow(plo);
|
50
|
+
|
51
|
+
if (clo == TM::NA) {
|
52
|
+
return "";
|
53
|
+
} else {
|
54
|
+
stringstream val;
|
55
|
+
val << lo;
|
56
|
+
return val.str();
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
/// Converts the high limit in the given LIMIT object into a string, where an empty string will be returned if the limit is not enabled
|
61
|
+
string hiStr(LIMIT limits) {
|
62
|
+
double hi = 0.0;
|
63
|
+
double * phi = &hi;
|
64
|
+
TM::COMPARE chi;
|
65
|
+
|
66
|
+
chi = limits.getHigh(phi);
|
67
|
+
|
68
|
+
if (chi == TM::NA) {
|
69
|
+
return "";
|
70
|
+
} else {
|
71
|
+
stringstream val;
|
72
|
+
val << hi;
|
73
|
+
return val.str();
|
74
|
+
}
|
75
|
+
}
|
76
|
+
/// Returns true if the result is within the given limits
|
77
|
+
bool isPass(double val, LIMIT limits) {
|
78
|
+
double lo = 0.0;
|
79
|
+
double hi = 0.0;
|
80
|
+
double * plo = &lo;
|
81
|
+
double * phi = &hi;
|
82
|
+
TM::COMPARE clo, chi;
|
83
|
+
bool result;
|
84
|
+
|
85
|
+
clo = limits.getLow(plo);
|
86
|
+
chi = limits.getHigh(phi);
|
87
|
+
|
88
|
+
result = true;
|
89
|
+
|
90
|
+
if (clo != TM::NA) {
|
91
|
+
if (clo == TM::GE && val < lo)
|
92
|
+
result = false;
|
93
|
+
if (clo == TM::GT && val <= lo)
|
94
|
+
result = false;
|
95
|
+
}
|
96
|
+
if (chi != TM::NA) {
|
97
|
+
if (chi == TM::LE && val > hi)
|
98
|
+
result = false;
|
99
|
+
if (chi == TM::LT && val >= hi)
|
100
|
+
result = false;
|
101
|
+
}
|
102
|
+
return result;
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
@@ -0,0 +1,305 @@
|
|
1
|
+
/** @file */
|
2
|
+
#include "../helpers.hpp"
|
3
|
+
#include <cerrno>
|
4
|
+
#include <stdlib.h>
|
5
|
+
#include "../../origen.hpp"
|
6
|
+
|
7
|
+
using namespace std;
|
8
|
+
|
9
|
+
namespace Origen {
|
10
|
+
|
11
|
+
|
12
|
+
uint64_t flip(uint64_t input, int size) {
|
13
|
+
uint64_t output = 0;
|
14
|
+
for (int i = 0; i < size; i++) {
|
15
|
+
output <<= 1;
|
16
|
+
output |= input & 1;
|
17
|
+
input >>= 1;
|
18
|
+
}
|
19
|
+
return output;
|
20
|
+
}
|
21
|
+
|
22
|
+
|
23
|
+
/// Split the given string by the given delimiter and return the results in a vector of strings
|
24
|
+
///
|
25
|
+
/// split("AB1234-24", '-') // => ["AB1234", "24"]
|
26
|
+
vector<string> split(const string &str, char delim) {
|
27
|
+
vector<string> elems;
|
28
|
+
split(str, delim, elems);
|
29
|
+
return elems;
|
30
|
+
}
|
31
|
+
|
32
|
+
/// This version places the result in the supplied vector rather than returning a new one
|
33
|
+
void split(const string &str, char delim, vector<string> &elems) {
|
34
|
+
stringstream ss;
|
35
|
+
ss.str(str);
|
36
|
+
string item;
|
37
|
+
while (getline(ss, item, delim)) {
|
38
|
+
elems.push_back(item);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
///
|
43
|
+
string ltrim(string str, const char * remove_chars /* = " \n\t\r\f\v" */) {
|
44
|
+
str.erase(0, str.find_first_not_of(remove_chars));
|
45
|
+
return str;
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
string rtrim(string str, const char * remove_chars /* = " \n\t\r\f\v" */) {
|
50
|
+
str.erase(str.find_last_not_of(remove_chars)+1);
|
51
|
+
return str;
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
string trim(string str, const char * remove_chars /* = " \n\t\r\f\v" */) {
|
56
|
+
str = rtrim(str, remove_chars);
|
57
|
+
str = ltrim(str, remove_chars);
|
58
|
+
return str;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
/// Convert the given string to a 64-bit integer. Works for both decimal and hex strings as
|
63
|
+
/// shown in the examples below.
|
64
|
+
///
|
65
|
+
/// If the string is not successfully converted the site in focus will be binned out.
|
66
|
+
///
|
67
|
+
/// toInt("0xFF") // => 255
|
68
|
+
/// toInt("FF", 16) // => 255 (must declare base 16 if no leading 0x)
|
69
|
+
/// toInt("255") // => 255
|
70
|
+
int64_t toInt (string str, int base)
|
71
|
+
{
|
72
|
+
str = trim(str); // Remove any whitespace
|
73
|
+
str = ltrim(str, "0"); // Remove any leading 0's
|
74
|
+
if (str == "") {
|
75
|
+
return 0;
|
76
|
+
}
|
77
|
+
char *end;
|
78
|
+
char *cstr = const_cast<char*>(str.c_str());
|
79
|
+
long long int l;
|
80
|
+
errno = 0;
|
81
|
+
l = strtoll(cstr, &end, base);
|
82
|
+
if ((errno == ERANGE && l == LLONG_MAX) || l > LLONG_MAX) {
|
83
|
+
cout << "ERROR: String conversion overflowed a 64-bit integer - " << str << endl;
|
84
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
85
|
+
}
|
86
|
+
if ((errno == ERANGE && l == LLONG_MIN) || l < LLONG_MIN) {
|
87
|
+
cout << "ERROR: String conversion underflowed a 64-bit integer - " << str << endl;
|
88
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
89
|
+
}
|
90
|
+
if (*cstr == '\0' || *end != '\0') {
|
91
|
+
cout << "ERROR: String is not convertible to a 64-bit integer - " << str << endl;
|
92
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
93
|
+
}
|
94
|
+
return (int64_t) l;
|
95
|
+
}
|
96
|
+
|
97
|
+
/// See toInt, but returns an unsigned 64-bit integer
|
98
|
+
uint64_t toUInt (string str, int base)
|
99
|
+
{
|
100
|
+
str = trim(str); // Remove any whitespace
|
101
|
+
str = ltrim(str, "0"); // Remove any leading 0's
|
102
|
+
if (str == "") {
|
103
|
+
return 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
char *end;
|
107
|
+
char *cstr = const_cast<char*>(str.c_str());
|
108
|
+
unsigned long long int l;
|
109
|
+
errno = 0;
|
110
|
+
l = strtoull(cstr, &end, base);
|
111
|
+
if (errno == ERANGE && l == ULLONG_MAX) {
|
112
|
+
cout << "ERROR: String conversion was out of the range of a UInt64 - " << str << endl;
|
113
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
114
|
+
}
|
115
|
+
if (*cstr == '\0' || *end != '\0') {
|
116
|
+
cout << "ERROR: String is not convertible to a UInt64 - " << str << endl;
|
117
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
118
|
+
}
|
119
|
+
return (uint64_t) l;
|
120
|
+
}
|
121
|
+
|
122
|
+
/// Convert the given number to a hex string
|
123
|
+
///
|
124
|
+
/// toHex(255); // => "ff"
|
125
|
+
string toHex (const uint64_t &val)
|
126
|
+
{
|
127
|
+
stringstream stream;
|
128
|
+
stream << hex << val;
|
129
|
+
return stream.str();
|
130
|
+
}
|
131
|
+
|
132
|
+
/// Convert the given number to a string
|
133
|
+
///
|
134
|
+
/// toStr(255); // => "255"
|
135
|
+
string toStr (const uint64_t &val)
|
136
|
+
{
|
137
|
+
stringstream stream;
|
138
|
+
stream << val;
|
139
|
+
return stream.str();
|
140
|
+
}
|
141
|
+
|
142
|
+
/// Uppercase the given string
|
143
|
+
///
|
144
|
+
/// upcase("ff"); // => "FF"
|
145
|
+
string upcase(string base) {
|
146
|
+
transform(base.begin(), base.end(), base.begin(), ::toupper);
|
147
|
+
return base;
|
148
|
+
}
|
149
|
+
|
150
|
+
/// Extend the string to the given size, padding with the given character on the left
|
151
|
+
///
|
152
|
+
/// lpad("FF", 4, '0'); // => "00FF"
|
153
|
+
string lpad(string base, int length, char fill) {
|
154
|
+
stringstream padded;
|
155
|
+
padded << right << setw(length) << setfill(fill) << base;
|
156
|
+
return padded.str();
|
157
|
+
}
|
158
|
+
|
159
|
+
/// Extend the string to the given size, padding with the given character on the right
|
160
|
+
///
|
161
|
+
/// rpad("FF", 4, ' '); // => "FF "
|
162
|
+
string rpad(string base, int length, char fill) {
|
163
|
+
stringstream padded;
|
164
|
+
padded << left << setw(length) << setfill(fill) << base;
|
165
|
+
return padded.str();
|
166
|
+
}
|
167
|
+
|
168
|
+
/// Returns true if the given number is even
|
169
|
+
bool isEven(uint64_t number) {
|
170
|
+
return number % 2 == 0;
|
171
|
+
}
|
172
|
+
|
173
|
+
/// Returns true if the given number is odd
|
174
|
+
bool isOdd(uint64_t number) {
|
175
|
+
return number % 2 != 0;
|
176
|
+
}
|
177
|
+
|
178
|
+
/// Overlays the given data on the given pin, starting from the first vector of the given pattern
|
179
|
+
void overlaySubroutine(string subroutinePattern, string pin, uint64_t data, int size) {
|
180
|
+
string p = extractPinsFromGroup(pin);
|
181
|
+
string pat = subroutinePattern;
|
182
|
+
VEC_LABEL_EDIT ov(pat, p);
|
183
|
+
|
184
|
+
// Need to use a vector here so the size can be determined at runtime
|
185
|
+
vector<VECTOR_DATA> vecData(size);
|
186
|
+
|
187
|
+
for(int i = 0; i < size; i++) {
|
188
|
+
int val = (data & (1 << i)) >> i;
|
189
|
+
VECTOR_DATA v = {i, val};
|
190
|
+
vecData[i] = v;
|
191
|
+
}
|
192
|
+
|
193
|
+
// However the downloadUserVectors function only accepts an array, so use this trick
|
194
|
+
// to create an array instance that points to the vector data
|
195
|
+
VECTOR_DATA * vecDataArray = &vecData[0];
|
196
|
+
|
197
|
+
ov.downloadUserVectors(vecDataArray, size);
|
198
|
+
}
|
199
|
+
|
200
|
+
/// Same as overlaySubroutine but the data is applied in reverse order
|
201
|
+
void reverseOverlaySubroutine(string subroutinePattern, string pin, uint64_t data, int size) {
|
202
|
+
string p = extractPinsFromGroup(pin);
|
203
|
+
string pat = subroutinePattern;
|
204
|
+
VEC_LABEL_EDIT ov(pat, p);
|
205
|
+
|
206
|
+
// Need to use a vector here so the size can be determined at runtime
|
207
|
+
vector<VECTOR_DATA> vecData(size);
|
208
|
+
|
209
|
+
for(int i = 0; i < size; i++) {
|
210
|
+
int j = size - 1 - i;
|
211
|
+
int val = (data & (1 << j)) >> j;
|
212
|
+
VECTOR_DATA v = {i, val};
|
213
|
+
vecData[i] = v;
|
214
|
+
}
|
215
|
+
|
216
|
+
// However the downloadUserVectors function only accepts an array, so use this trick
|
217
|
+
// to create an array instance that points to the vector data
|
218
|
+
VECTOR_DATA * vecDataArray = &vecData[0];
|
219
|
+
|
220
|
+
ov.downloadUserVectors(vecDataArray, size);
|
221
|
+
}
|
222
|
+
|
223
|
+
/// Returns the number of 1's (bits that are set) in the given 32-bit number
|
224
|
+
int numberOfOnes(uint32_t i)
|
225
|
+
{
|
226
|
+
i = i - ((i >> 1) & 0x55555555);
|
227
|
+
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
|
228
|
+
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
|
229
|
+
}
|
230
|
+
|
231
|
+
|
232
|
+
double calculateFrequency(const ARRAY_I &captureData, double periodInNs) {
|
233
|
+
int iFreqCount;
|
234
|
+
double dFreq_MHz;
|
235
|
+
|
236
|
+
iFreqCount=0;
|
237
|
+
for(int j=0; j<captureData.size()-1; j++)
|
238
|
+
{
|
239
|
+
if((captureData[j+1] - captureData[j]) == 1){
|
240
|
+
iFreqCount++;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
dFreq_MHz = iFreqCount / ((periodInNs / 1000) * captureData.size());
|
244
|
+
return dFreq_MHz * 1000000;
|
245
|
+
}
|
246
|
+
|
247
|
+
double calculatePeriod(const ARRAY_I &captureData, double periodInNs) {
|
248
|
+
return 1 / calculateFrequency(captureData, periodInNs);
|
249
|
+
}
|
250
|
+
|
251
|
+
/// Call to wait for all SMC threads to complete, supply the max amount of seconds to wait
|
252
|
+
void synchronize(double timeout)
|
253
|
+
{
|
254
|
+
bool ok;
|
255
|
+
int site = CURRENT_SITE_NUMBER();
|
256
|
+
|
257
|
+
if (timeout) {
|
258
|
+
ok = SMC_SYNCHRONIZE(timeout s);
|
259
|
+
} else {
|
260
|
+
ok = SMC_SYNCHRONIZE();
|
261
|
+
}
|
262
|
+
|
263
|
+
if (! ok) {
|
264
|
+
cout << "ERROR: All SMC threads not complete after " << timeout << " second(s) on site " << site << endl;
|
265
|
+
ERROR_EXIT(TM::EXIT_FLOW);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
/// Supply a pin alias name and get the name of the physical pin returned
|
270
|
+
string extractPinsFromGroup(const string& groupname)
|
271
|
+
{
|
272
|
+
string pinlist;
|
273
|
+
|
274
|
+
try{
|
275
|
+
pinlist = PinUtility.createPinListFromPinNames(PinUtility.getDigitalPinNamesFromPinList(groupname, TM::ALL_DIGITAL,true,true,PIN_UTILITY::DEFINITION_ORDER));
|
276
|
+
} catch(...) {
|
277
|
+
cout << "ERROR: Pingroup " << groupname << " not found." << endl;
|
278
|
+
ERROR_EXIT(TM::ABORT_FLOW);
|
279
|
+
}
|
280
|
+
|
281
|
+
return pinlist;
|
282
|
+
}
|
283
|
+
|
284
|
+
// Initializes the site objects that are used to store the ECID, this should be called at
|
285
|
+
// the start of the test flow if using the Origen.site API
|
286
|
+
void initializeSites() {
|
287
|
+
INT num_of_sites;
|
288
|
+
ARRAY_I sites;
|
289
|
+
|
290
|
+
ON_FIRST_INVOCATION_BEGIN();
|
291
|
+
|
292
|
+
num_of_sites = GET_CONFIGURED_SITES(sites);
|
293
|
+
|
294
|
+
// Leave an empty space at 0, easier then to fetch by site number (which start at 1)
|
295
|
+
Origen::Sites.resize(num_of_sites + 1, Origen::Site(0));
|
296
|
+
|
297
|
+
ON_FIRST_INVOCATION_END();
|
298
|
+
|
299
|
+
// Instantiate a new site object and save it in the global site array
|
300
|
+
Origen::Site site(CURRENT_SITE_NUMBER());
|
301
|
+
|
302
|
+
Origen::Sites[CURRENT_SITE_NUMBER()] = site;
|
303
|
+
}
|
304
|
+
|
305
|
+
}
|