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
|
|
|
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
|
|
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
|
|