Verilog HELP

Thread Starter


Joined Jan 7, 2012
I am trying to model a block and am writing behavioural verilog. I am using Icarus Verilog v0.9 to compile but i keep getting syntax error on line 43:

Any idea why this is? This seems like a legitimate line of code to me

Rich (BB code):
`timescale 1ps/1ps

module unb_bfm (iUNB_ENABLE,

input iUNB_ENABLE;
input iREFCLK;
output [1:0] oDB_DATA;
output oDB_CLK;
output oDB_VALID;

reg db_clk;
reg db_data_valid;
reg [1:0] db_data;

//wire m_value;
//wire n_value;
reg count_done;
reg count_m_done;
reg count_n_done;
reg db_clk_trigger;
reg db_data_trigger;
integer i;

parameter HALF_PERIOD = 667; // Approximately 750 MHz
parameter M_VALUE = 2;
parameter N_VALUE = 2;

initial begin
    db_clk = 1'b0;
    db_data_valid = 1'b0;
    db_data = 2'b00;
    count_done = 1'b0;
    count_m_done = 1'b0;
    count_n_done = 1'b0;
    db_clk_trigger = 1'b0;
    db_data_trigger = 1'b0;

while (iUNB_ENABLE==1) begin  // <--------- this is line 43.
    db_clk_trigger = 1'b1;
Last edited by a moderator:


Joined Apr 10, 2008
This seems pretty strange to me. Looks like this code is written for a testbench... but you don't have any UUT and your TB has ports (which I can't imagine a reason for).

If you didn't intend this to be a testbench, you need to re-think this. It is not synthesizable. I get the sense there is more to this code than you are showing. Also, please use the 'code' tags.

As kubeek said, seeing the exact error message would help


Joined Jan 10, 2012
You can only use structures like "while" "for", etc in a sequential block. You need to define an "always @" and then use a clock in the sensitivity list or else a wait statement inside the sequential block. Look up the definition of "always @" and read on sequential blocks. You may also use "initial" for code that executes only once.