URL
https://opencores.org/ocsvn/dmt_tx/dmt_tx/trunk
Subversion Repositories dmt_tx
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 31 to Rev 32
- ↔ Reverse comparison
Rev 31 → Rev 32
/dmt_tx/trunk/myhdl/test/test_cmath.py
160,14 → 160,13
width = 4 |
owidth = width |
|
umax = 2**width -1 |
smax = 2**(width-1)-1 |
smax = 2**(width-1) # Python oddnes; max value not include |
smin = -2**(width-1) |
#print 'cmult in value range: ', smin, smax |
#print 'cmult in value range: ', smin, smax-1 |
|
osmax = 2**(owidth-1)-1 |
osmax = 2**(owidth-1) |
osmin = -2**(owidth-1) |
#print 'cmult out value range: ', osmin, osmax |
#print 'cmult out value range: ', osmin, osmax-1 |
|
a_re, a_im, b_re, b_im = [Signal(intbv(0, min=smin, max=smax)) \ |
for i in range(4)] |
177,6 → 176,7
|
cmult_inst = cmult(a_re, a_im, b_re, b_im, y_re, y_im, overflow) |
|
#print 'input length: ', len(a_re) |
|
@instance |
def stimulus(): |
/dmt_tx/trunk/myhdl/rtl/cmath.py
99,7 → 99,15
y_re = a_re * b_re - a_im * b_im |
y_im = a_re * b_im + a_im * b_re |
|
The output is expected to have at least the same width as the input. |
The products are scaled back to the input width and in case an extra |
bit would be needed due to the addition or subtraction, an overflow |
is signaled. |
|
At the moment the overflowing output is saturated to the respective |
limit, based on the input width. So a wider output width is not used |
with the current implementation. |
|
I/O pins: |
========= |
a : input a |
117,7 → 125,7
|
# calculate min and max value range |
smin = -2**(width-1) |
smax = 2**(width-1)-1 |
smax = 2**(width-1) |
|
#print 'cmult input width: ', width |
|