name stringlengths 6 30 | function_name stringlengths 4 28 | c_src stringlengths 60 6.91k |
|---|---|---|
core_init_matrix.c | core_init_matrix | #include <stdint.h>
#include <stdio.h>
typedef unsigned short u16;
/* align an offset to point to a 32b value */
#define align_mem(x) (void *)(4 + (((uintptr_t)(x)-1) & ~3))
#define matrix_clip(x, y) ((y) ? (x) & 0x0ff : (x) & 0x0ffff)
typedef struct MAT_PARAMS_S {
int N;
short *A;
short *B;
int *C;
} mat_par... |
get_time.c | get_time | #include <time.h>
extern struct timespec start_time_val, stop_time_val;
clock_t get_time(void) {
clock_t elapsed =
((stop_time_val.tv_sec - start_time_val.tv_sec) * 1000 +
(stop_time_val.tv_nsec - start_time_val.tv_nsec) / 1000000);
return elapsed;
} |
portable_init.c | portable_init | typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
void portable_init(core_portable *p) { p->portable_id = 1; } |
core_list_find.c | core_list_find | typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
list_head *core_list_find(list_head *list, list_data *info) {
if (info->idx >= 0) {
while (list && (list->info->idx != info->idx))
list =... |
copy_info.c | copy_info | typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
void copy_info(list_data *to, list_data *from) {
to->data16 = from->data16;
to->idx = from->idx;
} |
main.c | main | #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head... |
cmp_complex.c | cmp_complex | #include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typedef... |
stop_time.c | stop_time | #include <time.h>
extern struct timespec start_time_val, stop_time_val;
void stop_time(void) { clock_gettime(CLOCK_REALTIME, &stop_time_val); } |
portable_free.c | portable_free | #include <stdlib.h>
void portable_free(void *p) { free(p); } |
crc16.c | crc16 | typedef unsigned short u16;
typedef unsigned char u8;
u16 crcu16(u16 newval, u16 crc);
u16 crc16(short newval, u16 crc) { return crcu16((u16)newval, crc); } |
calc_func.c | calc_func | typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typedef struct MAT_PARAMS_... |
core_list_insert_new.c | core_list_insert_new | #include <stdio.h>
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
void copy_info(list_data *to, list_data *from);
list_head *core_list_insert_new(list_head *insert_point, list_data *info,
... |
portable_fini.c | portable_fini | typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
void portable_fini(core_portable *p) { p->portable_id = 0; } |
core_list_remove.c | core_list_remove | #include <stdio.h>
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
list_head *core_list_remove(list_head *item) {
list_data *tmp;
list_head *ret = item->next;
/* swap data pointers */
tmp =... |
core_list_mergesort.c | core_list_mergesort | #include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typed... |
crcu32.c | crcu32 | typedef unsigned short u16;
typedef unsigned char u8;
u16 crc16(short newval, u16 crc);
u16 crcu32(unsigned newval, u16 crc) {
crc = crc16((short)newval, crc);
crc = crc16((short)(newval >> 16), crc);
return crc;
} |
matrix_mul_matrix_bitextract.c | matrix_mul_matrix_bitextract | #define bit_extract(x, from, to) (((x) >> (from)) & (~(0xffffffff << (to))))
void matrix_mul_matrix_bitextract(unsigned N, int *C, short *A, short *B) {
unsigned i, j, k;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
C[i * N + j] = 0;
for (k = 0; k < N; k++) {
int tmp = (int)A[i * N +... |
crcu8.c | crcu8 | typedef unsigned short u16;
typedef unsigned char u8;
u16 crcu8(u8 data, u16 crc) {
u8 i = 0, x16 = 0, carry = 0;
for (i = 0; i < 8; i++) {
x16 = (u8)((data & 1) ^ ((u8)crc & 1));
data >>= 1;
if (x16 == 1) {
crc ^= 0x4002;
carry = 1;
} else
carry = 0;
crc >>= 1;
if (carry... |
matrix_add_const.c | matrix_add_const | void matrix_add_const(unsigned N, short *A, short val) {
unsigned i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
A[i * N + j] += val;
}
}
} |
crcu16.c | crcu16 | typedef unsigned short u16;
typedef unsigned char u8;
u16 crcu8(u8 data, u16 crc);
u16 crcu16(u16 newval, u16 crc) {
crc = crcu8((u8)(newval), crc);
crc = crcu8((u8)((newval) >> 8), crc);
return crc;
} |
core_list_init.c | core_list_init | #include <stdint.h>
#include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typedef struct MAT_PARAMS_S {
int N;
short *A;
sho... |
core_state_transition.c | core_state_transition | #include <stdint.h>
#include <stdio.h>
typedef unsigned char u8;
typedef enum CORE_STATE {
CORE_START = 0,
CORE_INVALID,
CORE_S1,
CORE_S2,
CORE_INT,
CORE_FLOAT,
CORE_EXPONENT,
CORE_SCIENTIFIC,
NUM_CORE_STATES
} core_state_e;
u8 ee_isdigit(u8 c);
enum CORE_STATE core_state_transition(u8 **instr, uns... |
core_bench_matrix.c | core_bench_matrix | #include <time.h>
#include <stdint.h>
#include <stdio.h>
typedef unsigned short u16;
typedef struct MAT_PARAMS_S {
int N;
short *A;
short *B;
int *C;
} mat_params;
u16 crc16(short newval, u16 crc);
short matrix_test(unsigned N, int *C, short *A, short *B, short val);
u16 core_bench_matrix(mat_params *p, short ... |
ee_isdigit.c | ee_isdigit | typedef unsigned char u8;
u8 ee_isdigit(u8 c) {
u8 retval;
retval = ((c >= '0') & (c <= '9')) ? 1 : 0;
return retval;
} |
core_init_state.c | core_init_state | typedef unsigned short u16;
typedef unsigned char u8;
/* Default initialization patterns */
static u8 *intpat[4] = {(u8 *)"5012", (u8 *)"1234", (u8 *)"-874", (u8 *)"+122"};
static u8 *floatpat[4] = {(u8 *)"35.54400", (u8 *)".1234500", (u8 *)"-110.700",
(u8 *)"+0.64400"};
static u8 *scipat[4] ... |
core_list_reverse.c | core_list_reverse | #include <stdio.h>
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
list_head *core_list_reverse(list_head *list) {
list_head *next = NULL, *tmp;
while (list) {
tmp = list->next;
list->n... |
matrix_test.c | matrix_test | #include <stdint.h>
#include <stdio.h>
typedef unsigned short u16;
#define matrix_big(x) (0xf000 | (x))
u16 crc16(short newval, u16 crc);
short matrix_sum(unsigned N, int *C, short clipval);
void matrix_mul_const(unsigned N, int *C, short *A, short val);
void matrix_mul_vect(unsigned N, int *C, short *A, short *B);
v... |
core_bench_list.c | core_bench_list | #include <stdint.h>
#include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typedef struct MAT_PARAMS_S {
int N;
short *A;
sho... |
time_in_secs.c | time_in_secs | #include <time.h>
double time_in_secs(clock_t ticks) {
double retval = ((double)ticks) / (double)1000;
return retval;
} |
cmp_idx.c | cmp_idx | #include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
typedef... |
matrix_sum.c | matrix_sum | short matrix_sum(unsigned N, int *C, short clipval) {
int tmp = 0, prev = 0, cur = 0;
short ret = 0;
unsigned i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
cur = C[i * N + j];
tmp += cur;
if (tmp > clipval) {
ret += 10;
tmp = 0;
} else {
ret += (cu... |
core_list_undo_remove.c | core_list_undo_remove | typedef struct list_data_s {
short data16;
short idx;
} list_data;
typedef struct list_head_s {
struct list_head_s *next;
struct list_data_s *info;
} list_head;
list_head *core_list_undo_remove(list_head *item_removed,
list_head *item_modified) {
list_data *tmp;
/* swap da... |
core_bench_state.c | core_bench_state | typedef unsigned short u16;
typedef unsigned char u8;
typedef enum CORE_STATE {
CORE_START = 0,
CORE_INVALID,
CORE_S1,
CORE_S2,
CORE_INT,
CORE_FLOAT,
CORE_EXPONENT,
CORE_SCIENTIFIC,
NUM_CORE_STATES
} core_state_e;
u16 crcu32(unsigned newval, u16 crc);
enum CORE_STATE core_state_transition(u8 **instr,... |
start_time.c | start_time | #include <time.h>
extern struct timespec start_time_val, stop_time_val;
void start_time(void) { clock_gettime(CLOCK_REALTIME, &start_time_val); } |
portable_malloc.c | portable_malloc | #include <stdlib.h>
void *portable_malloc(size_t size) { return malloc(size); } |
matrix_mul_vect.c | matrix_mul_vect | void matrix_mul_vect(unsigned N, int *C, short *A, short *B) {
unsigned i, j;
for (i = 0; i < N; i++) {
C[i] = 0;
for (j = 0; j < N; j++) {
C[i] += (int)A[i * N + j] * (int)B[j];
}
}
} |
matrix_mul_const.c | matrix_mul_const | void matrix_mul_const(unsigned N, int *C, short *A, short val) {
unsigned i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
C[i * N + j] = (int)A[i * N + j] * (int)val;
}
}
} |
iterate.c | iterate | #include <stdio.h>
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct CORE_PORTABLE_S {
u8 portable_id;
} core_portable;
typedef struct MAT_PARAMS_S {
int N;
short *A;
short *B;
int *C;
} mat_params;
typedef struct RESULTS_S {
short seed1;
short seed2;
sho... |
check_data_types.c | check_data_types | #include <stdio.h>
#include <stdint.h>
typedef unsigned short u16;
typedef unsigned char u8;
u8 check_data_types() {
u8 retval = 0;
if (sizeof(u8) != 1) {
printf("ERROR: u8 is not an 8b datatype!\n");
retval++;
}
if (sizeof(u16) != 2) {
printf("ERROR: u16 is not a 16b datatype!\n");
retval++;
... |
matrix_mul_matrix.c | matrix_mul_matrix | void matrix_mul_matrix(unsigned N, int *C, short *A, short *B) {
unsigned i, j, k;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) {
C[i * N + j] = 0;
for (k = 0; k < N; k++) {
C[i * N + j] += (int)A[i * N + k] * (int)B[k * N + j];
}
}
}
} |
README.md exists but content is empty.
- Downloads last month
- 4