question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simple example for README.md

See original GitHub issue

We once discussed that a very simple example would be more appropriate to be in the README.md.

import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import FallingEdge

@cocotb.test()
async def test_simple_dff(dut):
    cocotb.fork(Clock(dut.c, 10, "us").start())

    for i in range(10):
        val = random.randint(0, 1)
        dut.d <= val
        await FallingEdge(dut.c)
        assert dut.q == val, "output was incorrect on the {}th cycle".format(i)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
eric-wiesercommented, Feb 23, 2020

Perhaps with an assert?

import random
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge

@cocotb.test()
async def test_simple_dff(dut):
    cocotb.fork(Clock(dut.c, 10, "us").start())

    for i in range(10):
        val = random.randint(0, 1)
        dut.d <= val
        await RisingEdge(dut.c)
        await FallingEdge(dut.c)
        assert dut.q == val, f"output was incorrect on the {i}th cycle"
0reactions
cmarqucommented, Mar 5, 2020

I actually do like mentioning the specific cycle, but it would have to be written as e.g.

assert dut.q == val, "output was incorrect on the {}th cycle".format(i)
Read more comments on GitHub >

github_iconTop Results From Across the Web

A simple README.md template - gists · GitHub
An in-depth paragraph about your project and overview of use. Getting Started. Dependencies. Describe any prerequisites, libraries, OS version, etc ...
Read more >
Make a README
Learn how to make a great README for your programming project, and use the editable template to get started.
Read more >
README.md template | Documenting your project - Drupal
Drupal site owners can install Advanced help to view README files. Sample README. See the following modules for recommended README.md examples:.
Read more >
Homework: Writing a README
The most common format for READMEs is Markdown, which is why our README files will include the .md extension. Markdown is perfect for...
Read more >
How to write a good README for your GitHub project?
README template ​​ I leave you here an example of README.md file template you can download. Take a look at its formatting, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found