Altera_Forum
Honored Contributor
8 years agomodelsim clock network stuck StX (gate level sim)
Hi All,
I'm hoping someone can help with an issue I've observed in modelsim (10.5b, quartus 17.0). Simply put the clock network correctly drives the network right up to the point where it reaches the register at which point it stays stuck at 'StX'. I've traced the drivers and there is only one, I've re-written it to look like the Altera multi-tap shift register example, removed the reset, add default case. The dataflow diagram is attached. The code is a very simple shift loaded register:
module shiftRegister (
input in,
input clk,
input en,
output d_out
);
// Internal 11 groups of 2 bits
logic d_reg;
always @(posedge clk)
begin
if(en)
d_reg <= {d_reg,in};
else
d_reg <= d_reg;
end // always
// sneaky cast ;-)
assign d_out = d_reg;
endmodule
The testbench is just reads a test vector:
// Test bench for shiftRegister.sv
//
// test_vector.txt (bb_b_b <in>_<en>)
timeunit 1ns/100ps;
module shiftRegister_tb;
// Glue for the instance
logic in;
logic clk;
logic en;
logic d_out;
// Internal, needed by testbench
integer tst_vec;
logic t;
always# 1 clk = ~clk;
initial begin
tst_vec = $fopen("../../test_vector.txt","r");
// just be clean and set an initial value.
clk = 1;
en = 0;
in = '0;
t = '0;
end
always @(posedge clk) begin
// Start looping the test vector to generate our input
if(!$feof(tst_vec)) begin
$fscanf(tst_vec,"%b",t);
in = t;
en = t;
end
else // when done just go quiet...
begin
en = 0;
in = '0;
end
end
shiftRegister dut (
.in(in),
.clk(clk),
.en(en),
.d_out(d_out)
);
endmodule
And the test vector is
00_0
00_0
00_0
00_0
00_0
01_0
10_0
00_0
00_0
11_1
10_1
01_1
00_1
11_1
10_1
01_1
00_1
11_1
10_1
01_1
00_0
00_0
00_0
I've reached a dead end in figuring this out, if anyone has any ideas please let me know. Thanks, -- Paul https://alteraforum.com/forum/attachment.php?attachmentid=14497&stc=1