C
currentsource
Guest
I'm trying to define a macro for a simple two-flop synchronizer in an IS
project:
`define XCLK_SYNC_2DFF(q, d, clk) \
reg __sync__``q; \
always @(posedge clk) \
begin \
__sync__``q <= d; \
q <= __sync__``q; \
end \
XST errors out on this; I believe the `` is SystemVerilog syntax which XS
doest not support. But the following doesn't work either:
`define XCLK_SYNC_2DFF(q, d, clk) \
reg sync; \
always @(posedge clk) \
begin \
sync <= d; \
q <= sync; \
end \
Limited though the utility of such a macro may be, shouldn't th
preprocessor just dump the lines above, substituting for q, d and cl
wherever it sees a `XCLK_SYNC_2DFF invocation in the source? Doe
Verilog-2001 specifically forbid creation of temp regs/wires within macros
Is there any way to code this macro while keeping XST happy? Or should
just create a separate module/inline the code?
---------------------------------------
Posted through http://www.FPGARelated.com
project:
`define XCLK_SYNC_2DFF(q, d, clk) \
reg __sync__``q; \
always @(posedge clk) \
begin \
__sync__``q <= d; \
q <= __sync__``q; \
end \
XST errors out on this; I believe the `` is SystemVerilog syntax which XS
doest not support. But the following doesn't work either:
`define XCLK_SYNC_2DFF(q, d, clk) \
reg sync; \
always @(posedge clk) \
begin \
sync <= d; \
q <= sync; \
end \
Limited though the utility of such a macro may be, shouldn't th
preprocessor just dump the lines above, substituting for q, d and cl
wherever it sees a `XCLK_SYNC_2DFF invocation in the source? Doe
Verilog-2001 specifically forbid creation of temp regs/wires within macros
Is there any way to code this macro while keeping XST happy? Or should
just create a separate module/inline the code?
---------------------------------------
Posted through http://www.FPGARelated.com