$monitor and icarus (iverilog)

Newbie Alert. Learning verilog with gEDA tools - icarus

I am trying to implement a traffic light controller. Nothing complicated 
here but I thought Id use system functions to simulate it ($monitor, 
$display).

Compiles correctly with 
iverilog -s top traffic_light.v

I run it with
vvp a.out and it produces the following:

TrafficLights=x
                   0	rst=1	clk=0	sw= 4	leds=X
TrafficLights=6
                   5	rst=1	clk=1	sw= 4	leds=X
TrafficLights=5
                  10	rst=0	clk=0	sw= 4	leds=X
TrafficLights=6
                  15	rst=1	clk=1	sw= 4	leds=X
                  20	rst=1	clk=0	sw= 4	leds=X
TrafficLights=5
                  25	rst=1	clk=1	sw= 4	leds=X
                  30	rst=1	clk=0	sw= 4	leds=X
TrafficLights=3
                  35	rst=1	clk=1	sw= 4	leds=X
                  40	rst=1	clk=0	sw= 4	leds=X
TrafficLights=6
                  45	rst=1	clk=1	sw= 4	leds=X
                  50	rst=1	clk=0	sw= 4	leds=X
TrafficLights=5
                  55	rst=1	clk=1	sw= 4	leds=X
                  60	rst=1	clk=0	sw= 4	leds=X
TrafficLights=3
                  65	rst=1	clk=1	sw= 4	leds=X
                  70	rst=1	clk=0	sw= 4	leds=X
TrafficLights=6
                  75	rst=1	clk=1	sw= 4	leds=X
                  80	rst=1	clk=0	sw= 4	leds=X
TrafficLights=5
                  85	rst=1	clk=1	sw= 4	leds=X
                  90	rst=1	clk=0	sw= 4	leds=X
TrafficLights=3
                  95	rst=1	clk=1	sw= 4	leds=X
                 100	rst=1	clk=0	sw= 4	leds=X



internal to the module the variable changes as expected, why isnt
this represented in the $monitor function' output in module top?

what am I not understanding?
Thanks



/*
 ************************************************************************
 *name:         traffic_light.v
 *author:       Samuel Igwe
 *date:         2/8/2011 A.D
 *description:  verilog code to allow the xilinx xc95108 cpld board I put
 *              together to function like a traffic light indicator
 ************************************************************************
 */
module  top;
reg             SymClk=0,SymRst=1;
wire    [3:0]   SymSwitch=4;
wire    [2:0]   SymLeds=0;

traffic_light symtraffic (SymRst,SymClk,SymSwitch,SymLeds);

initial
        $monitor("%d\trst=%d\tclk=%d\tsw=%d\tleds=%d",
$time,SymRst,SymClk,SymSwitch,SymLeds);

always
        begin
        #5 SymClk         <= ~SymClk;
        if ($time == 10)
                SymRst <=0;
        else
                SymRst <=1;

        if ($time == 100)
                $finish;

        end
endmodule


module  traffic_light(input            InRstSw,
                      input            InClock,
                      input      [3:0] InMouseSw,
                      output reg [2:0] TrafficLights);

parameter RED   =3'b110;
parameter YELLOW=3'b101;
parameter GREEN =3'b011;

reg [2:0] RYG_LED;        

initial
        RYG_LED <= RED;


always @ (RYG_LED)
        begin
        TrafficLights <= RYG_LED;
        $display("TrafficLights=%x",TrafficLights);
        end


always @ (posedge InClock or negedge InRstSw)
        begin
        if(InClock)
                begin
                case(RYG_LED)
                        RED:
                        RYG_LED <= YELLOW;
                        YELLOW: 
                        RYG_LED <= GREEN;
                        GREEN:  
                        RYG_LED <= RED;
                        default:
                        RYG_LED <= YELLOW;
                endcase
                end
        else
                RYG_LED <= RED;
        end
endmodule
        
0
him262 (8)
2/9/2011 10:34:38 PM
comp.lang.verilog 3797 articles. 1 followers. Post Follow

2 Replies
335 Views

Similar Articles

[PageSpeed] 13
On 2/9/2011 2:34 PM, Aldorus wrote:

> internal to the module the variable changes as expected, why isnt
> this represented in the $monitor function' output in module top?
>
> what am I not understanding?

You are assigning to the net SymLeds in two places and there is 
contention between these two assignments. At the top level you have an 
implicit continuous assignment with a value of 0 in the definition and 
the output of the module instantiation also creates an implicit 
continuous assignment. FYI using %b instead of %d shows exactly which 
bits are in contention. Removing the assignment to zero in the 
definition should make things work as expected.

Cary
0
Cary
2/9/2011 11:50:41 PM
On Wed, 09 Feb 2011 15:50:41 -0800, Cary R. wrote:

