Newsgroups: comp.sys.transputer
From: phil@tweety.mrad.com.au (Phil Nitschke)
Subject: Re: CHAN vs. PORT
Organization: MRad Pty Ltd, Australia
Date: 07 Nov 1994 23:43:13 GMT
Message-ID: <PHIL.94Nov8101313@tweety.mrad.com.au>


>>>>> "OT" == Oyvind Teig <teig@autro1.UUCP> writes:

    OT> OCCAM CHAN vs. PORT
    OT> Questions below concern memory mapped I/O only:
    OT> Q1.  CHAN and PORT - What is the difference?
    OT> Q2.  Which do I use if I want to access memory mapped I/O?
    OT> Q3.  Which do I use if I later on want to make a simulator for
    OT>      the I/O?
    OT> Q4.  How do I access memory mapped registers on a UART?

As far as I know, all your answers are correct!

I asked a similar question on this newsgroup (20 Jun 94).  My post was
as follows:

    Phil> I am designing some Occam code for a real-time hardware
    Phil> system where the embedded transputers control various
    Phil> aspects of the hardware using a memory-mapped interface.

    Phil> I am seeking people's opinions on the following two methods
    Phil> of addressing the memory-mapped hardware:

        (a)     Using normal variables which are PLACE'd at the desired
                location and written-to/read-from by variable
                assignment;

                        VAL filter.address IS #20000008 :
                        INT16 filter.control :
                        PLACE filter.control AT filter.address :

                        SEQ
                          filter.control := #04C0(INT16)
                          -- etc

        (b)     Using PORTs which are PLACE'd at the desired location
                and addressed as primitive channels.

                        VAL filter.address IS #20000008 :
                        PORT of INT16 filter.control :
                        PLACE filter.control AT filter.address :

                        SEQ
                          filter.control ! #04C0(INT16)
                          -- etc

    Phil> I want to know if there are any performance (or other)
    Phil> advantages that could be obtained by using one method in
    Phil> preference to the other?

    Phil>   (I note that, when using PORTs, the compiler should locate
    Phil> all instances of PARallel processes writing to the same
    Phil> address/PORT, but compilers might NOT be designed to detect
    Phil> parallel accesses of two variables that are PLACE'd at the
    Phil> same location.  Thus option (b) would appear more "safe").

I only got one answer (from Andy Rabagliati; *(thanks!)), but from
memory it didn't say whether there would be any real performance
impact by choosing one or the other.

I concluded that one would only use PORTs (as you stated) when one had
to address memory-mapped I/O where reads and writes were necessary at
a single address and you didn't want to use PLACEd variables.
Otherwise, CHANs seemed to do everything that PORTs can do, with
better support from the INMOS tools.  Now I don't use any ports at
all.

--
Phil Nitschke
MRad Pty Ltd.

