4258 views|13 replies

20

Posts

0

Resources
The OP
 

How to write the test bench file for the verliog10 divider [Copy link]

 

This post is from EE_FPGA Learning Park

Latest reply

Initialize reg[8:0] CNT=9'b0; in this file and see the result   Details Published on 2020-4-14 22:52
 

122

Posts

0

Resources
2
 

Actually, what you wrote is correct, but simulation requires initial values. In your design, clkout and cnt have no initial values, so simulation may show red lines. You need to give initial values. For initial values, you can write reg [3:0] cnt = 4'd0; clkout in the same way. With initial values, simulation can be normal.

This post is from EE_FPGA Learning Park
 
 

20

Posts

0

Resources
3
 

This post is from EE_FPGA Learning Park
 
 
 

20

Posts

0

Resources
4
 

I don't know where to add the register and CLKOUT

I tried many places, but nothing worked.

image.png (35.71 KB, downloads: )

image.png

image.png (140.73 KB, downloads: )

image.png

image.png (140.73 KB, downloads: )

image.png

image.png (26.21 KB, downloads: )

image.png
This post is from EE_FPGA Learning Park
 
 
 

1w

Posts

204

Resources
5
 

There is a syntax error in the error. First, check whether the code semicolon, left and right brackets are missing. I looked at your code and it should be written as a comma instead of a semicolon.

qq_pic_merged_1586330135793.jpg (74.33 KB, downloads: 0)

qq_pic_merged_1586330135793.jpg
This post is from EE_FPGA Learning Park
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
 
 
 

1w

Posts

204

Resources
6
 
Wrong picture.

IMG_20200414_073534.jpg (101.77 KB, downloads: 0)

IMG_20200414_073534.jpg
This post is from EE_FPGA Learning Park
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

The comma here is after the test bench file is generated. My first test bench file runs successfully on modelsim, so it should not be a comma problem. But since I just started learning, I don't know how to express the change of CLKOUT with CLKIN in code.  Details Published on 2020-4-14 10:42
 
 
 

1w

Posts

204

Resources
7
 
When checking for semicolon errors, sometimes the actual error is not on the line where the error message appears. You need to trace it back. The first way is to check if the current line is correct? Are the semicolons in the previous lines correct? Then, are the lines of code that correspond to the variables in this line correct? Are the semicolons correct? Generally, you will not miss it if you follow this line of thinking.
This post is from EE_FPGA Learning Park
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

Well, thank you very much. I will use this method to check grammatical errors next time.  Details Published on 2020-4-14 10:44
 
 
 

20

Posts

0

Resources
8
 

The comma here is after the test bench file is generated. My first test bench file runs successfully on modelsim, so it should not be a comma problem. But since I just started learning, I don't know how to express the change of CLKOUT with CLKIN in code.

This post is from EE_FPGA Learning Park
 
 
 

20

Posts

0

Resources
9
 
okhxyyo posted on 2020-4-14 07:54 When checking for semicolon errors, sometimes the actual error is not on the error line. You need to trace it back. The first type is, is this line correct? The semicolons in the previous few lines of code are correct...

Well, thank you very much. I will use this method to check grammatical errors next time.

This post is from EE_FPGA Learning Park

Comments

Look at the reply from Sofa, you did not give the initial value, which is equivalent to your clkin having nothing coming in. Generally, we need to give the clkin waveform when simulating.  Details Published on 2020-4-14 11:28
 
 
 

1w

Posts

204

Resources
10
 
Gerryi posted on 2020-4-14 10:44 Well, thank you very much. I will use this method to check grammatical errors in the future.

Look at the reply from Sofa, you did not give the initial value, which is equivalent to your clkin having nothing coming in. Generally, we need to give the clkin waveform when simulating.

This post is from EE_FPGA Learning Park
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle

Comments

Emmm, my test bench gave me the initial value of CKLIN, and then it flipped every 10ns. When I used modelsim to simulate, CLKIN had a waveform of [attachimg]470300[/attachimg][attachimg]470301[/attachimg], but CLINOUT was always a red line. Then I looked at  Details Published on 2020-4-14 12:50
Personal signature

玩板看这里:

https://bbs.eeworld.com.cn/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 
 

20

Posts

0

Resources
11
 
okhxyyo posted on 2020-4-14 11:28 Look at the reply from sofa, you did not give the initial value, which is equivalent to your clkin having nothing coming in. Generally, when we simulate, we need to give the clkin wave...

emmm

My test bench gave me the initial value of CKLIN, and then it flipped every 10ns. When I used modelsim to simulate, CLKIN had a waveform

But CLINOUT is always a red line. Then I read the reply and changed it myself, but it was always wrong. I didn’t know where to add CNT and CLKOUT.

This post is from EE_FPGA Learning Park
 
 
 

5979

Posts

8

Resources
12
 

Did you generate this divider using IPcore, or did you write it yourself?

This post is from EE_FPGA Learning Park

Comments

This is from the teacher's class. I wrote a 10-frequency divider based on the code of the 1000-frequency divider. [attachimg]470442[/attachimg] is similar to this  Details Published on 2020-4-14 19:24
Personal signature生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

20

Posts

0

Resources
13
 
chenzhufly posted on 2020-4-14 16:04 Did you generate the divider through IPcore or write it yourself?

This is from the teacher's class courseware. I wrote a 10-divider based on the code of the 1000-divider.

is similar to this

This post is from EE_FPGA Learning Park
 
 
 

5979

Posts

8

Resources
14
 

Initialize reg[8:0] CNT=9'b0; in this file and see the result

This post is from EE_FPGA Learning Park
Personal signature生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙
===================================
做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list