Skip to content

ROHD Unit Testing Validation in Sequential #331

Answered by mkorbel1
quekyj asked this question in Q&A
Discussion options

You must be logged in to vote

Here's an example where you can use await on the edges of the clock to drive stimulus and check values out of the flop.

import 'dart:async';
import 'package:rohd/rohd.dart';
import 'package:test/test.dart';

void main() {
  test('test flop', () async {
    final clk = SimpleClockGenerator(10).clk;
    final input = Logic(width: 8);
    final output = FlipFlop(clk, input).q;

    /// Prints the current state of the flop.
    void printFlop([String message = '']) {
      print('@${Simulator.time}:\t'
          ' input=${input.value}, output=${output.value}\t$message');
    }

    // set a max time in case something goes longer than expected
    Simulator.setMaxSimTime(100);

    // kick off…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by quekyj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants