forked from CMU-SAFARI/Shifted-Hamming-Distance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvector_filterMain.c
160 lines (127 loc) · 4.76 KB
/
vector_filterMain.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* vector_filterMain.c
*
* Created on: Nov 12, 2013
* Author: hxin
*/
//#ifndef BOOST_PP_IS_ITERATING
//#include "print.h"
#include <stdint.h>
#include "vector_filter.h"
#include <stdio.h>
#include <string.h>
#include <nmmintrin.h>
#include <emmintrin.h>
#include "mask.h"
/*
#include <boost/preprocessor/repetition.hpp>
#include <boost/preprocessor/iteration.hpp>
#include <boost/preprocessor/arithmetic.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#define SSE_BIT_LENGTH 128
#define BASE_SIZE 2
#define SSE_BASE_NUM BOOST_PP_DIV(SSE_BIT_LENGTH, BASE_SIZE)
#define BYTE_BASE_NUM BOOST_PP_DIV(8, BASE_SIZE)
#define SSE_BYTE_NUM BOOST_PP_DIV(SSE_BIT_LENGTH, 8)
uint8_t MASK_SSE_END[SSE_BIT_LENGTH * SSE_BYTE_NUM / BASE_SIZE] = {
#define BOOST_PP_ITERATION_LIMITS (0, SSE_BIT_LENGTH / 2 - 1)
#define BOOST_PP_FILENAME_1 "vector_filterMain.c" // this file
#include BOOST_PP_ITERATE()
#else // BOOST_PP_IS_ITERATING
#define I BOOST_PP_ITERATION()
#define PRINT_DATA(z, n, data) data
#define FF_NUM BOOST_PP_DIV(I, BYTE_BASE_NUM)
BOOST_PP_ENUM(FF_NUM, PRINT_DATA, 0xff)
#if FF_NUM != 0
BOOST_PP_COMMA()
#endif //FF_NUM != 0
#if BOOST_PP_MOD(I, BYTE_BASE_NUM) == 1
0x03
#elif BOOST_PP_MOD(I, BYTE_BASE_NUM) == 2
0x0f
#elif BOOST_PP_MOD(I, BYTE_BASE_NUM) == 3
0x3f
#else
0x00
#endif //End of switch
#define ZZ_NUM BOOST_PP_SUB( BOOST_PP_SUB(SSE_BYTE_NUM, 1), FF_NUM)
#if ZZ_NUM != 0
BOOST_PP_COMMA()
#endif //ZZ_NUM != 0
BOOST_PP_ENUM(ZZ_NUM, PRINT_DATA, 0x00)
#if I != BOOST_PP_ITERATION_FINISH()
BOOST_PP_COMMA()
#endif // I != BOOST_PP_ITERATION_FINISH()
#undef FF_NUM
#undef ZZ_NUM
#undef I
#undef PRINT_DATA
#endif // BOOST_PP_IS_ITERATING
#ifndef BOOST_PP_IS_ITERATING
};
*/
#define _MAX_LENGTH_ 320
char read_t[_MAX_LENGTH_] __aligned__;
char ref_t[_MAX_LENGTH_] __aligned__;
//uint8_t read_bit_t[_MAX_LENGTH_ / 4] __aligned__;
//uint8_t ref_bit_t[_MAX_LENGTH_ / 4] __aligned__;
int main(int argc, char* argv[]) {
int length = 128;
int error = 0;
int repeat_count = 10000;
int average_loc = 10;
strcpy(read_t,
"AAAAAAAAAAAAAGACTAACCACCTTGTCCTGTTGTCTGTCTGGTCAGCCAATCATTGGGACCACACACCCCAGCATCGTGGACTGCGTGCTGAAGGTGC");
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTTTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATG");
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTCATCAGCTATACGGCTTCGGCAACCTTGAGGGGCCGCGCCCCGTTACCCTTTATACGTTTCCCGGGCAAGCCTTCGTGTGGGAGCATATGTATATGG");
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGTGGCCGCGGCCCGTTACACTTTATACGTTATCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATG");
strcpy(ref_t,
"AAAAAAAAAAAAAGACTAACCACCTTGTCCTGTTGTCTGTCTGGTCAGCCAATCATTGGGACCACACACCCCAGCATGGTGGACTGCGTGCTGAAGGGGC");
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCCGTCGGCAACCTTGAGGGGTCGCGCCCCGTTACACTTTATACGTTTACCATTGCAAGCCTTCGTGTCGGAGCATATGTATA");
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCT ACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTTTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATG");
// "TCGCTAGTTAGCCGGACCTAAAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTCTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATGG");
if (argc >= 2)
length = atoi(argv[1]);
if (argc >= 3)
error = atoi(argv[2]);
if (argc >= 4)
repeat_count = atoi(argv[3]);
if (argc >= 5)
average_loc = atoi(argv[4]);
// for (int i = 0; i < SSE_BIT_LENGTH * SSE_BYTE_NUM / BASE_SIZE1; i++) {
// if (i % SSE_BYTE_NUM == 0)
// printf("\n");
// printf("%x ", MASK_SSE_END1[i]);
// }
// if (read_t[repeat_count] = 'A')
// read_t[repeat_count] = 'C';
// else
// read_t[repeat_count] = 'A';
// printf("\n");
// while (repeat_count--)
// bit_vec_filter_sse_simulate11(read_t, ref_t, length, error, average_loc);
// while (repeat_count--)
// bit_vec_filter_sse_simulate1(read_t, ref_t, length, error, average_loc);
// if (bit_vec_filter_sse11(read_t, ref_t, length, error))
// printf("Pass Filter\n");
// else
// printf("Fail Filter\n");
//
if (bit_vec_filter_sse1(read_t, ref_t, length, error))
printf("Pass Filter\n");
else
printf("Fail Filter\n");
// strcpy(read_t,
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTTTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATG");
//// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTTTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATGG");
// strcpy(ref_t,
// "TCGCTAGTAGCCGGAACTAACAGGTAGGCCTACATCAGCTATACGGCCGTCGGCAACCTTGAGGGGTCGCGCCCCGTTACACTTTATACGTTTACCATTGCAAGCCTTCGTGTCGGAGCATATGTATA");
//// "TCGCTAGTTAGCCGGACCTAAAGGTAGGCCTACATCAGCTATACGGCATCGGCAACCTTGAGGGGCCGCGCCCCGTTACACTTTATACGTTTCCCTTGCAAGCCTTCGTGTCGGAGCATATGTATATGG");
//
// if (bit_vec_filter_no_flipping_sse1(read_t, ref_t, length, error))
// printf("Pass Filter\n");
// else
// printf("Fail Filter\n");
return 0;
}
//#endif