gnupic: Square wave stimulus DOES work.
Subject:
Square wave stimulus DOES work.
From:
Scott Dattalo ####@####.####
Date:
2 Jun 2000 12:05:53 -0000
Message-Id: <Pine.LNX.4.21.0006020654100.26390-100000@tempest2.blackhat.net>
But let me explain.
Martin,
I went back to the example for the square wave stimulus. Look in the gpsim
source directory:
examples/14bit/
You'll find two files:
sync_stim.stc
stim_test.asm
Assemble stim_test.asm and try out the stimulu command file. e.g.
$ gpasm stim_test.stc
$ gpsim
gpsim> load c stim_test.stc
Now, this test asm file will monitor an I/O pin that has a square stimulus
attached to it. It counts the number of rising edges that are detected. The .stc
file sets a write break point on the counter variable and will break gpsim every
time the counter reaches the value of 10 dec. I just tried it out and it works
with version 0.19.2.
Now two points need to be noted:
1) The pin-out window will not automatically update itself. Consequently, the
states for the I/O pins displayed in the window may not be accurate. You can
force the window to update by modifying one of the I/O pins (like double
clicking on one of the H's or L's)
2) The sqw stimulus does not drive the I/O pin. Instead, the I/O pin has to be
read to determine the state of the stimulus. What this means, is that you can't
use the sqw stimulus to initiate an interrupt on change. The I/O port has to
poll the stimulus to detect the change.
Scott
P.S. I modified the sync_stim.stc file slightly. Here's the new copy:
# set verbose 3
# gpsim
# Startup command file for stim_test.hex
# Create the processor that's to be simulated
processor p16c84 fred
# Load the .hex file
load s stim_test.cod
# Create a stimulus node:
node test_node
# Create a square wave stimulus that's 1000 cycles long
# and attach it to portb bit 0. The duty cycle is 30%
# and the phase is 10%.
echo stimulus create
stimulus sqw
# initial 1
start 10000
period 1000
high_time 300
phase 100
# port portb 0
end
echo stimulus created
attach test_node portb0 sa_square_wave
# Set a cycle break point on the One hundred thousand'th
# execution cycle
break c 100000
# Set a register write break point when 10 (dec) is
# written to register 0x20.
break wv 0x20 10