🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #837

Re: Digital Circuit simulator using Lazy Fuctional languages

#837
From: Thomas Johnsson
Date: Fri, 22 Mar 1991 11:00
30 lines
1874 bytes
In article <403@schoenfinkel.CS.UWindsor.Ca> dimitris@CS.UWindsor.Ca (Dimitris Phoukas) writes:
>
>Are there any pointers to implementations of digital circuit  simulators
>using  Lazy-Functional techniques? The simulator should at least be able
>to  model  the  'transport'  and  'inertial'  type   delays   found   in
>discrete-event  systems.  [.........]

I don't know what transport and inertial delays are, but if you are
content with quantized time, it is extremely easy to do digital
circuit simulation using streams. a NAND gate, for example, is
simulated with a function taking two streams of booleans as arguments
and returns a stream of booleans as the result.  The simulated circuit
is hooked up in a letrec expression.  For example, simulating an
oscillator made up of an inverter (with a time delay of two time
units) can be done as follows (using Lazy ML):

let rec inv s = False.False.map (\x.~x) s  in 	-- The inverter definition

let rec x = inv x  in		-- The circuit

	x			-- Look at x


The value of the program is the infinite list 
False.False.True.True.False.False. ....

-- Thomas Johnsson
Thomas Johnsson  (johnsson@cs.chalmers.se)
Dept. of CS, Chalmers University of Technology, S-412 96 Goteborg, Sweden
phone: dept: +46 (0)31 721088.
Technical Details
Message-ID: <4416@undis.cs.chalmers.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!chalmers.se!cs.chalmers.se!johnsson
References: <403@schoenfinkel.CS.UWindsor.Ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!chalmers.se!cs.chalmers.se!johnsson
From: johnsson@cs.chalmers.se (Thomas Johnsson)
Newsgroups: comp.lang.functional
Subject: Re: Digital Circuit simulator using Lazy Fuctional languages
Keywords: lazy, functional, processes
Message-ID: <4416@undis.cs.chalmers.se>
Date: 22 Mar 91 11:00:00 GMT
References: <403@schoenfinkel.CS.UWindsor.Ca>
Sender: news@cs.chalmers.se
Organization: Dept. of CS, Chalmers, Sweden
Lines: 30