/test/test.py
# SPDX-FileCopyrightText: © 2024 Tiny Tapeout
# SPDX-License-Identifier: Apache-2.0
# Reset
= 1
await ;
= 0
await ;
= 1
'''
Unfortunately this does not test much, as video and audio generation is
quite complex. But we do assert a few basic signals at the beginning as a
basic sanity check.
'''
# Set the clock period to 40ns (25MHz)
# Actual clock is 25.175 (39.722ns) but whatever
=
await
= 1
await
await
# flops on hsync/vsync delay them by one cycle, so we wait
# two cycles here.
await
# Should be a black pixel at the beginning of scan
assert == 0b10001000
# Audio is on; PWM output is 50:50 with no output, so this will be high at
# the beginning even though two channels are outputting immediately.
assert == 0b10000000
await
# Pixel should be black now
assert == 0b10001000
# Should put us right at the border between front porch and hsync
await
assert == 0b00001000
# border of hsync and back porch
await
assert == 0b10001000
# and back at the beginning of the next line; green pixel again
await
assert == 0b10001000