> On 2/9/2011 2:34 PM, Aldorus wrote:
> 
>> internal to the module the variable changes as expected, why isnt this
>> represented in the $monitor function' output in module top?
>>
>> what am I not understanding?
> 
> You are assigning to the net SymLeds in two places and there is
> contention between these two assignments. At the top level you have an
> implicit continuous assignment with a value of 0 in the definition and
> the output of the module instantiation also creates an implicit
> continuous assignment. FYI using %b instead of %d shows exactly which
> bits are in contention. Removing the assignment to zero in the
> definition should make things work as expected.
> 
> Cary

That worked

Odd thing is the only reason I set it to 0 was to have it initialized for
simulation purposes - thats not sensible since I had a SymRst in play to
set defaults.

Thanks again
0
Aldorus
2/10/2011 12:29:26 AM
Reply:
Similar Artilces:

Monitoring
Can anyone out there recommend an SNMP monitoring tool that monitors SNMP OID values and sends an alarm (perhaps an email or page or something) when the OID value reaches a certain limit ? I would also like something that monitors network services. Thanks a lot Jake On Mon, 07 Jul 2003 21:03:56 GMT, John <mr_stone@telus.net> wrote: > Can anyone out there recommend an SNMP monitoring tool that monitors SNMP > OID values and sends an alarm (perhaps an email or page or something) when > the OID value reaches a certain limit ? I would also like something that > monitors netw...

SC1435 monitor and 130XE
Well guys (cheesy grin), my little idea worked. I now have my 8bit Atari's working on an SC1435 monitor. The picture using chroma luma on the 130XE is fan bloody tastic. I have also tried my 64k, green power led, 600XL using chroma, luma as well, not as good as the 130XE but still great. Will put some piccys up soon. Mark Well, that is interesting! What are the connections? --Chris "Chris Martin" <cmartin@ti.com> wrote in message news:482f186a.0310111305.6ff419d5@posting.google.com... > Well, that is interesting! What are the connections? Sim...

Had 10 10" monitors and all were faulty. What is the best 19" monitor?
Hi I had a LG 915FT+ and it was an amazing monitor. Then after about a year there was slight ghosting so I used the on site swapout warentee.. I've had lots of swap out monitors from them and all had problems, makeing sounds, screen shaking, colour problems, even their latest f900p new monitor they sent out had convergence problems in the top left corner. So I gave in and brought a brand new iiyama vision master pro 454 a. I was hesitent to get it because of the lines accross the screen but there didn't seem like an alternative technology. Anyway this was slightly burry in the top left...

Monitor problem
Hello, I have a problem with a Monitor implementation. I would like to have a linkedList with many threads inside (for dumping Images from urls). However, whenever I launch many threads in parallel I get an out of Memory problem (which is normal because of the size of the images I suppose...). I would like to launch 10-15 threads in parellel and then let the other threads to just wait in the linked list. while(condition to only have 10-15 threads){ get Element from list launch thread } However, i just don't know when my threads finish. How can I do it? Do you have an idea? tha...

Two Monitors with a Notebook?
Hello! It is possible to span a windows desktop between a notebooks screen and a 2nd monitor? If so, how do I do it? Thank you, Brian No. -- DaveW "Joe" <joe@joe.com> wrote in message news:3453jfF444nbiU1@individual.net... > Hello! > > It is possible to span a windows desktop between a notebooks screen and a > 2nd monitor? If so, how do I do it? > > Thank you, > Brian > > "Joe" <joe@joe.com> wrote in news:3453jfF444nbiU1@individual.net: > Hello! > > It is possible to span a windows desktop between a notebooks s...

Monitor Squeal
When I start Slackware the screen squeals and continues to do so until I start gnome and change the screen resolution from 1024X768 to 800X600 The monitor is a 17" and should handle 1024X768 How can I get it to work without the piercing squeal ? -- Thanks Murph On Sat, 01 Jan 2005 01:47:52 +0000, Murphy wrote: > When I start Slackware the screen squeals and continues to do so until I > start gnome and change the screen resolution from 1024X768 to 800X600 > > The monitor is a 17" and should handle 1024X768 > > How can I get it to work without the piercing squ...

X server, monitor problems even though monitors are found
Hi I'm having trouble getting it up and running. Here are what I think are the important Hardware facts: 15" Magitronic Monitor GXE64 Pro video Card by number nine (www.nine.com). I'm trying to get it running on Debian 3.0r4 Driver: VESA The Error Message(s): (EE)Screen(s) found, but none have a usable configuration. Question: How do I fix this so that the X server works. Thanks Godric On Mon, 24 Jan 2005 17:55:42 -0500, Godric de Mimsy Porpignions staggered into the Black Sun and said: > I'm having trouble getting it ...

