module shudian(clk_1hz,rst,en,set_fen,set_shi,miao0,miao1,fen0,fen1,shi0,shi1,shi_cout,beep); input clk_1hz,rst,en,set_fen,set_shi; output [3:0]shi0,shi1; output [3:0]miao0,miao1,fen0,fen1; output shi_cout; output beep; wire miao_cout,fen_cout,fen_en,shi_en,clk_1hz; assign fen_en=miao_cout||set_fen; assign shi_en=(fen_cout && miao_cout)||set_shi; cnt60 miao( .clk(clk_1hz), .rst(rst), .en(en), .cnt0(miao0), .cnt1(miao1), .cout(miao_cout)); cnt60 fen( .clk(clk_1hz), .rst(rst), .en(fen_en), .cnt0(fen0), .cnt1(fen1), .cout(fen_cout)); cnt24 shi ( .clk(clk_1hz), .rst(rst), .en(shi_en), .cnt0(shi0), .cnt1(shi1), .cout(shi_cout)); baoshi u2( .clk_1Hz(clk_1hz), .miao0(miao0), .miao1(miao1), .fen0(fen0), .fen1(fen1), .beep(beep)); endmodule
时间: 2024-01-13 19:04:50 浏览: 31
这是一个 Verilog HDL 的模块,用于实现一个数字时钟。模块中包含了三个计数器模块(cnt60 和 cnt24),用于计算秒、分、时,以及一个报时模块(baoshi),用于发出滴答声。模块的输入包括一个时钟信号(clk_1hz)、复位信号(rst)、使能信号(en)、设置分(set_fen)、设置时(set_shi)等,输出包括时、分、秒的计数值(shi0, shi1, fen0, fen1, miao0, miao1)、时的进位信号(shi_cout)和滴答声(beep)等。
相关问题
verilog中出现ERROR: [Labtools 27-2220] Launch Error: Unable to launch local cs_server executable. ERROR: Could not find 64-bit executable. ERROR: F:/Xilinx_ShuDian/Vivado/2019.2/bin/unwrapped/win64.o/cs_server.exe does not exist
这个错误可能是由于 Vivado 工具中的 cs_server.exe 文件没有正确安装或者文件路径不正确导致的。你可以尝试以下步骤来解决这个问题:
1. 确认 Vivado 工具已经正确安装,并且安装路径是 F:/Xilinx_ShuDian/Vivado/2019.2。
2. 检查 F:/Xilinx_ShuDian/Vivado/2019.2/bin/unwrapped/win64.o/ 目录下是否存在 cs_server.exe 文件。如果不存在,可以尝试重新安装 Vivado 工具或者更新工具版本。
3. 如果 cs_server.exe 文件存在,那么可能是该文件所在的路径没有被添加到系统环境变量中。你可以尝试将该路径添加到 PATH 环境变量中,具体方法可以参考以下链接:https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/
4. 如果以上步骤都无法解决问题,你可以尝试在 Vivado 工具中重新生成 cs_server.exe 文件,具体方法可以参考以下链接:https://forums.xilinx.com/t5/Vivado-TCL-Community/How-to-generate-a-new-cs-server-exe-file/m-p/831794#M515
希望以上方法能够帮助你解决问题。
需要详细的整个过程的代码 拜托了
好的,这里提供一个详细的代码实现,包括爬虫、MongoDB存储和Flask Web程序。
1. 爬取蔚蓝书店数据
```python
import requests
from bs4 import BeautifulSoup
def get_books():
url = 'https://www.weilan-shudian.com/book'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/58.0.3029.110 Safari/537.3'}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.text, 'html.parser')
books = []
for book in soup.select('table tr')[1:]:
title = book.select_one('td:nth-of-type(1)').text.strip()
author = book.select_one('td:nth-of-type(2)').text.strip()
price = book.select_one('td:nth-of-type(3)').text.strip()
publisher = book.select_one('td:nth-of-type(4)').text.strip()
publish_date = book.select_one('td:nth-of-type(5)').text.strip()
books.append({
'title': title,
'author': author,
'price': price,
'publisher': publisher,
'publish_date': publish_date
})
return books
```
2. 存储到MongoDB数据库
```python
import pymongo
client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client['bookstore']
collection = db['books']
def save_books(books):
for book in books:
collection.update_one({'title': book['title']}, {'$set': book}, upsert=True)
```
3. Flask Web程序
```python
from flask import Flask, render_template, jsonify
import pymongo
app = Flask(__name__)
client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client['bookstore']
collection = db['books']
@app.route('/')
def index():
books = list(collection.find())
return render_template('index.html', books=books)
@app.route('/progress')
def progress():
books_count = collection.count_documents({})
return jsonify({'progress': f'{books_count} books have been saved.'})
if __name__ == '__main__':
app.run(debug=True)
```
4. 程序入口
```python
import time
from flask import Flask, render_template, jsonify
import pymongo
app = Flask(__name__)
client = pymongo.MongoClient('mongodb://localhost:27017/')
db = client['bookstore']
collection = db['books']
@app.route('/')
def index():
books = list(collection.find())
return render_template('index.html', books=books)
@app.route('/progress')
def progress():
books_count = collection.count_documents({})
return jsonify({'progress': f'{books_count} books have been saved.'})
if __name__ == '__main__':
while True:
books = get_books()
save_books(books)
time.sleep(60) # 等待60秒再次爬取
```
5. 模板文件
```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
<title>Bookstore</title>
<style>
table {
border-collapse: collapse;
margin: 20px 0;
}
table th, table td {
padding: 10px;
border: 1px solid #ddd;
text-align: center;
}
table th {
background: #f2f2f2;
}
</style>
</head>
<body>
<h1>Bookstore</h1>
<table>
<thead>
<tr>
<th>Title</th>
<th>Author</th>
<th>Price</th>
<th>Publisher</th>
<th>Publish Date</th>
</tr>
</thead>
<tbody>
{% for book in books %}
<tr>
<td>{{ book.title }}</td>
<td>{{ book.author }}</td>
<td>{{ book.price }}</td>
<td>{{ book.publisher }}</td>
<td>{{ book.publish_date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<p id="progress"></p>
<script>
function getProgress() {
fetch('/progress')
.then(response => response.json())
.then(data => {
document.querySelector('#progress').innerText = data.progress;
});
}
setInterval(getProgress, 1000);
</script>
</body>
</html>
```
这是一个完整的程序框架,你可以在此基础上进行进一步的修改和完善。注意,代码中使用了定时器来每隔60秒自动爬取一次数据,这可以根据实际需求进行调整。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)