下载地址:http://pan38.cn/ie7728f75

项目编译入口:
domain/
# Folder : jiandaochuexcelshujudaochuverilogmokuai
# Files : 26
# Size : 86.1 KB
# Generated: 2026-03-30 19:05:35
jiandaochuexcelshujudaochuverilogmokuai/
├── actions/
│ ├── Resolver.py
│ └── Validator.js
├── agents/
│ └── Helper.js
├── config/
│ ├── Builder.properties
│ ├── Listener.xml
│ ├── Parser.json
│ ├── Repository.json
│ ├── Server.properties
│ └── application.properties
├── domain/
│ └── Worker.js
├── package.json
├── partials/
│ ├── Converter.go
│ ├── Engine.js
│ ├── Pool.py
│ ├── Scheduler.java
│ └── Wrapper.go
├── pom.xml
├── route/
│ └── Handler.py
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ ├── Adapter.java
│ │ │ ├── Controller.java
│ │ │ ├── Processor.java
│ │ │ └── Util.java
│ │ └── resources/
│ └── test/
│ └── java/
├── topic/
│ └── Queue.java
└── usecase/
└── Client.py
jiandaochuexcelshujudaochuverilogmokuai:从股票软件导出Excel到Verilog模块的自动化工具
简介
在金融科技和硬件设计交叉的领域,我们经常需要将股票软件中的交易数据导出为Excel格式,然后进一步处理为硬件描述语言模块。jiandaochuexcelshujudaochuverilogmokuai项目正是为解决这一需求而设计的自动化工具链。它能够将股票软件导出excel的数据文件,经过多层处理和转换,最终生成可综合的Verilog模块,用于金融交易算法的硬件加速实现。
该项目采用模块化架构,包含数据验证、解析、转换和代码生成等多个阶段。通过配置文件驱动,可以灵活适应不同的数据格式和输出需求。无论是从股票软件导出excel的日线数据,还是分钟级交易记录,都能被高效处理并转换为硬件友好的描述。
核心模块说明
项目结构清晰地划分了各个功能模块:
- config/:存放所有配置文件,包括数据解析规则、转换参数和服务器设置
- actions/:包含核心的数据解析和验证逻辑
- partials/:各种转换引擎和包装器,支持多种编程语言实现
- agents/ 和 domain/:辅助工具和领域模型定义
- route/:处理数据流的路由逻辑
关键文件如Parser.json定义了Excel数据的解析规则,Converter.go负责数据格式转换,而Engine.js则是整个转换过程的核心驱动。
代码示例
1. Excel数据解析配置(config/Parser.json)
{
"excel_parser": {
"source_type": "stock_software_export",
"sheet_name": "daily_quotes",
"columns_mapping": {
"date": "A",
"open": "B",
"high": "C",
"low": "D",
"close": "E",
"volume": "F"
},
"data_range": "A2:F1000",
"special_handling": {
"null_values": ["N/A", "-", ""],
"date_format": "YYYY-MM-DD"
}
},
"verilog_output": {
"module_name": "stock_data_buffer",
"data_width": 32,
"address_width": 10,
"clock_domain": "posedge clk",
"output_registers": true
}
}
2. 数据验证器(actions/Validator.js)
class ExcelDataValidator {
constructor(config) {
this.rules = config.validation_rules;
}
validateStockData(dataRows) {
const errors = [];
const warnings = [];
dataRows.forEach((row, index) => {
// 检查必需字段
if (!row.date || !row.close) {
errors.push(`行 ${
index + 2}: 缺少必需字段`);
}
// 验证价格数据范围
if (row.high < row.low) {
errors.push(`行 ${
index + 2}: 最高价低于最低价`);
}
// 检查成交量是否为整数
if (!Number.isInteger(row.volume)) {
warnings.push(`行 ${
index + 2}: 成交量应为整数值`);
}
// 特别处理从股票软件导出excel的数据格式
if (row.close === 0) {
warnings.push(`行 ${
index + 2}: 收盘价为0,可能为停牌日`);
}
});
return {
isValid: errors.length === 0,
errors,
warnings,
totalRows: dataRows.length
};
}
// 导出验证报告
generateValidationReport(validationResult) {
return {
timestamp: new Date().toISOString(),
...validationResult,
summary: `验证完成: ${
validationResult.totalRows} 行数据,${
validationResult.errors.length} 个错误`
};
}
}
module.exports = ExcelDataValidator;
3. Verilog模块生成器(partials/Engine.js)
``javascript class VerilogModuleGenerator { constructor(templateConfig) { this.moduleTemplate =
module {module_name} (
input wire clk,
input wire rst_n,
input wire [{address_width-1}:0] addr,
output reg [{data_width-1}:0] data_out
);
// 数据存储器
reg [{data_width-1}:0] memory [0:{memory_depth-1}];
initial begin
// 初始化内存数据
{memory_initialization}
end
always @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
data_out <= {data_width{1'b0}};
end else begin
data_out <= memory[addr];
end
end
endmodule
`;
}
generateFromStockData(stockData, config) {
// 转换股票数据为固定点格式
const fixedPointData = this.convertToFixedPoint(stockData, config.data_width);
// 生成内存初始化代码
const memoryInit = this.generateMemoryInitialization(fixedPointData);
// 填充模板
const verilogCode = this.moduleTemplate
.replace(/{module_name}/g, config.module_name)
.replace(/{address_width}/g, config.address_width)
.replace(/{data_width}/g, config.data_width)
.replace(/{memory_depth}/g, fixedPointData.length)
.