Monitor recommendations?
What's a reasonable alternative, that means cheaper :-), to the apple 23-inch Cinema display? Harold Burton <hal.i.burton@hotmail.com> writes: > > What's a reasonable alternative, that means cheaper :-), to the apple > 23-inch Cinema display? I'm using a Dell 2404FPW monitor with my PowerMac G4. I'm very happy with it. The 2404FPW is no longer made. It has been replaced with the 2407WFP (http://accessories.us.dell.com/sna/productdetail.aspx?sku=320-4335), which is currently selling for $675 (discounted from a full price of $750.) This monito...

Monitoring an event monitor
Hello, I would like to monitor an event monitor to make sure that I get an alarm if it's not running. I would like to use SQL statements for this. Is there a way to determine the current status on an event monitor, using SQL? - syscat.events doesn't seem to expose the status of the event monitors. -- Troels "Troels Arvin" <troels@arvin.dk> wrote in message news:hdjjho$g84$1@news.net.uni-c.dk... > Hello, > > I would like to monitor an event monitor to make sure that I get an alarm > if it's not running. I would like to use SQL sta...

Trapezoidal distortion on Sony 17 se II PC monitor
I have a 6 year old Sony 17 SE II monitor which is still a great monitor except that it has developed a severe trapezoidal (keystone?) distortion, broad at the top and narrow at the bottom. My local PC repair shop says that they need to replace a board which will take about 4 weeks to obtain from Sony. Total repair will cost $160. Looks to me like it is only a single component on a board; a toasted cap or resistor? Doesn't anybody do component level repairs anymore? Seems like it would save a lot of time and money. Any ideas; or should I junk it? Thanks, DaveLC On Thu, 04 Dec 20...

Bad login monitoring
Hi, Does anyone know of a script (unencumbered by license) that can combine the results of the last and lastb commands on Solaris. What I am looking for is a single unified output that is sorted by datetime but contains both successful and unsuccessful login attempts, and ideally that can be run periodically (eg cron every five minutes) and append to the same single logfile in such a way that no duplicate entries are created and that the single log file can be archived. It would be absolutely fantastic if the logfile and ourput that the script produces is suitable for auditing purposes to co...

FA: ATARI SC1224 Monitor 3670
The color monitor for the Atari ST line of computers. Looks and works just fine. http://auctions.shopping.yahoo.com/auction/83288382 other auction of related interest: A heap of Atari 2600 cartridges -like Mario Bros for A2600. Atari 8-bit/2600 joysticks (Suncom Starfighter, Amiga Power-Stick, TRAK-BALL) Atari 7800 console Dukes of Hazzard board game. http://auctions.shopping.yahoo.com/auction/83195729 click / follow above link for all the items ...

Toshiba Satellite Pro A40. External Monitor problem
When connected to a n external monitor there is DOS Boot Up information shown and WinXP loading screen but after that all that appears is the Desktop image with no icons and nothing of what is being done on the Laptop screen. When checking which monitor is which the Number 2 comes up on the remote screen. Clearly a signal is passing between the Laptop and external monitor but can anyone suggest the way to solve this problem? Have posted this message in Toshiba Forums but activity in this Newsgroup is higher. km On Sat, 15 Sep 2007 06:47:59 +0100, km <osb@all.co.uk> wrote: >When c...

FS: Dell Latitude P3 650 MHz laptop, 21" monitor, docking station, more ($650 OBO, Arizona)
For sale in the Arizona east valley (near the Mesa-Gilbert area): Asking $650 or best offer * Dell Latitude CPx J650GT Pentium III 650 MHz laptop with 14" built-in color LCD screen, 256 MB RAM, 12 GB hard drive * Dell 24x CD-ROM drive laptop module * Dell 3.5" floppy drive laptop module and cable for external use * Xircom 10/100 Ethernet & 56K modem PCMCIA card * 2 Dell AC power adapters (1 for docking station, 1 for travel) * 1 Dell battery unit (rarely used, like new) * Dell docking station for laptop * Dell monitor stand * Dell 21" Ultrascan P1110 VGA color...

Free : AKF11 Monitor
Free to whoever can collect. A fully working AKF11 monitor with TTL RGB and Scart RGB. Located near Peterborough, Cambridgeshire. email andy((at))thetaylorfamilyDOTdemon(.)coDOTuk ...

Monitors
I'm thinking about getting a new monitor for a Linux box. I've noticed that many most computer monitors work fine if you are looking straight at the monitor but if you veer off to the side or get under them, the picture distorts. Since I like using my computer to watch movies and other videos I am interested in the kind of monitor that doesn't do this. I've seen a few of those in computer stores. Is that second type of monitor actually a television monitor? Does a classification like that still make sense? Have computer monitor and TV screen technology merged...

formatting regarding monitor sizes...
I am designing my first site in html and neet to know something. When viewed in 800x600, the site is readjusting and squasing all the text - it looks awful. Is there a tag(?) that I can use to ensure this doesn't happen, i.e. - it just enalbes viewers to scroll left and right. Thanks.... Edward wrote: > I am designing my first site in html and neet to know something. > When viewed in 800x600, the site is readjusting and squasing all the > text - it looks awful. That's what sites in HTML are *supposed* to do... it's how HTML documents can adjust gracefull...

PC CRT monitor and Powermac
Someone is giving me an dold powermac (not sure the model, perhaps a G3) and I was wondering if a standard CRT monitor that I used with a PC will work with it? or do i need a special 'mac' monitor? thanks. A standard PC monitor should work. You will probably need a DB15 to DB15HD convertor though. If you have purchased a good quality monitor in the past, you might even have one as often they were included in the box. Shaun. "Big McLargehuge" <nomore@spam.com> wrote in message news:1118086778.4bf1395746bac20b2f74a82b79b2c212@teranews... > Someone is...

Activity Monitor: Energy
On Yosemite, Activity monitor has an "energy" Tab. Quite interesting. Shows relative energy consumption for each process. Found out that "Temperature monitor" was one of the big energy hungry processes ! Went into its preferences, lowered its sampling frequency from 1 secon to 1 minute and it greatly reduced energy consumption. For a laptop, this feature in yosemite is very neat to try to increase battery autonomy. Would have never thought that such a simple app would end up being a batttery eater. (So yeah, I may consider changing it). On 2014.10.25, 03:...

Monitoring
I need to know if there is a way of monitoring QZDASOINIT job. We have a web application that is using SQL statement which is requesting information from the AS400 via a connexion pool. I know that the SQL request go thrue the QZDASOINIT job. The information needed is : For each SQL request sent to the AS400, we need the entry and exit time of the request, the duration, % CPU used, ... Can someone tell me, the better way to do this kind of monitoring. Thanks for your Help On Feb 20, 11:12=A0am, Rick <eric.mo...@axon-id.com> wrote: > I need to know if there is a way of monito...

C128 & VGA monitor...again
So by now Im well aware of the issues with RGB refresh rates being too low to drive a VGA monitor, but I was thinking - does there exist any kind of PC card that the 128 could plug into, which would then show RGB and Composite on the PC's monitor? Got the idea from a simple video capture card, and started thinking. Certainly composite would work with some capture cards, but what about the CGA/RGBI 80 column mode? I dont think Ive ever seen a capture card that had that kind of input. I want to get my 128 back online, but I really dont have the space for so many monitors, and this seemed ...

[News] VoIP Monitor Ported to GNU/Linux
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Devfoundry releases VoIP Monitor v1.5 for Linux, Proactive VoIP/FoIP Monitoring and Diagnostics Tool ,----[ Quote ] | This is the first release of VoIP Monitor that has been developed | specifically for Linux. `---- http://www.tmcnet.com/usubmit/-devfoundry-releases-voip-monitor-v15-linux-proactive-voipfoip-/2008/09/24/3669188.htm Recent: The Impact of Open Source VoIP ,----[ Quote ] | The second part of the story of the impact of Open Source VoIP to the whole | telecom market is made of softphones and stacks. Ekiga (formerly known as | G...

Monitor Calibration Luminance Profile Question Gretag Eye One
I recently upgraded my Gretag Eye One software to version 3. They now recommend I use 100 cd/m2 as the recommended luminance for my CRT monitor. First, what is this setting, gamma? and second, how much does this matter in the over all scheme of things? Whatever the luminance was before my system was calibrated to it and everything seemed to work fine. With this new recommendation I notice that my monitor brightness, red, green, and blue values have all changed anywhere from 5 to 25%. Should I just go back to version 2.0 is the question I'm asking myself. Was this something that was broken ...

Monitor
I have seen a IBM P92 Monitor available used for a good price in my area. It has a 13w3 connector on the back. Can anybody tell me before I buy this if it will work with my Sun Ultra1 properly? TIA Darren ...

Recommendation on Performance Monitoring Software
Does anyone have a recommendation for free Java software that monitors CPU and memory usage (by process and total)? Ideally, I would be able to start and stop it from a Java application, and I would like to be able also to monitor network bandwidth. Software that runs standalone on a single Windows PC would work OK. Monitoring execution time for an application would be a plus. I have searched the web and sourceforge.net, but have not found anything other than too many erroneous hits to wade through. I also found a lot of old stuff that does not appear to be up to date. ...