gnupic: gpsim Assertions and Scripts


Previous by date: 1 Jul 2005 14:46:12 +0100 Re: [gnupic] "Make" Magazine story on Open Source PIC tools, michael.michaelshiloh.com
Next by date: 1 Jul 2005 14:46:12 +0100 picp, Jeff
Previous in thread:
Next in thread:

Subject: gpsim Assertions and Scripts
From: "Scott Dattalo" ####@####.####
Date: 1 Jul 2005 14:46:12 +0100
Message-Id: <60455.67.113.28.132.1120225564.squirrel@67.113.28.132>

There was some discussion recently about simulation assertions and I
thought you guys may want an update. There aren't any new code changes,
but I've added two more regression tests to gpsim's test suite:

   http://cvs.sourceforge.net/viewcvs.py/gpsim/regression/assertions/
   http://cvs.sourceforge.net/viewcvs.py/gpsim/regression/logic_test/

I may've mentioned the one about 'assertions' already, but the one on
'logic_test' is new. The main purpose of the logic_test regression is to
verify that gpsim's logic modules (i.e. AND, OR, XOR, and NOT gates)
simulate correctly. Ralf had written a test for these which in turn
inspired the new regression test. In addition, this test utilizes embedded
simulation scripts and complex assertions.

Using the gputils '.sim' macro, you can embed gpsim script commands
directly in your assembly source. For example, here's a case where a node
is created and stimuli are attached to it.

   .sim "node na0"
   .sim "attach na0 U5_or.in0 porta0"

We already have discussed assertions, but it's hard to appreciate their
usefulness until you can use them like this:

  ; Or Gate check.
  ;            U5_or
  ; porta0  ---)-\     U6_or
  ;            )+ )----)-\
  ; porta1  ---)-/     )+ )---+
  ;                 +--)-/    |
  ; porta2  --------+         |
  ;                           |
  ; portc0  ------------------+
  ;

; extra stuff and other assertions snipped....

   ; Loop through the 8 states:

L_OrCheck:
	incf	PORTA,F
   .assert "(portc & 1) == ( ((porta>>2) | (porta>>1) | porta) & 1)"
	btfss	PORTA,3
	 goto	L_OrCheck


In this test, a simple cascaded gpsim OR gate circuit is attached to the
PIC Pins. A 3-instruction loop cycles through the 8 possible states and an
assertion verifies that each state is correct.

Two caveats: you need a recent gputils release (0.10.3 isn't going to cut
it Ralf!), and you can only utilize the features for relocatable mode
code.

Scott



Previous by date: 1 Jul 2005 14:46:12 +0100 Re: [gnupic] "Make" Magazine story on Open Source PIC tools, michael.michaelshiloh.com
Next by date: 1 Jul 2005 14:46:12 +0100 picp, Jeff
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.