Up until now, we’d been discussing the justification of using TDD in an ASIC development flow. Hopefully, we’ve convinced you to try it. In this post we’ll introduce a TDD framework that has been developed for SystemVerilog to help you use this design technique.
A couple of weeks ago, just after we got started with TDD month, Neil added the link to the posts on several industry forums, and got this comment from Alex Gnusin on the verification guild:
“Is it a Designer responsibility to test each line of code? In this case, there is a need to provide designers with working methodology to verify their code…”
To which Neil responded:
Alex: I’m not sure if you guessed we’d be covering the topic of a working methodology – aka: unit test framework – but if you did, I’d like to thank you for that nice bit of foreshadowing!
Alex is right, a proper framework is pretty important for anyone doing TDD; primarily because it gives you the opportunity to get up and running quickly.
In the software world, there are are number of wildly popular unit test frameworks. JUnit might be the best known (for those doing java development) but there are about a million others (as you can see with a quick trip over to Wikipedia). A unit test framework is critical for TDD, that’s why myself and Rob Saxe (both formerly of XtremeEDA) put one together a couple of years ago for people wanting to do TDD with SystemVerilog.
First presented at SNUG San Jose in 2009, SVUnit is a unit test framework that provides:
structures for creating and running unit tests
utilities for reporting test status and results
a test “runner” that executes a set of test suites and report on their overall success/failure
scripts to automate the mechanical aspects of creating new unit test code
This post is slightly off-topic of our usual AgileSoC theme; instead it is aimed at you Emacs folks who use org-mode and have been asking yourself “How can I combine Kanban and org-mode?” Here’s how I did it. It’s not rocket science, but it is very handy.
OK, I admit that I’m an Emacs geek. I’ve used Emacs for a very long time, and have always been amazed at how many powerful, useful features are created for it. The one feature that I’ve used for years is the org-mode. org-mode is an organizer, note taker, outliner, planner, etc. Check out the web-site (orgmode.el). It has so many features, I’m sure that I don’t know them all.
I use org-mode for three things:
track my tasks;
my time associated with each task, and
a short journal of what I do every day (including any research).
All this information is located in one spot and org-mode allows me to keep it organized and easily searchable (it’s a text file).
Being an Agile-Emacs geek, I’ve been trying to use web-based and desktop systems keep track of my personal to-do lists using Kanban. For the stuff I do I found Kanban provides me with the best way to track and report what I’m doing. After being mildly impressed with many of these tools, I never got into using them because they required me to get out of Emacs and get into a browser. Using a GUI after being used to a straight text entry was also a little more trouble than I wanted. Lastly, the data is usually in a proprietary format — that would be my data is now stuck in a proprietary format.
Being an Agile-Kanban-Emacs geek, my next step was to Google “emacs org-mode kanban”. No luck. What follows is my solution to creating a Kanban board using org-mode.
Kanban Board meet Org-mode Tables
org-mode provides an awesome table editing facility. Once you’ve defined what the table looks like it automatically resizes the table to balance any new text you add. My first step in creating my Personal Kanban board was to create a org-mode table.
Initial view of Personal Kanban Board
My workflow (i.e., indicated in the header row) is pretty generic and straightforward:
Backlog (product stories not started yet);
Analysis (think, think, think);
Implementing (do, do, do);
Debugging/Testing (ensuring that it’s right); and finally
Done (proven correct and accepted).
Product Story meet Org-Mode Internal Links
Now I need to add my Product Stories to my backlog. For this I use the org-mode markup language to add internal hyperlinks. Links are created in org-mode using the format: `[[link]]. The target is simply: <<target>>. Here’s a picture of my first Product Story added to the table.
As you can see, org-mode has done several things:
readjusted the table to accommodate the new “Product Story 1” link in the Backlog column;
Translated my input of the link `[[Product Story 1]] to the `Product Story 1 hyperlink. NOTE: If you click on this link with your mouse the cursor moves to the target line indicated by <<Product Story 1>>.
I use the org-mode tags :BACKLOG: and :STORY: so that I can filter on those for reporting, and I use the priority [#A] to indicate the importance of this story.
The next thing I do is add the sub-tasks that make up the Product Story and History to capture what the heck I did for each sub-task.
I continue to add new Product Stories and sub-tasks as above, until I’ve got a decent size Backlog.
Now, I start working. I’ll move Product Stories across my work flow, update history and complete actions. Here’s a snapshot where I’ve done some work.
OK, that picture is getting a little busy now, but the interesting elements are:
the Kanban board automatically re-sized as I moved the Product Story links from column to column;
I can use the org-mode folding capability (notice that <<Product Story 1>> ends with ellipsis … i.e., “:BACKLOG:STORY:…” — the ellipsis indicates that some text has been folded, or is currently hidden from view. Use the tab key when the cursor is on the line to toggle the fold/unfold);
I’m using the org-mode time-tracking feature to capture how much time I spend on each Product Story (captured in the lines indicated with CLOCK:). org-mode has a way to generate a report summarizing the time spent on each Product Story.
There’s even an iPhone app (http://mobileorg.ncogni.to/) so that I can update my Personal Kanban board on my iPhone. You can’t get sexier than an iPhone App; unless you’re not an Agile-Kanban-Emacs-iPhone geek. 😉
I’ve found it extremely easy to use Kanban and org-mode to capture and track my work. If you’re a power org-mode user and can suggest other features of org-mode that would be useful in this context — I’d be all ears.
Pomodoro meet Emacs
Just to be clear. I’ve been in management for over 15 years, and I pride myself in that I’ve never micro-managed anyone that I’ve supervised (for those of you who I have worked with, here’s your opportunity to contradict me). However, I love to micro-manage myself. I’ll break down any significant work until I have a set of tasks around 0.5 to 1.0 day in duration. I need that for two reasons:
I’m too methodical (aka ‘anal-retentive’) to not capture a plan;
I have the attention span of a gnat. If there’s a “bright shiny object”… I’ll be attracted to it. Creating a set of a short sub-tasks means that I can progress toward the ultimate goal, and then as a reward take a break and go look at that bright shiny object for a bit, and then go onto the next task.
For the second issue of focus, I’ve been using the pomodoro technique for several months. Go check out the web-site for more details on how to use this technique. Again, I tried browser-based, desktop, and iPhone applications to track my pomodoros for me — but they were even worse than the Kanban applications I alluded to above for keeping me on track. As most of day is spent looking an Emacs screen — that’s where I need to be notified when a pomodoro is over. Once again some kind Emacs elisp coder created pomodoro.el. This allows me to start a pomodoro timer within Emacs; it automatically starts the short and long breaks and the next pomodoro; allows me to stop and rewind the pomodoro (for when I’m interrupted), and keeps a crude track of how many pomodoro’s I’ve completed. Check out the elisp code for more details.
You may find using pomodoro will drive you nuts… or you may love it. But if you’re an Agile-Kanban-Emacs-iPhone-Pomodoro geek, you’ll probably love it.