Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Is this verilog code synthesizable?

Status
Not open for further replies.

nervecell_23

Member level 1
Joined
Apr 26, 2013
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,565
Hi,

I want to capture the data that is available one clock cycle after the rising of a certain flag.

I experimented with the following code and it worked:
Code:
always@(posedge clk)
  begin
      if(flag == 1)begin
        @(posedge clk);
        $fwrite(file,"%d\n",data);
      end
    
  end

I find this very convenient because previously I have to create a new signal which equals to 'flag' with one clock cycle delay and then capture the data when the delayed signal is high.

I'm wondering if the above code is synthesizable and if it is the same thing as the conventional way of doing it in terms of the generated hardware after synthesis?

Thanks!
 

Not synthesizable.
Probably you use $fwrite in testbench. So, why do you want to synthesize
 

what hardware do you expect $fwrite to synthesise to?
 

what hardware do you expect $fwrite to synthesise to?

Sorry I didn't make it clear. I used above code for testbench. What I mean is if I can use the same coding style in synthesis after replacing '$fwrite' line with something else say 'a<=b;'.

- - - Updated - - -

Not synthesizable.
Probably you use $fwrite in testbench. So, why do you want to synthesize

Sorry I didn't make it clear. I used above code for testbench. What I mean is if I can use the same coding style in synthesis after replacing '$fwrite' line with something else say 'a<=b;'.
 

you cannot embed another timing statement inside an always block. In real hardware, it would be impossible to detect an edge at a clock edge.
 

Nested edge sensitive events are definitely not synthesizable.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top