Reputation: 114
EDIT: seems to be working now
I'm trying to write two macros that will be used to wrap any code. For example:
`define start_of_macro()begin\
fork\
begin\
#20us;\
end\
begin\
end
and the second part:
`define end_of_macro()begin\
end\
join_any disable_fork;\
end
And use it something like this:
`start_of_macro
while(1)begin #20ns; end
`end_of_macro
I keep on getting errors due to the fact that each macro isn't legal on it's own. Any way to overcome this?
Thanks in advance!
Upvotes: 0
Views: 469
Reputation: 7573
I guess you're trying to fork something in parallel to the 20 microsecond wait. You have an extra end
in the opening macro. It should be:
`define start_of_macro()\
begin\
fork\
begin\
#20us;\
end\
begin
You also have an extra begin
in the closing macro. It should be:
`define end_of_macro()\
end\
join_any\
disable_fork;\
end
After macro expansion, the code that goes between the opening and the closing macros will be reside between a begin
(from start_of_macro
) and an end
(from end_of_macro
).
Upvotes: 2