Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
15323 Discussions

flop-flop simulation in ModelSim

Altera_Forum
Honored Contributor II
1,339 Views

i try to simulate [1:0]flip-flop in ModelSim and i see one normal signal(out_inf[0]) and one blue signal(out_inf[1]). What is it?

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
203 Views

Blue means 1'bZ. We will need to code to understand the problem.

Altera_Forum
Honored Contributor II
203 Views

dff code 

module dff(clk, din, dout); input clk; input din; output dout; reg dout; always @ (posedge clk) begin dout <= din; end endmodule  

 

testbench 

module top; reg clk; reg in_inf; wire out_inf; dff D1 (clk, in_inf, out_inf); initial // Clock generator begin clk = 0; forever# 10 clk = !clk; end initial //in_inf begin in_inf = 0; # 28 in_inf = 1; # 5 in_inf = 0; end initial //in_inf begin in_inf = 0; # 48 in_inf = 1; # 5 in_inf = 0; end endmodule  

i want to see normal (not blue) signal as out_inf[1]
Altera_Forum
Honored Contributor II
203 Views

You should always look sharp at the Modelsim warnings. They tell about problem with reg dout declaration. Must be reg [1:0] dout. Or include reg in the output definition.

Altera_Forum
Honored Contributor II
203 Views

whys out_inf[0] is h'x (in the beginning), not zero?

Altera_Forum
Honored Contributor II
203 Views

Because you dont have an initial or reset value for them. They wont be assigned a value until the first clock

Altera_Forum
Honored Contributor II
203 Views

can i initialize value before first clock?

Reply