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 28 to Rev 29
- ↔ Reverse comparison
Rev 28 → Rev 29
/dmt_tx/trunk/myhdl/test/test_const_encoder.py
46,15 → 46,26
yield clk.negedge |
reset.next = 0 |
|
size = 5 |
const_size_i.next = size |
|
for size in [4, 5]: |
#print |
#print 'Testing const_size %d'%size |
#print |
const_size_i.next = size |
|
for i in range(2**size): |
data_i.next = i |
wen_i.next = 1 |
yield clk.negedge |
wen_i.next = 0 |
yield clk.negedge |
|
for i in range(2**size): |
data_i.next = i |
wen_i.next = 1 |
yield clk.negedge |
wen_i.next = 0 |
|
yield clk.negedge |
|
yield clk.negedge |
raise StopSimulation |
|
|
@instance |
def verify(): |
71,42 → 82,44
1, 3, 1, 3, 5, -5, 5, -5, 5, -5, 5, -5, -3, -1, -3, -1] |
|
|
expXL = [] |
expYL = [] |
|
yield data_valid_o.posedge |
while True: |
|
if const_size_i == 2: |
expXL = expb2XL |
expYL = expb2YL |
elif const_size_i == 4: |
expXL = expb4XL |
expYL = expb4YL |
elif const_size_i == 5: |
expXL = expb5XL |
expYL = expb5YL |
expXL = [] |
expYL = [] |
|
yield data_valid_o.posedge |
|
#print "expXL ", expXL |
#print "expYL ", expYL |
#print "at ", now() |
if const_size_i == 2: |
expXL = expb2XL |
expYL = expb2YL |
elif const_size_i == 4: |
expXL = expb4XL |
expYL = expb4YL |
elif const_size_i == 5: |
expXL = expb5XL |
expYL = expb5YL |
|
#print "expXL ", expXL |
#print "expYL ", expYL |
#print "at ", now() |
|
for j, expX in enumerate(expXL): |
|
yield clk.negedge |
#print |
#print "data_valid: %d x_o: %d y_o: %d at %d"%( data_valid_o, |
# x_o, y_o, |
# now()) |
#print "expecting x_o: %d y_o: %d"%(expX, expYL[j]) |
for j, expX in enumerate(expXL): |
|
if expX != x_o: |
tc.fail("%d != x_o: %d at %d"%(expX, x_o, now())) |
if expYL[j] != y_o: |
tc.fail("%d != y_o: %d at %d"%(expYL[j], y_o, now())) |
yield clk.negedge |
#print |
#print "data_valid: %d x_o: %d y_o: %d at %d"%( data_valid_o, |
# x_o, y_o, |
# now()) |
#print "expecting x_o: %d y_o: %d"%(expX, expYL[j]) |
|
if expX != x_o: |
tc.fail("%d != x_o: %d at %d"%(expX, x_o, now())) |
if expYL[j] != y_o: |
tc.fail("%d != y_o: %d at %d"%(expYL[j], y_o, now())) |
|
#raise StopSimulation |
|
raise StopSimulation |
|
return instances() |
|
|