-2
안녕하세요 저는 folowing 코드를 사용하여 n 비트 카운터를 설계하고 있습니다. 시작과 끝에 따라 위 또는 아래 카운터를 인스턴스화하려고합니다.Verform의 조작 된 문
하지만 "잘못된 문구"가 나타납니다. 도와주세요.
module nbitUpCounter(startc,endc , clk, rst_n,actlow,count);
parameter n = 7;
output reg [n:0] count;
input [n:0] startc;
input [n:0] endc;
input clk;
input rst_n;
input actlow;
// Increment count on clock
always @(actlow or posedge clk or negedge rst_n)
begin
if (actlow == 0)
begin
if (rst_n==0)
count = startc;
else if (count==endc) count=startc;
else count = count + 1;
end
end
endmodule
module nbitDownCounter(startc,endc , clk, rst_n,actlow,count);
parameter n = 7;
output reg [n:0] count;
input [n:0] startc;
input [n:0] endc;
input clk;
input rst_n;
input actlow;
// Increment count on clock
always @(actlow or posedge clk or negedge rst_n)
begin
if (actlow == 0)
begin
if (rst_n==0)
count = startc;
else if (count==endc) count=startc;
else count = count - 1;
end
end
endmodule
module Init(startc,endc , clk, rst_n,actlow,count);
parameter n = 7;
output wire [n:0] count;
input [n:0] startc;
input [n:0] endc;
input clk;
input rst_n;
input actlow;
generate
initial
begin
if(startc>endc)
nbitDownCounter c(startc, endc, C_t,rst_t,actlow,count);
end
endgenerate
endmodule
module Testbench;
reg [7:0] startc, endc;
reg C_t, rst_t;
reg actlow;
wire [7:0] outc;
initial
begin
//case 0
startc <= 8'b00000011; endc <= 8'b0000001;
//Init i(startc,endc,C_t,rst_t,actlow,count);
actlow<=0;
C_t <=1; rst_t <=0;
#1 $display("count = %b",outc);
//case1
rst_t<=1;C_t<=0;C_t<=1;
#1 $display("count = %b",outc);
//Case3
C_t<=0;C_t<=1;
#1 $display("count = %b",outc);
//Case3
C_t<=0;C_t<=1;
#1 $display("count = %b",outc);
end
endmodule
오류 메시지의 전체 내용을 게시하십시오. 그 이상의 내용이 있습니다. – Tim