-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitmath.h
30 lines (26 loc) · 1.14 KB
/
bitmath.h
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
/*******************************************************************************
*
* This module contains delta-sigma arithmetic operators.
*
* Reference:
* Chiu-wa Ng (2009) -- Bit-stream signal processing on FPGA.
* http://hub.hku.hk/handle/10722/54513
*
* Copyright (c) Dario Sanfilippo 2021.
*
*******************************************************************************/
#ifndef BITMATH
#define BITMATH
typedef struct FullAdder FullAdder;
void fulladder(Sig* in0, Sig* in1, Sig* in2, Sig* out0, Sig* out1,
size_t in_vec_id0, size_t in_vec_id1, size_t in_vec_id2,
size_t out_vec_id0, size_t out_vec_id1);
FullAdder fulladder_samplewise(bool in0, bool in1, bool c_in);
void binaryadder(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0,
size_t in_vec_id1, size_t out_vec_id);
bool binaryadder_samplewise(bool in0, bool in1, bool* state);
void binarymultiplier(Sig* in0, Sig* in1, Sig* out, size_t in_vec_id0,
size_t in_vec_id1, size_t out_vec_id);
void bi2uni(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
void uni2bi(Sig* in, Sig* out, size_t in_vec_id, size_t out_vec_id);
#endif