The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Process-local variables in RHDL

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Phil Tomson

Posts: 16
Nickname: philtomson
Registered: Mar, 2006

Phil Tomson is working on strange (and hopefully wonderful) things often Ruby-related.
Process-local variables in RHDL Posted: Apr 6, 2006 12:15 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Phil Tomson.
Original Post: Process-local variables in RHDL
Feed Title: Thoughtfiz
Feed URL: http://wiki.railsplayground.net//xml/rss/feed.xml
Feed Description: Thoughtfiz: lots of tiny thought bubbles, mostly Ruby-related.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Phil Tomson
Latest Posts From Thoughtfiz

Advertisement
I wanted to introduce process-local variables in RHDL, and I tried a lot of different ideas, but finally settled on this fairly simple syntax (which was also easy to implement):
      process(clk) {
        #process-local vars here
        c = 0 #c is now local to the process
        process_behavior { #process behavior here
          if clk.event and clk == '1'
            puts "rising edge of clk"
            if reset == '1' || c== (mod-1)
              c = 0
            else
              c = c+1
            end
            count <= c
          end
        }
      }

The variable c is local to this process block. The only drawback is the process_behavior which is now needed. I may end up calling it something else. I'd like to be able to use begin instead, but it's taken. Maybe just behavior would work. Whatever I end up calling it, if the process_behavior call and block are missing, then an exception is raised (every process should have some behavior defined).

To explain a bit further what's happening in the code above: The c=0 just before the process_behavior call gets run just once while the code inside of the process_behavior block gets called every time the clk signal (in the sensitivity list for this process) changes value.

Read: Process-local variables in RHDL

Topic: Time-based Fragment Caching with MemCache Previous Topic   Next Topic Topic: Better Support for ActiveRecord in the Ports Tree

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use