Subject: [sv-ec] Asychronous mailbox proposal
From: Kevin Cameron (Kevin.Cameron@nsc.com)
Date: Thu Dec 12 2002 - 12:29:44 PST
Stu,
I was wondering if you could paste the section below into the LRM for review with the mailbox
stuff, it's the only functionality from the channels proposal that isn't handled by mailboxes (the rest
is handled by DirectC):
12.5.1 Asynchronous Mailbox Communication
Data arriving at a mailbox generates an event. The event is true while data remains in the mailbox.
As with signal events these events can be waited for with the @ operator. The following code
could be used to replace a wire of type logic with a FIFO to safely cross clock domains:
typedef mailbox #(logic) l_mbox;
l_mbox lm = new;
logic l_val1;
always @(posedge clock1) lm.put(l_val1) // write data on clock1
logic l_val2;
always @(lm && posedge clock2) lm.get(l_val2); // sync data to clock2
-------------------------------------------
Note: the alternative code without @(lm) would poll on every "posedge clock2"
and do a try_get - which is a lot more inefficient.
Regards,
Kev.
-- National Semiconductor, Tel: (408) 721 3251 2900 Semiconductor Drive, Mail Stop D3-500, Santa Clara, CA 95052-8090
This archive was generated by hypermail 2b28 : Thu Dec 12 2002 - 12:30:22 PST