The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
It's ALIVE!!!!

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.
It's ALIVE!!!! Posted: Mar 13, 2006 7:07 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Phil Tomson.
Original Post: It's ALIVE!!!!
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 just finished making all the connections between the new RHDL 'frontend' and the RHDL backend simulation code and the following design with both behavioral elements (the AndGate and Invert), structural elements (NandGate) and hierarchy is working:
require 'RHDL'
include RHDL

AndGate = model {
  inputs  a, b
  outputs out
  define_behavior {
    out <= a & b
  }
}

Invert = model {
  inputs  a
  outputs not_a
  define_behavior{
    not_a <= a.inv
  }
}

NandGate = model {
  inputs  aa, bb
  outputs a_nand_b
  init {
    a_and_b = Signal(Bit())
    andg = AndGate.new(aa,bb,a_and_b)
    Invert.new(a_and_b, a_nand_b)
  }
}

require 'Simulator'
include Simulator

a = Signal(Bit.new('1'))
b = Signal(Bit.new('1'))
out = Signal(Bit.new )
nand = NandGate.new(a,b, out)
step { puts "a=#{a}, b=#{b}, out=#{out}"}
a <= '0'
step { puts "a=#{a}, b=#{b}, out=#{out}"}


That's a lot nicer than it was in the old version of RHDL. The thing that really bugs me now looking at this code is that you've got to both require and include RHDL:
require 'RHDL'
include RHDL
...and the same for Simulator. That's probably another thing that the user shouldn't need to wonder about. I think it's time to do some redefinition of the kernel::include method... I should gemify RHDL and do a release of the new version in the next few days.

Read: It's ALIVE!!!!

Topic: Eventos - Marzo Previous Topic   Next Topic Topic: Parser Trivia

Sponsored Links



Google
  Web Artima.com   

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