gnupic: Re: [gnupic] gpsim/gpasm assertions


Previous by date: 22 May 2005 04:44:47 +0100 Re: [gnupic] Differend data segment types, Craig Franklin
Next by date: 22 May 2005 04:44:47 +0100 Re: [gnupic] Differend data segment types, Peter Onion
Previous in thread:
Next in thread: 22 May 2005 04:44:47 +0100 Re: [gnupic] gpsim/gpasm assertions, Chris Emerson

Subject: Re: [gnupic] gpsim/gpasm assertions
From: Craig Franklin ####@####.####
Date: 22 May 2005 04:44:47 +0100
Message-Id: <42900084.1000802@users.sourceforge.net>

Scott Dattalo wrote:

>I've just added preliminary support for simulation assertions.
>(allow a few hours for the public CVS cache to be updated).
>
>The syntax in gpasm is:
>
>   .direct "A" "expression"
>
>  
>

I created some macros last year to simplify using .direct.  They are 
located in coff.inc.

Here are the relevant sections:

; Assertion
.assert macro x
  .direct "a", x
  endm

; Simulator Command
.sim macro x
  .direct "e", x
  endm

; Printf Command
.print macro x
  .direct "f", x
  endm

; Log Command
.log macro x
  .direct "l", x
  endm

The first one is what Scott implemented in gpsim.  So you can:

  .assert "var1==5"

>Where the quoted expression can be any legal gpsim expression. The quotes
>are required.
>
>This directive associates an expression with a program memory address.
>When gpsim simulates the instruction at the address, the expression will
>be evaluated. If the expression evaluates to true, then gpsim will halt.
>Note that gpasm will not parse the expression. So if there's a syntax
>error, you won't know until you start the simulation.
>
>The expression must be a boolean expression and the syntax is identical to
>C's. By boolean I mean that when evaluated, the expression must return
>true or false. Here's are a few examples that can be found in
>regression/assertions/assertions.asm:
>
>
>	clrf	var1
>	clrf	var2
>	clrf	var3
>
>  ; var1 and var2 have just been cleared, so the following two
>  ; assertions should fail
>
>  .direct "A",  "var1==5"
>	nop
>  .direct "A",  "var2==6"
>	nop
>
>  ; compound expression
>  .direct "A",  "var2!=0 || var1!=0"
>	nop
>
>Note, currently you cannot write:
>
>  .direct "A",  "var2"   ; break if var2 is non zero
>	nop
>
>Instead, explicitly check for non-zero
>
>  .direct "A",  "var2!=0"   ; break if var2 is non zero
>	nop
>
>
>One exception is a null expression. If you write:
>
>  .direct "A",  ""
>	nop
>
>This assertion will always be true. This is identical to a break point.
>
>----
>
>This is the first real pass at simulation assertions - I'd appreciate any
>feed back. Also, I expect to make some changes/improvements.
>
>  
>
Here was the gputils announcement:
http://www.linuxhacker.org/cgi-bin/ezmlm-cgi?1:mss:3396:200410:lifmjfnhofnjoddpaopp

gpasm puts the .direct into its output COFF files.  gplink then writes 
the symbols to its output COD file.  So you can only use this feature in 
relocatable mode.  I did nothing to preclude using absolute mode, just 
didn't take the time to add the feature.

>Scott
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ####@####.####
>For additional commands, e-mail: ####@####.####
>
>
>  
>


Previous by date: 22 May 2005 04:44:47 +0100 Re: [gnupic] Differend data segment types, Craig Franklin
Next by date: 22 May 2005 04:44:47 +0100 Re: [gnupic] Differend data segment types, Peter Onion
Previous in thread:
Next in thread: 22 May 2005 04:44:47 +0100 Re: [gnupic] gpsim/gpasm assertions, Chris Emerson


Powered by ezmlm-browse 0.20.