Re: [sv-ec] RE: [sv-bc] Final blocks in packages

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Fri May 19 2006 - 09:15:48 PDT
"Final blocks are not processes, so they are not symmetrical with
initial
blocks. In any case, I might be able to convince Doug that we don't need
them in packages because we don't have need for destructors either."

Then which part of the text description in Doug's original
http://eda.org/svdb/bug_view_page.php?bug_id=878  is wrong?  Or is he
right, but there is a better way to solve the problem he's pointed out? 

Doug writes --
-------------------------------
It is possible to call class constructors and other
initialization functions in package scopes. This feature
makes it possible to encapsulate generic "singleton"
functionality in a simulation. Examples could be
a socket-based library, or an I/O library, or something
else that consumes system resources.

Currently there is no way to write automatic cleanup
code for this type of package functionality without
a hack like introducing a final block into a related
module, or explicitly cleaning up the resources with
a function call from inside a related module.

If we allowed final blocks in packages, the problem
would be solved. Consider:

package p;

    int mcd = $fopen("myfile", "w"));

    final begin
        $fclose(mcd);
    end

endpackage

module m1;
    initial 
        $fdisplay(p::mcd, "Hello from %m");
endmodule


module m2;
    initial 
        $fdisplay(p::mcd, "Hello from %m");
endmodule

I don't see any harm in allowing final blocks
in packages. It shouldn't be hard to implement,
nor should there be any harmful effects on the
language's health.
-------------------------------------------


-----Original Message-----
From: owner-sv-ec@eda.org [mailto:owner-sv-ec@eda.org] On Behalf Of
Rich, Dave
Sent: Friday, May 19, 2006 7:39 AM
To: sv-ec@eda.org
Subject: RE: [sv-ec] RE: [sv-bc] Final blocks in packages

Arturo,

Final blocks are not processes, so they are not symmetrical with initial
blocks.

In any case, I might be able to convince Doug that we don't need them in
packages because we don't have need for destructors either.

The slippery slope I'm trying to avoid is if a package appears in the
woods, and nobody references it, does it still exist? I think the answer
to that question should always be it doesn't matter.

Dave


> -----Original Message-----
>
> 
> I understand that initial blocks, always blocks, and continuous
> assignments are currently not allowed in packages. And I'm OK with
that
> limitation although I don't believe it is fundamental in any way. In
> fact, if your final block proposal passes, people will likely wonder
> about the lack of symmetry (why not allow initial blocks as well). I
> think the only truly problematic construct is the continuous
assignment.
> 
> So what's so problematic about a process originating within a package?

> 
> As for the debate regarding thread vs. declarative scope in the
reactive
> region scheduling discussions, I didn't think we had enough time to
work
> out a change in the semantics at the time. But, I'd be happy to
revisit
> the decision.
> 
Received on Fri May 19 09:15:44 2006

This archive was generated by hypermail 2.1.8 : Fri May 19 2006 - 09:15:51 PDT