def stream_word_matches_symbol(stream, word_number, *, symbol):
    """ Returns an nMigen conditional that evaluates true if the given word of a stream matches the given symbol. """

    return (
        stream.valid &
        (stream.data.word_select(word_number, 8) == symbol.value) &
        (stream.ctrl[word_number] == symbol.ctrl)
    )