Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
E
epics-wb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
misc
epics-wb
Commits
e3d669f5
Commit
e3d669f5
authored
Aug 18, 2015
by
Benoit Rat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
field: improve overflow, change mask by width in constuctor, test unit
parent
6b449c12
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
71 deletions
+173
-71
EWBField.cpp
src/ewbcore/EWBField.cpp
+99
-33
EWBField.h
src/ewbcore/EWBField.h
+12
-6
EWBField_test.cpp
test/EWBField_test.cpp
+29
-15
wbtest.h
test/files/wbtest.h
+33
-17
No files found.
src/ewbcore/EWBField.cpp
View file @
e3d669f5
...
...
@@ -17,6 +17,7 @@
#include <vector>
#include <cstdarg>
#include <ctype.h>
#include <limits>
#define TRACE_P_VDEBUG(...) //TRACE_P_DEBUG( __VA_ARGS__)
...
...
@@ -40,46 +41,60 @@
* if set to "inf" we keep 0 as default value. Does nothing when pReg is NULL.
*/
EWBField
::
EWBField
(
EWBReg
*
pReg
,
const
std
::
string
&
name
,
uint
32_t
mask
,
const
std
::
string
&
name
,
uint
8_t
width
,
uint8_t
shift
,
uint8_t
mode
,
const
std
::
string
&
desc
,
uint8_t
signess
,
uint8_t
nfb
,
double
iniVal
)
:
uint8_t
signess
,
uint8_t
nfb
,
int
index
,
double
iniVal
)
:
EWBParam
(
name
,
0
,
mode
,
desc
)
{
if
((
width
+
shift
)
>
32
)
TRACE_P_WARNING
(
"width (%d) + shift (%d) <= 32 bits"
,
width
,
shift
);
if
(
this
->
type
==
EWBF_32FP
)
{
if
((
width
>
nfb
)
==
false
)
TRACE_P_WARNING
(
"%s Width (%d) must be superior than nbfp (%d)"
,
getCName
(),
width
,
nfb
);
}
else
{
if
((
width
>=
nfb
)
==
false
)
TRACE_P_WARNING
(
"%s Width (%d) must be superior or equal than nbfp (%d)"
,
getCName
(),
width
,
nfb
);
}
this
->
pReg
=
pReg
;
this
->
mask
=
mask
;
this
->
width
=
width
;
this
->
shift
=
shift
;
this
->
type
=
(
signess
&
EWBF_TM_SIGNESS
);
if
(
nfb
>
0
)
this
->
type
|=
EWBF_TM_FIXED_POINT
;
this
->
nfb
=
nfb
;
this
->
forceSync
=
false
;
this
->
checkOverflow
=
true
;
this
->
mask
=
(((
1ULL
<<
width
)
-
1
)
<<
shift
);
TRACE_P_DEBUG
(
"%s type=0x%0x nfb=%d, dVal=%f"
,
name
.
c_str
(),
type
,
nfb
,
iniVal
);
int
i
=
1
;
for
(;
mask
;
mask
>>=
1
,
i
++
)
this
->
width
=
i
-
shift
;
if
(
this
->
type
==
EWBF_32FP
)
{
if
((
this
->
width
>
this
->
nfb
)
==
false
)
TRACE_P_WARNING
(
"%s Width (%d) must be superior than nbfp (%d)"
,
getCName
(),
width
,
nfb
);
}
else
{
if
((
this
->
width
>=
this
->
nfb
)
==
false
)
TRACE_P_WARNING
(
"%s Width (%d) must be superior or equal than nbfp (%d)"
,
getCName
(),
width
,
nfb
);
}
getLimit
(
vmin
,
vmax
);
if
(
nfb
>
0
)
{
TRACE_P_DEBUG
(
"%s type=0x%0x nfb=%d, dVal=%f (x%08x) [%f,%15f]"
,
name
.
c_str
(),
type
,
nfb
,
iniVal
,
mask
,
vmin
,
vmax
);
}
else
{
TRACE_P_DEBUG
(
"%s type=0x%0x nfb=%d, dVal=%f (x%08x) [%d,%d]"
,
name
.
c_str
(),
type
,
nfb
,
iniVal
,
mask
,(
uint32_t
)
vmin
,(
uint32_t
)
vmax
);
}
if
(
pReg
)
{
if
(
isinf
(
iniVal
))
pReg
->
addField
(
this
);
bool
added
;
if
(
isinf
(
iniVal
))
added
=
pReg
->
addField
(
this
,
index
);
else
{
float
dVal32
=
(
float
)
iniVal
;
this
->
convert
(
&
dVal32
,
false
);
pReg
->
addField
(
this
,
true
);
added
=
pReg
->
addField
(
this
,
index
,
true
);
}
if
(
added
==
false
)
this
->
pReg
=
NULL
;
//Remove linking
}
}
//EWBField::EWBField(EWBReg *pReg,const std::string &name, uint32_t mask)
//{
// int i = 1;
// for (; mask; mask >>= 1, i++)
// this->width=i-shift;
//}
/**
* Empty destructor
*/
...
...
@@ -88,6 +103,49 @@ EWBField::~EWBField()
}
void
EWBField
::
getLimit
(
float
&
fmin
,
float
&
fmax
)
{
float
ftmp
;
uint32_t
data
,
val
;
bool
checkOF_old
;
switch
(
type
)
{
case
EWBF_32U
:
//Unsigned integer
fmin
=
0.
f
;
fmax
=
(
float
)((
1ULL
<<
width
)
-
1
);
if
(
width
>
30
)
fmax
=
(
float
)((
1ULL
<<
30
)
-
1
);
break
;
case
EWBF_32I
:
//MSB Signed Integer
fmin
=-
((
float
)(
1ULL
<<
(
width
-
1
))
-
1
);
fmax
=
(
float
)(
1ULL
<<
(
width
-
1
))
-
1
;
break
;
case
EWBF_TM_SIGN_2COMP
:
//2C Signed Integer
fmin
=-
(
float
)(
1ULL
<<
(
width
-
1
));
fmax
=
(
float
)(
1ULL
<<
(
width
-
1
))
-
1
;
break
;
case
EWBF_TM_FIXED_POINT
:
//Unsigned Fixed Point (0x4)
fmin
=
0
;
fmax
=
(
float
)(
1ULL
<<
(
width
-
nfb
));
fmax
-=
1.
f
/
(
1ULL
<<
nfb
);
break
;
case
EWBF_32FP
:
//MSB Signed Fixed point (0x5)
fmax
=
(
float
)(
1ULL
<<
(
width
-
1
-
nfb
));
fmax
-=
1.
f
/
(
1ULL
<<
nfb
);
fmin
=-
fmax
;
break
;
case
EWBF_32F2C
:
//2C Signed Fixed point (0x6)
checkOF_old
=
checkOverflow
;
checkOverflow
=
false
;
val
=
(
1ULL
<<
(
width
-
1
));
this
->
regCvt
(
&
val
,
&
data
,
false
);
if
(
this
->
regCvt
(
&
ftmp
,
&
data
,
true
))
fmin
=
ftmp
;
val
--
;
this
->
regCvt
(
&
val
,
&
data
,
false
);
if
(
this
->
regCvt
(
&
ftmp
,
&
data
,
true
))
fmax
=
ftmp
;
checkOverflow
=
checkOF_old
;
break
;
}
}
/**
...
...
@@ -138,6 +196,21 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
bool
ret
=
false
;
uint32_t
fixed
,
utmp
;
float
ftmp
;
if
(
to_value
==
false
)
{
if
(
checkOverflow
==
false
)
ftmp
=*
value
;
else
{
if
(
*
value
>
vmax
)
ftmp
=
vmax
;
else
if
(
*
value
<
vmin
)
ftmp
=
vmin
;
else
ftmp
=*
value
;
}
}
switch
(
type
)
{
case
EWBF_32U
:
...
...
@@ -148,7 +221,7 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
fixed
=
(
uint32_t
)
round
(
*
value
);
fixed
=
(
uint32_t
)
round
(
ftmp
);
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
@@ -162,8 +235,8 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
fixed
=
(
uint32_t
)
round
(
fabs
(
*
value
))
&
~
utmp
;
if
(
*
value
<
0
)
fixed
|=
utmp
;
fixed
=
(
uint32_t
)
round
(
fabs
(
ftmp
))
&
~
utmp
;
if
(
ftmp
<
0
)
fixed
|=
utmp
;
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
@@ -181,8 +254,8 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
fixed
=
(
uint32_t
)
round
(
fabs
(
*
value
));
if
(
*
value
<
0
)
fixed
=
(
~
(
fixed
))
+
1
;
//convert absolute signed fixed point to 2C fixed point when value <0
fixed
=
(
uint32_t
)
round
(
fabs
(
ftmp
));
if
(
ftmp
<
0
)
fixed
=
(
~
(
fixed
))
+
1
;
//convert absolute signed fixed point to 2C fixed point when value <0
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
@@ -194,7 +267,7 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
fixed
=
(
uint32_t
)(
round
(
*
value
*
pow
(
2
,
this
->
nfb
)));
fixed
=
(
uint32_t
)(
round
(
ftmp
*
pow
(
2
,
this
->
nfb
)));
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
@@ -208,8 +281,8 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
fixed
=
(
uint32_t
)(
round
(
fabs
(
*
value
)
*
pow
(
2
,
this
->
nfb
)))
&
~
utmp
;
if
(
*
value
<
0
)
fixed
|=
utmp
;
fixed
=
(
uint32_t
)(
round
(
fabs
(
ftmp
)
*
pow
(
2
,
this
->
nfb
)))
&
~
utmp
;
if
(
ftmp
<
0
)
fixed
|=
utmp
;
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
@@ -227,15 +300,8 @@ bool EWBField::regCvt(float *value, uint32_t *reg_data, bool to_value) const
}
else
{
ftmp
=
fabs
(
*
value
);
if
(
checkOverflow
)
{
utmp
=
1
<<
((
this
->
width
-
this
->
nfb
)
-
1
);
if
(
ftmp
>=
utmp
)
ftmp
=
(
float
)
utmp
;
}
fixed
=
round
((
double
)
ftmp
*
(
double
)(
1ULL
<<
this
->
nfb
));
//convert to signed fixed point using absolute value
if
(
*
value
<
0
)
fixed
=
(
~
(
fixed
))
+
1
;
//convert absolute signed fixed point to 2C fixed point when value <0
fixed
=
round
((
double
)
fabs
(
ftmp
)
*
(
double
)(
1ULL
<<
this
->
nfb
));
//convert to signed fixed point using absolute value
if
(
ftmp
<
0
)
fixed
=
(
~
(
fixed
))
+
1
;
//convert absolute signed fixed point to 2C fixed point when value <0
ret
=
this
->
regCvt
(
&
fixed
,
reg_data
,
to_value
);
}
break
;
...
...
src/ewbcore/EWBField.h
View file @
e3d669f5
...
...
@@ -22,22 +22,25 @@
//! Shortcut for WBReg constructor arguments
#define WB2_REG_ARGS(pname,rname) \
WB2_TOKENPASTING_REG(pname,rname,_PREFIX),\
WB2_TOKENPASTING_REG(pname,rname,)
WB2_TOKENPASTING_REG(pname,rname,), \
WB2_TOKENPASTING_REG(pname,rname,_NFIELDS), \
WB2_TOKENPASTING_REG(pname,rname,_NAME)
//! Shortcut for WBField constructor arguments
#define WB2_FIELD_ARGS(pname,rname,fname) \
WB2_TOKENPASTING_FIELD(pname,rname,fname,_PREFIX),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_
MASK
),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_
SIZE
),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_SHIFT),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_ACCESS),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_DESC), \
WB2_TOKENPASTING_FIELD(pname,rname,fname,_SIGN),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_NBFP)
WB2_TOKENPASTING_FIELD(pname,rname,fname,_NBFP),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_INDEX)
//! Shortcut for WBField constructor arguments
#define WB2_FIELD_ARGS_VA(pname,rname,fname,...) \
WB2_TOKENPASTING_FIELD(pname,rname,fname,_PREFIX),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_
MASK
),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_
SIZE
),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_SHIFT),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_ACCESS),\
WB2_TOKENPASTING_FIELD(pname,rname,fname,_DESC),\
...
...
@@ -61,9 +64,9 @@ class EWBField: public EWBParam {
public
:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
EWBField
&
n
);
EWBField
(
EWBReg
*
pReg
,
const
std
::
string
&
name
,
uint
32_t
mask
,
uint8_t
shift
,
EWBField
(
EWBReg
*
pReg
,
const
std
::
string
&
name
,
uint
8_t
width
,
uint8_t
shift
,
uint8_t
mode
=
EWB_AM_RW
,
const
std
::
string
&
desc
=
""
,
uint8_t
signess
=
0
,
uint8_t
nfb
=
0
,
double
defVal
=
(
1
.
0
/
0
.
0
));
uint8_t
signess
=
0
,
uint8_t
nfb
=
0
,
int
index
=-
1
,
double
defVal
=
(
1
.
0
/
0
.
0
));
virtual
~
EWBField
();
...
...
@@ -90,11 +93,14 @@ public:
bool
isValid
(
bool
connected
)
const
{
return
(
pReg
&&
pReg
->
isValid
(
connected
));
}
protected
:
void
getLimit
(
float
&
fmin
,
float
&
fmax
);
uint32_t
mask
;
//!< Corresponding mask
uint8_t
shift
;
//!< Number of bit to be shift
uint8_t
width
;
//!< Width of the field
uint8_t
nfb
;
//!< Number of fraction bits
bool
checkOverflow
;
//!< Limit overflow during FP conversion
float
vmin
,
vmax
;
//!< Range that the user can use for this value
private
:
EWBReg
*
pReg
;
//! parent register which belong this field
...
...
test/EWBField_test.cpp
View file @
e3d669f5
...
...
@@ -199,13 +199,13 @@ TEST(EWBField,FullFixed)
uint32_t
reg
=
0
;
//Start playing with conversion
val
=-
0.
999991
;
val
=-
0.
499999
;
EXPECT_TRUE
(
f
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
f
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NEAR
(
val
,
valRbk
,
valErr
);
//Start playing with conversion
val
=
0.
999991
;
val
=
0.
499999
;
EXPECT_TRUE
(
f
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
f
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NEAR
(
val
,
valRbk
,
valErr
);
...
...
@@ -243,7 +243,6 @@ TEST(EWBField,Signess)
EXPECT_TRUE
(
fU
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
fU
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NE
(
val
,
valRbk
);
EXPECT_EQ
(
-
val
,
valRbk
);
EWBField
f1
=
EWBField
(
NULL
,
WB2_FIELD_ARGS
(
TEST
,
BSIGN
,
SIGN1
));
val
=
127
;
...
...
@@ -262,7 +261,7 @@ TEST(EWBField,Signess)
EXPECT_TRUE
(
f1
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
f1
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NE
(
val
,
valRbk
);
EXPECT_EQ
(
0
,
valRbk
);
//printf("x%x x%x\n",reg,regTmp);
...
...
@@ -297,7 +296,7 @@ TEST(EWBField,FixedSigness)
EXPECT_TRUE
(
fU
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
fU
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NE
(
val
,
valRbk
);
EXPECT_TRUE
(
valRbk
>
0
);
EXPECT_TRUE
(
valRbk
>
=
0
);
EWBField
f1
=
EWBField
(
NULL
,
WB2_FIELD_ARGS
(
TEST
,
BFIXED
,
SIGN1
));
val
=
(
1
-
step7
);
...
...
@@ -325,17 +324,32 @@ TEST(EWBField,FixedSigness)
//TEST(EWBField,Overflow)
//{
// EWBField f(NULL,WB2_FIELD_ARGS(TEST,CSR,NUMBER));
// uint32_t val=28389;
// f.convert(&val,true);
//Amp=-3;
//EXPECT_TRUE(fA.regCvt(&Amp,®,false));
//EXPECT_TRUE(fA.regCvt(&AmpRbk,®,true));
//EXPECT_NEAR(Amp,AmpRbk,AmpErr);
TEST
(
EWBField
,
Overflow
)
{
uint32_t
reg
=
0
;
float
val
,
valRbk
;
float
step8
=
1
/
(
256.
f
);
float
step7
=
1
/
(
128.
f
);
EWBField
fA
(
NULL
,
WB2_FIELD_ARGS
(
TEST
,
ADC
,
AMP
));
val
=
3
;
EXPECT_TRUE
(
fA
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
fA
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_NE
(
2
,
valRbk
);
EXPECT_NEAR
(
2
,
valRbk
,
0.01
);
//}
EWBField
fU
=
EWBField
(
NULL
,
WB2_FIELD_ARGS
(
TEST
,
BSIGN
,
U
));
val
=-
128
;
EXPECT_TRUE
(
fU
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
fU
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_EQ
(
0
,
valRbk
);
val
=
256
;
EXPECT_TRUE
(
fU
.
regCvt
(
&
val
,
&
reg
,
false
));
EXPECT_TRUE
(
fU
.
regCvt
(
&
valRbk
,
&
reg
,
true
));
EXPECT_EQ
(
255
,
valRbk
);
}
...
...
test/files/wbtest.h
View file @
e3d669f5
...
...
@@ -3,7 +3,7 @@
* File : wbtest.h
* Author : auto-generated by wbgen2 from wbtest.wb
* Created :
Mon Aug 17 11:55:49
2015
* Created :
Tue Aug 18 13:02:03
2015
* Standard : ANSI C
THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE wbtest.wb
...
...
@@ -49,8 +49,9 @@
#define WB2_TEST_CSR_RST_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_CSR_RST_NBFP 0
#define WB2_TEST_CSR_RST_SIGN 0
#define WB2_TEST_CSR_RST_
MASK WBGEN2_GEN_MASK(0, 1)
#define WB2_TEST_CSR_RST_
SIZE 1
#define WB2_TEST_CSR_RST_SHIFT 0
#define WB2_TEST_CSR_RST_MASK WBGEN2_GEN_MASK(0, 1)
#define WB2_TEST_CSR_RST WBGEN2_GEN_MASK(0, 1)
/* definitions for field: Enable in reg: Control Statut Register */
...
...
@@ -61,8 +62,9 @@
#define WB2_TEST_CSR_ENABLE_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_CSR_ENABLE_NBFP 0
#define WB2_TEST_CSR_ENABLE_SIGN 0
#define WB2_TEST_CSR_ENABLE_
MASK WBGEN2_GEN_MASK(1, 1)
#define WB2_TEST_CSR_ENABLE_
SIZE 1
#define WB2_TEST_CSR_ENABLE_SHIFT 1
#define WB2_TEST_CSR_ENABLE_MASK WBGEN2_GEN_MASK(1, 1)
#define WB2_TEST_CSR_ENABLE WBGEN2_GEN_MASK(1, 1)
/* definitions for field: Number in reg: Control Statut Register */
...
...
@@ -73,8 +75,9 @@
#define WB2_TEST_CSR_NUMBER_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_CSR_NUMBER_NBFP 0
#define WB2_TEST_CSR_NUMBER_SIGN 0
#define WB2_TEST_CSR_NUMBER_
MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_CSR_NUMBER_
SIZE 8
#define WB2_TEST_CSR_NUMBER_SHIFT 8
#define WB2_TEST_CSR_NUMBER_MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_CSR_NUMBER_W(value) WBGEN2_GEN_WRITE(value, 8, 8)
#define WB2_TEST_CSR_NUMBER_R(reg) WBGEN2_GEN_READ(reg, 8, 8)
...
...
@@ -88,8 +91,9 @@
#define WB2_TEST_DAC_I_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_DAC_I_NBFP 14
#define WB2_TEST_DAC_I_SIGN 2
#define WB2_TEST_DAC_I_
MASK WBGEN2_GEN_MASK(0, 16)
#define WB2_TEST_DAC_I_
SIZE 16
#define WB2_TEST_DAC_I_SHIFT 0
#define WB2_TEST_DAC_I_MASK WBGEN2_GEN_MASK(0, 16)
#define WB2_TEST_DAC_I_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define WB2_TEST_DAC_I_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
...
...
@@ -101,8 +105,9 @@
#define WB2_TEST_DAC_Q_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_DAC_Q_NBFP 14
#define WB2_TEST_DAC_Q_SIGN 2
#define WB2_TEST_DAC_Q_
MASK WBGEN2_GEN_MASK(16, 16)
#define WB2_TEST_DAC_Q_
SIZE 16
#define WB2_TEST_DAC_Q_SHIFT 16
#define WB2_TEST_DAC_Q_MASK WBGEN2_GEN_MASK(16, 16)
#define WB2_TEST_DAC_Q_W(value) WBGEN2_GEN_WRITE(value, 16, 16)
#define WB2_TEST_DAC_Q_R(reg) WBGEN2_GEN_READ(reg, 16, 16)
...
...
@@ -116,8 +121,9 @@
#define WB2_TEST_ADC_AMP_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_ADC_AMP_NBFP 14
#define WB2_TEST_ADC_AMP_SIGN 2
#define WB2_TEST_ADC_AMP_
MASK WBGEN2_GEN_MASK(0, 16)
#define WB2_TEST_ADC_AMP_
SIZE 16
#define WB2_TEST_ADC_AMP_SHIFT 0
#define WB2_TEST_ADC_AMP_MASK WBGEN2_GEN_MASK(0, 16)
#define WB2_TEST_ADC_AMP_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define WB2_TEST_ADC_AMP_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
...
...
@@ -129,8 +135,9 @@
#define WB2_TEST_ADC_PHA_ACCESS WBGEN2_READ_WRITE
#define WB2_TEST_ADC_PHA_NBFP 3
#define WB2_TEST_ADC_PHA_SIGN 2
#define WB2_TEST_ADC_PHA_
MASK WBGEN2_GEN_MASK(16, 16)
#define WB2_TEST_ADC_PHA_
SIZE 16
#define WB2_TEST_ADC_PHA_SHIFT 16
#define WB2_TEST_ADC_PHA_MASK WBGEN2_GEN_MASK(16, 16)
#define WB2_TEST_ADC_PHA_W(value) WBGEN2_GEN_WRITE(value, 16, 16)
#define WB2_TEST_ADC_PHA_R(reg) WBGEN2_GEN_READ(reg, 16, 16)
...
...
@@ -144,8 +151,9 @@
#define WB2_TEST_FULL_U32_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_FULL_U32_NBFP 0
#define WB2_TEST_FULL_U32_SIGN 0
#define WB2_TEST_FULL_U32_
MASK WBGEN2_GEN_MASK(0, 32)
#define WB2_TEST_FULL_U32_
SIZE 32
#define WB2_TEST_FULL_U32_SHIFT 0
#define WB2_TEST_FULL_U32_MASK WBGEN2_GEN_MASK(0, 32)
#define WB2_TEST_FULL_U32_W(value) WBGEN2_GEN_WRITE(value, 0, 32)
#define WB2_TEST_FULL_U32_R(reg) WBGEN2_GEN_READ(reg, 0, 32)
...
...
@@ -159,8 +167,9 @@
#define WB2_TEST_FULLFIXED_ALL_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_FULLFIXED_ALL_NBFP 32
#define WB2_TEST_FULLFIXED_ALL_SIGN 2
#define WB2_TEST_FULLFIXED_ALL_
MASK WBGEN2_GEN_MASK(0, 32)
#define WB2_TEST_FULLFIXED_ALL_
SIZE 32
#define WB2_TEST_FULLFIXED_ALL_SHIFT 0
#define WB2_TEST_FULLFIXED_ALL_MASK WBGEN2_GEN_MASK(0, 32)
#define WB2_TEST_FULLFIXED_ALL_W(value) WBGEN2_GEN_WRITE(value, 0, 32)
#define WB2_TEST_FULLFIXED_ALL_R(reg) WBGEN2_GEN_READ(reg, 0, 32)
...
...
@@ -174,8 +183,9 @@
#define WB2_TEST_BSIGN_U_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BSIGN_U_NBFP 0
#define WB2_TEST_BSIGN_U_SIGN 0
#define WB2_TEST_BSIGN_U_
MASK WBGEN2_GEN_MASK(0, 8)
#define WB2_TEST_BSIGN_U_
SIZE 8
#define WB2_TEST_BSIGN_U_SHIFT 0
#define WB2_TEST_BSIGN_U_MASK WBGEN2_GEN_MASK(0, 8)
#define WB2_TEST_BSIGN_U_W(value) WBGEN2_GEN_WRITE(value, 0, 8)
#define WB2_TEST_BSIGN_U_R(reg) WBGEN2_GEN_READ(reg, 0, 8)
...
...
@@ -187,8 +197,9 @@
#define WB2_TEST_BSIGN_SIGN1_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BSIGN_SIGN1_NBFP 0
#define WB2_TEST_BSIGN_SIGN1_SIGN 1
#define WB2_TEST_BSIGN_SIGN1_
MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_BSIGN_SIGN1_
SIZE 8
#define WB2_TEST_BSIGN_SIGN1_SHIFT 8
#define WB2_TEST_BSIGN_SIGN1_MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_BSIGN_SIGN1_W(value) WBGEN2_GEN_WRITE(value, 8, 8)
#define WB2_TEST_BSIGN_SIGN1_R(reg) WBGEN2_GEN_READ(reg, 8, 8)
...
...
@@ -200,8 +211,9 @@
#define WB2_TEST_BSIGN_SIGN2_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BSIGN_SIGN2_NBFP 0
#define WB2_TEST_BSIGN_SIGN2_SIGN 2
#define WB2_TEST_BSIGN_SIGN2_
MASK WBGEN2_GEN_MASK(16, 8)
#define WB2_TEST_BSIGN_SIGN2_
SIZE 8
#define WB2_TEST_BSIGN_SIGN2_SHIFT 16
#define WB2_TEST_BSIGN_SIGN2_MASK WBGEN2_GEN_MASK(16, 8)
#define WB2_TEST_BSIGN_SIGN2_W(value) WBGEN2_GEN_WRITE(value, 16, 8)
#define WB2_TEST_BSIGN_SIGN2_R(reg) WBGEN2_GEN_READ(reg, 16, 8)
...
...
@@ -215,8 +227,9 @@
#define WB2_TEST_BFIXED_U_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BFIXED_U_NBFP 8
#define WB2_TEST_BFIXED_U_SIGN 0
#define WB2_TEST_BFIXED_U_
MASK WBGEN2_GEN_MASK(0, 8)
#define WB2_TEST_BFIXED_U_
SIZE 8
#define WB2_TEST_BFIXED_U_SHIFT 0
#define WB2_TEST_BFIXED_U_MASK WBGEN2_GEN_MASK(0, 8)
#define WB2_TEST_BFIXED_U_W(value) WBGEN2_GEN_WRITE(value, 0, 8)
#define WB2_TEST_BFIXED_U_R(reg) WBGEN2_GEN_READ(reg, 0, 8)
...
...
@@ -228,8 +241,9 @@
#define WB2_TEST_BFIXED_SIGN1_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BFIXED_SIGN1_NBFP 7
#define WB2_TEST_BFIXED_SIGN1_SIGN 1
#define WB2_TEST_BFIXED_SIGN1_
MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_BFIXED_SIGN1_
SIZE 8
#define WB2_TEST_BFIXED_SIGN1_SHIFT 8
#define WB2_TEST_BFIXED_SIGN1_MASK WBGEN2_GEN_MASK(8, 8)
#define WB2_TEST_BFIXED_SIGN1_W(value) WBGEN2_GEN_WRITE(value, 8, 8)
#define WB2_TEST_BFIXED_SIGN1_R(reg) WBGEN2_GEN_READ(reg, 8, 8)
...
...
@@ -241,8 +255,9 @@
#define WB2_TEST_BFIXED_SIGN2_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BFIXED_SIGN2_NBFP 8
#define WB2_TEST_BFIXED_SIGN2_SIGN 2
#define WB2_TEST_BFIXED_SIGN2_
MASK WBGEN2_GEN_MASK(16, 8)
#define WB2_TEST_BFIXED_SIGN2_
SIZE 8
#define WB2_TEST_BFIXED_SIGN2_SHIFT 16
#define WB2_TEST_BFIXED_SIGN2_MASK WBGEN2_GEN_MASK(16, 8)
#define WB2_TEST_BFIXED_SIGN2_W(value) WBGEN2_GEN_WRITE(value, 16, 8)
#define WB2_TEST_BFIXED_SIGN2_R(reg) WBGEN2_GEN_READ(reg, 16, 8)
...
...
@@ -254,8 +269,9 @@
#define WB2_TEST_BFIXED_DEFAULT_ACCESS WBGEN2_READ_ONLY
#define WB2_TEST_BFIXED_DEFAULT_NBFP 8
#define WB2_TEST_BFIXED_DEFAULT_SIGN 2
#define WB2_TEST_BFIXED_DEFAULT_
MASK WBGEN2_GEN_MASK(24, 8)
#define WB2_TEST_BFIXED_DEFAULT_
SIZE 8
#define WB2_TEST_BFIXED_DEFAULT_SHIFT 24
#define WB2_TEST_BFIXED_DEFAULT_MASK WBGEN2_GEN_MASK(24, 8)
#define WB2_TEST_BFIXED_DEFAULT_W(value) WBGEN2_GEN_WRITE(value, 24, 8)
#define WB2_TEST_BFIXED_DEFAULT_R(reg) WBGEN2_GEN_READ(reg, 24, 8)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment