131 Commits

Author SHA1 Message Date
de28471f87 rm:去除konva 2025-07-09 17:05:29 +08:00
3a292c0a98 refactor:持续解耦合 2025-07-09 16:32:17 +08:00
91b00a977c refactor: 给Canvas解耦合 2025-07-09 15:55:49 +08:00
c5ce246caf refactor: 重构projectview页面结构 2025-07-09 14:42:29 +08:00
c3bd61ed51 refactor: 重构canvas 2025-07-03 21:56:58 +08:00
14d8499f77 refactor: try to rewrite component manager 2025-07-02 21:16:18 +08:00
d18cf82813 feat: right mouse down to drag canvas 2025-07-02 20:27:35 +08:00
f1e2dbd9d8 feat: add components drawer 2025-07-01 21:08:58 +08:00
262c5e4003 fix: select not work 2025-07-01 20:12:39 +08:00
fbd13f8f2f fix: select rect wrong after zoom in / out 2025-06-30 21:48:41 +08:00
6cf7ef02ac feat: add resizer and add zoom in / out for canvas 2025-06-30 21:39:08 +08:00
8207c37e12 fix: box select failed 2025-06-14 10:58:00 +08:00
db71681bdf try to fix box select 2025-06-13 22:05:09 +08:00
2270022bbe feat: auto hide rect bounding when not hover 2025-06-13 21:05:44 +08:00
dcadb97a7f fix: correct calculate rect bounding 2025-06-13 20:08:46 +08:00
1538bb9d07 add boarder 2025-06-12 21:49:23 +08:00
f340c86a41 feat: add rect select but have some problems 2025-06-11 21:25:15 +08:00
b6fb7e05fa refactor: rewrite basic canvas using konva 2025-06-06 21:05:46 +08:00
e0db12e0eb update flake and add konva 2025-06-06 20:28:17 +08:00
dc64a65702 feat: add power control 2025-05-20 19:11:29 +08:00
46621fdb40 fix: jam when doc panel open 2025-05-20 18:34:44 +08:00
970a537391 Merge branch 'master' into csharp 2025-05-20 18:14:00 +08:00
3883cd8304 fix: matrix key not work 2025-05-20 18:13:52 +08:00
2aa2f1dc37 fix: matrix key not work 2025-05-20 18:13:52 +08:00
1bdcb672ab feat: frontend add virtual matrix key 2025-05-20 18:13:52 +08:00
7b1d1a5e87 fix: backend change matrix key api to post to fix set failed 2025-05-20 18:13:52 +08:00
5bb011e685 feag: backend add matrix key peripheral with its web api 2025-05-20 18:13:52 +08:00
e3826f0ff6 feat: add logger to udpclient 2025-05-20 18:13:52 +08:00
f8163be98b fix: matrix key not work 2025-05-20 18:11:04 +08:00
alivender
ea7c2d425a add: more exp 2025-05-20 18:04:25 +08:00
e4791b41a8 fix: matrix key not work 2025-05-20 17:23:00 +08:00
bea1c7e5ae feat: frontend add virtual matrix key 2025-05-20 17:09:57 +08:00
alivender
b6d8612e8c feat: optimize segment 2025-05-20 16:25:02 +08:00
b68d8eaf11 fix: backend change matrix key api to post to fix set failed 2025-05-20 11:21:12 +08:00
390ce8250d feag: backend add matrix key peripheral with its web api 2025-05-20 11:14:00 +08:00
alivender
09b8f676ba add: more exp markdown 2025-05-20 10:51:38 +08:00
alivender
cc83133a6c feat: code block dark mode 2025-05-20 10:15:42 +08:00
alivender
6d640e8049 add: home select exp 2025-05-20 09:35:29 +08:00
07eb606324 feat: add logger to udpclient 2025-05-20 09:34:26 +08:00
alivender
8eefed92a8 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-05-19 23:08:38 +08:00
alivender
8f2f90ef1d add: segment afterglow effect 2025-05-19 23:08:22 +08:00
487e7c114a chore: fix build failure
refactor: delete /public/equiments api
2025-05-19 22:29:28 +08:00
7f37514dfa fix: marked don't render images 2025-05-19 21:56:30 +08:00
0b0b4acb17 chore: remove all package 2025-05-19 21:42:30 +08:00
alivender
0bd3b42840 feat: add markdown 2025-05-19 21:40:55 +08:00
068576b60b Merge branch 'csharp' 2025-05-19 21:19:55 +08:00
d754a881d7 feat: frontend add set jtag frequency 2025-05-19 21:18:22 +08:00
a6ac728cf1 fix: boundary scan could not save 2025-05-19 18:47:15 +08:00
ba6ec73b84 fix: frontend upload bitstream failed 2025-05-19 15:56:23 +08:00
5042bf8ce5 feat: frontend add boundary scan 2025-05-19 13:30:06 +08:00
2a3ef1ea7d style: pretty frontend chip vue
feat: fronten add boundary scan to APIClient
2025-05-18 23:33:08 +08:00
4885447c2b feat: backend finish boundary scan web api 2025-05-18 23:17:56 +08:00
351a230107 feat: add bsdl parser 2025-05-18 21:52:44 +08:00
7aff4f3f02 fix: Component awlays reset 2025-05-17 17:32:16 +08:00
c7907b4253 fix: Componnent will reset when select of drag 2025-05-17 15:49:54 +08:00
3fb59af2dd fix: DDS and drag will reset conponent props 2025-05-17 15:09:59 +08:00
9b2ee8ad46 fix: DDS couldn't apply 2025-05-17 13:10:00 +08:00
alivender
7dd5e2189f add: markdown viewer 2025-05-16 20:35:43 +08:00
c39f688115 fix: mother board reactive problem 2025-05-16 16:38:57 +08:00
1eded97c76 fix: remote update failed and template not found 2025-05-15 20:23:48 +08:00
00ce79fa7b feat: add remote update function 2025-05-14 21:22:20 +08:00
alivender
48ae3b5975 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-05-14 19:45:10 +08:00
alivender
21197887cd add: AdminView and remote update view 2025-05-14 19:44:39 +08:00
f0fa32aeaa fix: jtag download failed 2025-05-14 19:40:37 +08:00
9657aacf83 feat: restore upload jtag bitstream 2025-05-13 21:52:58 +08:00
eea03f5bc8 feat: upload and download bitstream from the component of project view 2025-05-13 18:14:57 +08:00
eae67d04d4 fix: make boundary scan work 2025-05-13 13:57:57 +08:00
1102bba40d fix: jtag download failed 2025-05-13 13:19:26 +08:00
099d44663d Merge branch 'csharp' 2025-05-13 13:00:37 +08:00
74d40d25e2 feat: add swagger page 2025-05-12 21:56:41 +08:00
8699a568d1 feat: add jtag boundary scan 2025-05-12 21:56:17 +08:00
9eb3acb94c feat: setup spa proxy when develop backend server 2025-05-12 21:08:08 +08:00
257d63e63d feat: asp serve frontend static files 2025-05-12 20:05:26 +08:00
alivender
91838ff632 add: DDS virtual component 2025-05-11 14:41:38 +08:00
020674a277 feat: change test view to basic jtag upload and download page 2025-05-09 21:44:51 +08:00
alivender
6a786c1519 feat: Refactor code structure for improved readability and maintainability 2025-05-09 19:28:43 +08:00
10918a997c add submodule: python bsdl parser 2025-05-08 21:54:35 +08:00
alivender
d4b34bd6d4 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-05-07 15:43:04 +08:00
alivender
47cfe17d16 Refactor component configuration and diagram management
- Removed the component configuration from `componentConfig.ts` to streamline the codebase.
- Introduced a new `diagram.json` file to define the initial structure for diagrams.
- Created a `diagramManager.ts` to handle diagram data, including loading, saving, and validating diagram structures.
- Updated `ProjectView.vue` to integrate the new diagram management system, including handling component selection and property updates.
- Enhanced the component property management to support dynamic attributes and improved error handling.
- Added functions for managing connections between components within the diagram.
2025-05-07 15:42:35 +08:00
13a71368da Merge branch 'csharp' 2025-05-05 17:24:37 +08:00
51fd1145d8 feature: add more web api for remote update 2025-05-05 17:24:28 +08:00
f75b245abc fix: reboot very slow after remote update\ 2025-05-05 14:24:22 +08:00
55e363d505 fix: remote update failed 2025-05-04 21:56:19 +08:00
c6b819f24f fix: rewrite remote update 2025-05-04 16:38:40 +08:00
e6d177cf15 finish basic database 2025-05-02 12:16:00 +00:00
210f6aa61c add hot reset for remote update but no work 2025-04-29 21:13:38 +08:00
alivender
1c75aa621a feat: Enhance equipment components with pin functionality and constraint management
- Added pin support to MechanicalButton, enabling pin-click events and componentId handling.
- Updated Pin component to manage constraint states and colors dynamically.
- Integrated SMT_LED with pin functionality, allowing LED state to respond to constraints.
- Enhanced Wire component to reflect constraint colors and manage wire states based on pin connections.
- Introduced wireManager for managing wire states and constraints.
- Implemented a constraints store for managing and notifying constraint state changes across components.
- Updated component configuration to remove appearance options and clarify constraint descriptions.
- Improved ProjectView to handle optional chaining for props and ensure robust data handling.
- Initialized constraint communication in main application entry point.
2025-04-29 11:05:30 +08:00
3f77a1a426 add remote update 2025-04-27 21:53:02 +08:00
alivender
10db7c67bf feat: Pin移动连线也跟着移动 2025-04-27 14:08:05 +08:00
alivender
b3a5342d6b feat: enhance DiagramCanvas and Pin components with wire creation and tooltip functionality
- Added wire creation logic in DiagramCanvas.vue with mouse tracking and event handling.
- Implemented tooltip display for pins in Pin.vue with detailed information on hover.
- Updated ProjectView.vue to handle wire creation and deletion events.
- Refactored Wire.vue to support dynamic path rendering based on routing mode.
2025-04-26 21:53:33 +08:00
alivender
b6839af5d2 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-04-26 20:00:26 +08:00
alivender
bc4f44ecaa feat: remake most of forntend 2025-04-26 19:59:35 +08:00
f35a295af2 add remote update but not finished 2025-04-25 21:53:56 +08:00
42ddd0fcdb fix download bitstream and add json convert for jtag status reg 2025-04-25 17:14:34 +08:00
alivender
4e741f9ef8 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-04-25 16:12:47 +08:00
alivender
cfd8769e9b feat: add project view 2025-04-25 16:11:53 +08:00
2b5154062d Merge branch 'csharp' 2025-04-25 16:11:13 +08:00
c1ff893b58 add class jtag status reg 2025-04-25 16:10:51 +08:00
alivender
4465091db3 feat: remake machanicalbutton 2025-04-25 13:20:04 +08:00
b8bb4f6b5e add home view and reverse 4 bytes order to send 2025-04-24 21:42:32 +08:00
c76dabfdb7 add new jtag cmd : read status reg 2025-04-24 14:16:38 +08:00
4e752d4c9e maybe fix bug: download bitstream failed 2025-04-23 20:22:49 +08:00
5ea541ef4b add nswag for generate web api 2025-04-23 14:11:19 +08:00
7f99a5be24 Merge branch 'csharp' 2025-04-23 13:43:42 +08:00
0fb5a16b8e change throw to return and fix bug: when error always throw 2025-04-23 13:41:48 +08:00
alivender
6526203981 feat: add right click keyboard match 2025-04-23 11:50:51 +08:00
87c158ebfe remove bun and some typescript backend server package 2025-04-22 17:32:43 +08:00
cdf7131b16 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab 2025-04-22 17:26:03 +08:00
98a5dbe7f3 try to fix server bug: couldn't download bitstream 2025-04-22 17:24:46 +08:00
alivender
a6d68f1120 Merge branch 'dpp' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-04-22 14:21:51 +08:00
80947adc51 add web api for download bitstream 2025-04-22 14:21:37 +08:00
alivender
301b2a20f4 Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp 2025-04-22 14:20:51 +08:00
alivender
8b2ecae6e3 remove bun 2025-04-22 14:20:14 +08:00
442e40d87a add web api for download bitstream 2025-04-22 13:34:05 +08:00
70f96701f7 jtag add download bitstream 2025-04-21 21:54:09 +08:00
acd6a68507 use nswag to publish swagger 2025-04-17 16:26:12 +08:00
d25f9882fc fix bug: couldn't convert package 2025-04-17 14:25:37 +08:00
3b674f413a change udpData type from list to queue 2025-04-16 21:19:55 +08:00
84699708d5 try to fix bug 2025-04-15 21:38:06 +08:00
e8ec4c2a86 add test solution and try to fix get id code bug 2025-04-15 20:09:34 +08:00
5e2da17c28 try to fix receive problems 2025-04-14 21:50:51 +08:00
ae34cf6436 rewrite udp server handler, change router and protocol 2025-04-14 21:31:50 +08:00
5fa4860bfb try to fix bug, and add schema to swagger 2025-04-13 21:22:55 +08:00
c9660633f0 server finish nlog 2025-04-10 21:53:21 +08:00
143d6c634b add nlog for server 2025-04-09 19:42:29 +08:00
5c0f5b2127 add more view for test 2025-04-07 21:56:41 +08:00
93add0c315 add jtag get id code api 2025-04-07 21:56:30 +08:00
292c73e757 finish sidebar router push 2025-04-05 20:49:50 +08:00
20d4fa12d8 Server: finish jtag controller; Web: finish sibebar animation 2025-04-05 19:41:56 +08:00
342a5a2436 finish receive udp data handle function 2025-04-03 17:21:22 +08:00
2af0986d67 add some doc and jtag controller 2025-04-02 21:51:20 +08:00
180 changed files with 116000 additions and 1147 deletions

2
.gitignore vendored
View File

@@ -9,7 +9,9 @@ lerna-debug.log*
node_modules
.DS_Store
.vscode
dist
**/wwwroot
dist-ssr
coverage
*.local

60
.justfile Normal file
View File

@@ -0,0 +1,60 @@
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
isSelfContained := "false"
@_show-dir:
echo "Current Working Directory:"
pwd
echo
# 清空构建文件
clean:
rm -rf "server/bin"
rm -rf "server/obj"
rm -rf "server.test/bin"
rm -rf "server.test/obj"
rm -rf "dist"
rm -rf "wwwroot"
update:
npm install
dotnet restore ./server/server.csproj
git submodule update --init --remote --recursive
# 生成Restful API到网页客户端
gen-api:
npm run gen-api
gen-api-from-server:
npx nswag openapi2tsclient /input:http://localhost:5000/swagger/v1/swagger.json /output:src/APIClient.ts
# 构建服务器包含win与linux平台
[working-directory: "server"]
build-server self-contained=isSelfContained: _show-dir
dotnet publish --self-contained {{self-contained}} -t:PublishAllRids
npm run build
rsync -avz --delete ../wwwroot/ ./bin/Release/net9.0/linux-x64/publish/wwwroot/
rsync -avz --delete ../wwwroot/ ./bin/Release/net9.0/win-x64/publish/wwwroot/
run: run-server
run-server: (build-server "true")
./server/bin/Release/net9.0/linux-x64/publish/server
run-web:
npm run build
npm run preview
dev: dev-server
# 测试服务器
dev-server: _show-dir
dotnet run --watch --project ./server/server.csproj
# 运行网页客户端
dev-web:
npm run dev
# 运行测试用例测试服务器
[working-directory: "server.test"]
test-server: _show-dir
dotnet test --logger "console;verbosity=detailed"

585
bun.lock
View File

@@ -1,585 +0,0 @@
{
"lockfileVersion": 1,
"workspaces": {
"": {
"name": "fpga-weblab",
"dependencies": {
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"@types/lodash": "^4.17.16",
"lodash": "^4.17.21",
"log-symbols": "^7.0.0",
"pinia": "^3.0.1",
"tinypool": "^1.0.2",
"trpc-bun-adapter": "^1.2.2",
"ts-log": "^2.2.7",
"ts-results-es": "^5.0.1",
"vue": "^3.5.13",
"vue-router": "4",
"zod": "^3.24.2",
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.12",
"@tsconfig/node22": "^22.0.0",
"@types/bun": "^1.2.5",
"@types/node": "^22.13.4",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vue/tsconfig": "^0.7.0",
"autoprefixer": "^10.4.20",
"bun-plugin-tailwind": "^0.0.15",
"daisyui": "^5.0.0",
"npm-run-all2": "^7.0.2",
"postcss": "^8.5.3",
"tailwindcss": "^4.0.12",
"typescript": "~5.7.3",
"vite": "^6.1.0",
"vite-plugin-vue-devtools": "^7.7.2",
"vue-tsc": "^2.2.2",
},
},
},
"packages": {
"@alloc/quick-lru": ["@alloc/quick-lru@5.2.0", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
"@ampproject/remapping": ["@ampproject/remapping@2.3.0", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw=="],
"@antfu/utils": ["@antfu/utils@0.7.10", "", {}, "sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww=="],
"@babel/code-frame": ["@babel/code-frame@7.26.2", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" } }, "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ=="],
"@babel/compat-data": ["@babel/compat-data@7.26.8", "", {}, "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ=="],
"@babel/core": ["@babel/core@7.26.9", "", { "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.26.9", "@babel/helper-compilation-targets": "^7.26.5", "@babel/helper-module-transforms": "^7.26.0", "@babel/helpers": "^7.26.9", "@babel/parser": "^7.26.9", "@babel/template": "^7.26.9", "@babel/traverse": "^7.26.9", "@babel/types": "^7.26.9", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", "semver": "^6.3.1" } }, "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw=="],
"@babel/generator": ["@babel/generator@7.26.9", "", { "dependencies": { "@babel/parser": "^7.26.9", "@babel/types": "^7.26.9", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg=="],
"@babel/helper-annotate-as-pure": ["@babel/helper-annotate-as-pure@7.25.9", "", { "dependencies": { "@babel/types": "^7.25.9" } }, "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g=="],
"@babel/helper-compilation-targets": ["@babel/helper-compilation-targets@7.26.5", "", { "dependencies": { "@babel/compat-data": "^7.26.5", "@babel/helper-validator-option": "^7.25.9", "browserslist": "^4.24.0", "lru-cache": "^5.1.1", "semver": "^6.3.1" } }, "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA=="],
"@babel/helper-create-class-features-plugin": ["@babel/helper-create-class-features-plugin@7.26.9", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.25.9", "@babel/helper-member-expression-to-functions": "^7.25.9", "@babel/helper-optimise-call-expression": "^7.25.9", "@babel/helper-replace-supers": "^7.26.5", "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", "@babel/traverse": "^7.26.9", "semver": "^6.3.1" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-ubbUqCofvxPRurw5L8WTsCLSkQiVpov4Qx0WMA+jUN+nXBK8ADPlJO1grkFw5CWKC5+sZSOfuGMdX1aI1iT9Sg=="],
"@babel/helper-member-expression-to-functions": ["@babel/helper-member-expression-to-functions@7.25.9", "", { "dependencies": { "@babel/traverse": "^7.25.9", "@babel/types": "^7.25.9" } }, "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ=="],
"@babel/helper-module-imports": ["@babel/helper-module-imports@7.25.9", "", { "dependencies": { "@babel/traverse": "^7.25.9", "@babel/types": "^7.25.9" } }, "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw=="],
"@babel/helper-module-transforms": ["@babel/helper-module-transforms@7.26.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9", "@babel/traverse": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw=="],
"@babel/helper-optimise-call-expression": ["@babel/helper-optimise-call-expression@7.25.9", "", { "dependencies": { "@babel/types": "^7.25.9" } }, "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ=="],
"@babel/helper-plugin-utils": ["@babel/helper-plugin-utils@7.26.5", "", {}, "sha512-RS+jZcRdZdRFzMyr+wcsaqOmld1/EqTghfaBGQQd/WnRdzdlvSZ//kF7U8VQTxf1ynZ4cjUcYgjVGx13ewNPMg=="],
"@babel/helper-replace-supers": ["@babel/helper-replace-supers@7.26.5", "", { "dependencies": { "@babel/helper-member-expression-to-functions": "^7.25.9", "@babel/helper-optimise-call-expression": "^7.25.9", "@babel/traverse": "^7.26.5" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "sha512-bJ6iIVdYX1YooY2X7w1q6VITt+LnUILtNk7zT78ykuwStx8BauCzxvFqFaHjOpW1bVnSUM1PN1f0p5P21wHxvg=="],
"@babel/helper-skip-transparent-expression-wrappers": ["@babel/helper-skip-transparent-expression-wrappers@7.25.9", "", { "dependencies": { "@babel/traverse": "^7.25.9", "@babel/types": "^7.25.9" } }, "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA=="],
"@babel/helper-string-parser": ["@babel/helper-string-parser@7.25.9", "", {}, "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA=="],
"@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.25.9", "", {}, "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ=="],
"@babel/helper-validator-option": ["@babel/helper-validator-option@7.25.9", "", {}, "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw=="],
"@babel/helpers": ["@babel/helpers@7.26.9", "", { "dependencies": { "@babel/template": "^7.26.9", "@babel/types": "^7.26.9" } }, "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA=="],
"@babel/parser": ["@babel/parser@7.26.9", "", { "dependencies": { "@babel/types": "^7.26.9" }, "bin": "./bin/babel-parser.js" }, "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A=="],
"@babel/plugin-proposal-decorators": ["@babel/plugin-proposal-decorators@7.25.9", "", { "dependencies": { "@babel/helper-create-class-features-plugin": "^7.25.9", "@babel/helper-plugin-utils": "^7.25.9", "@babel/plugin-syntax-decorators": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-smkNLL/O1ezy9Nhy4CNosc4Va+1wo5w4gzSZeLe6y6dM4mmHfYOCPolXQPHQxonZCF+ZyebxN9vqOolkYrSn5g=="],
"@babel/plugin-syntax-decorators": ["@babel/plugin-syntax-decorators@7.25.9", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ryzI0McXUPJnRCvMo4lumIKZUzhYUO/ScI+Mz4YVaTLt04DHNSjEUjKVvbzQjZFLuod/cYEc07mJWhzl6v4DPg=="],
"@babel/plugin-syntax-import-attributes": ["@babel/plugin-syntax-import-attributes@7.26.0", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A=="],
"@babel/plugin-syntax-import-meta": ["@babel/plugin-syntax-import-meta@7.10.4", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g=="],
"@babel/plugin-syntax-jsx": ["@babel/plugin-syntax-jsx@7.25.9", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-ld6oezHQMZsZfp6pWtbjaNDF2tiiCYYDqQszHt5VV437lewP9aSi2Of99CK0D0XB21k7FLgnLcmQKyKzynfeAA=="],
"@babel/plugin-syntax-typescript": ["@babel/plugin-syntax-typescript@7.25.9", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-hjMgRy5hb8uJJjUcdWunWVcoi9bGpJp8p5Ol1229PoN6aytsLwNMgmdftO23wnCLMfVmTwZDWMPNq/D1SY60JQ=="],
"@babel/plugin-transform-typescript": ["@babel/plugin-transform-typescript@7.26.8", "", { "dependencies": { "@babel/helper-annotate-as-pure": "^7.25.9", "@babel/helper-create-class-features-plugin": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", "@babel/plugin-syntax-typescript": "^7.25.9" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-bME5J9AC8ChwA7aEPJ6zym3w7aObZULHhbNLU0bKUhKsAkylkzUdq+0kdymh9rzi8nlNFl2bmldFBCKNJBUpuw=="],
"@babel/template": ["@babel/template@7.26.9", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/parser": "^7.26.9", "@babel/types": "^7.26.9" } }, "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA=="],
"@babel/traverse": ["@babel/traverse@7.26.9", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.26.9", "@babel/parser": "^7.26.9", "@babel/template": "^7.26.9", "@babel/types": "^7.26.9", "debug": "^4.3.1", "globals": "^11.1.0" } }, "sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg=="],
"@babel/types": ["@babel/types@7.26.9", "", { "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" } }, "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw=="],
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.0", "", { "os": "aix", "cpu": "ppc64" }, "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ=="],
"@esbuild/android-arm": ["@esbuild/android-arm@0.25.0", "", { "os": "android", "cpu": "arm" }, "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g=="],
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.25.0", "", { "os": "android", "cpu": "arm64" }, "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g=="],
"@esbuild/android-x64": ["@esbuild/android-x64@0.25.0", "", { "os": "android", "cpu": "x64" }, "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg=="],
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.25.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw=="],
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.25.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg=="],
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.25.0", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w=="],
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.25.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A=="],
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.25.0", "", { "os": "linux", "cpu": "arm" }, "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg=="],
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.25.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg=="],
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.25.0", "", { "os": "linux", "cpu": "ia32" }, "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg=="],
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.25.0", "", { "os": "linux", "cpu": "none" }, "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw=="],
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.25.0", "", { "os": "linux", "cpu": "none" }, "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ=="],
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.25.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw=="],
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.25.0", "", { "os": "linux", "cpu": "none" }, "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA=="],
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.25.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA=="],
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.25.0", "", { "os": "linux", "cpu": "x64" }, "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw=="],
"@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.25.0", "", { "os": "none", "cpu": "arm64" }, "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw=="],
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.25.0", "", { "os": "none", "cpu": "x64" }, "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA=="],
"@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.25.0", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw=="],
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.25.0", "", { "os": "openbsd", "cpu": "x64" }, "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg=="],
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.25.0", "", { "os": "sunos", "cpu": "x64" }, "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg=="],
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.25.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw=="],
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.25.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA=="],
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.25.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ=="],
"@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="],
"@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
"@jridgewell/set-array": ["@jridgewell/set-array@1.2.1", "", {}, "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A=="],
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="],
"@polka/url": ["@polka/url@1.0.0-next.28", "", {}, "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw=="],
"@rollup/pluginutils": ["@rollup/pluginutils@5.1.4", "", { "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", "picomatch": "^4.0.2" }, "peerDependencies": { "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "optionalPeers": ["rollup"] }, "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ=="],
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.34.9", "", { "os": "android", "cpu": "arm" }, "sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA=="],
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.34.9", "", { "os": "android", "cpu": "arm64" }, "sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg=="],
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.34.9", "", { "os": "darwin", "cpu": "arm64" }, "sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ=="],
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.34.9", "", { "os": "darwin", "cpu": "x64" }, "sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q=="],
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.34.9", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw=="],
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.34.9", "", { "os": "freebsd", "cpu": "x64" }, "sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g=="],
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.34.9", "", { "os": "linux", "cpu": "arm" }, "sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg=="],
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.34.9", "", { "os": "linux", "cpu": "arm" }, "sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA=="],
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.34.9", "", { "os": "linux", "cpu": "arm64" }, "sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw=="],
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.34.9", "", { "os": "linux", "cpu": "arm64" }, "sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A=="],
"@rollup/rollup-linux-loongarch64-gnu": ["@rollup/rollup-linux-loongarch64-gnu@4.34.9", "", { "os": "linux", "cpu": "none" }, "sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg=="],
"@rollup/rollup-linux-powerpc64le-gnu": ["@rollup/rollup-linux-powerpc64le-gnu@4.34.9", "", { "os": "linux", "cpu": "ppc64" }, "sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA=="],
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.34.9", "", { "os": "linux", "cpu": "none" }, "sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg=="],
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.34.9", "", { "os": "linux", "cpu": "s390x" }, "sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ=="],
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.34.9", "", { "os": "linux", "cpu": "x64" }, "sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A=="],
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.34.9", "", { "os": "linux", "cpu": "x64" }, "sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA=="],
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.34.9", "", { "os": "win32", "cpu": "arm64" }, "sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q=="],
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.34.9", "", { "os": "win32", "cpu": "ia32" }, "sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w=="],
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.34.9", "", { "os": "win32", "cpu": "x64" }, "sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw=="],
"@sec-ant/readable-stream": ["@sec-ant/readable-stream@0.4.1", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="],
"@sindresorhus/merge-streams": ["@sindresorhus/merge-streams@4.0.0", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],
"@tailwindcss/node": ["@tailwindcss/node@4.0.12", "", { "dependencies": { "enhanced-resolve": "^5.18.1", "jiti": "^2.4.2", "tailwindcss": "4.0.12" } }, "sha512-a6J11K1Ztdln9OrGfoM75/hChYPcHYGNYimqciMrvKXRmmPaS8XZTHhdvb5a3glz4Kd4ZxE1MnuFE2c0fGGmtg=="],
"@tailwindcss/oxide": ["@tailwindcss/oxide@4.0.12", "", { "optionalDependencies": { "@tailwindcss/oxide-android-arm64": "4.0.12", "@tailwindcss/oxide-darwin-arm64": "4.0.12", "@tailwindcss/oxide-darwin-x64": "4.0.12", "@tailwindcss/oxide-freebsd-x64": "4.0.12", "@tailwindcss/oxide-linux-arm-gnueabihf": "4.0.12", "@tailwindcss/oxide-linux-arm64-gnu": "4.0.12", "@tailwindcss/oxide-linux-arm64-musl": "4.0.12", "@tailwindcss/oxide-linux-x64-gnu": "4.0.12", "@tailwindcss/oxide-linux-x64-musl": "4.0.12", "@tailwindcss/oxide-win32-arm64-msvc": "4.0.12", "@tailwindcss/oxide-win32-x64-msvc": "4.0.12" } }, "sha512-DWb+myvJB9xJwelwT9GHaMc1qJj6MDXRDR0CS+T8IdkejAtu8ctJAgV4r1drQJLPeS7mNwq2UHW2GWrudTf63A=="],
"@tailwindcss/oxide-android-arm64": ["@tailwindcss/oxide-android-arm64@4.0.12", "", { "os": "android", "cpu": "arm64" }, "sha512-dAXCaemu3mHLXcA5GwGlQynX8n7tTdvn5i1zAxRvZ5iC9fWLl5bGnjZnzrQqT7ttxCvRwdVf3IHUnMVdDBO/kQ=="],
"@tailwindcss/oxide-darwin-arm64": ["@tailwindcss/oxide-darwin-arm64@4.0.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-vPNI+TpJQ7sizselDXIJdYkx9Cu6JBdtmRWujw9pVIxW8uz3O2PjgGGzL/7A0sXI8XDjSyRChrUnEW9rQygmJQ=="],
"@tailwindcss/oxide-darwin-x64": ["@tailwindcss/oxide-darwin-x64@4.0.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-RL/9jM41Fdq4Efr35C5wgLx98BirnrfwuD+zgMFK6Ir68HeOSqBhW9jsEeC7Y/JcGyPd3MEoJVIU4fAb7YLg7A=="],
"@tailwindcss/oxide-freebsd-x64": ["@tailwindcss/oxide-freebsd-x64@4.0.12", "", { "os": "freebsd", "cpu": "x64" }, "sha512-7WzWiax+LguJcMEimY0Q4sBLlFXu1tYxVka3+G2M9KmU/3m84J3jAIV4KZWnockbHsbb2XgrEjtlJKVwHQCoRA=="],
"@tailwindcss/oxide-linux-arm-gnueabihf": ["@tailwindcss/oxide-linux-arm-gnueabihf@4.0.12", "", { "os": "linux", "cpu": "arm" }, "sha512-X9LRC7jjE1QlfIaBbXjY0PGeQP87lz5mEfLSVs2J1yRc9PSg1tEPS9NBqY4BU9v5toZgJgzKeaNltORyTs22TQ=="],
"@tailwindcss/oxide-linux-arm64-gnu": ["@tailwindcss/oxide-linux-arm64-gnu@4.0.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-i24IFNq2402zfDdoWKypXz0ZNS2G4NKaA82tgBlE2OhHIE+4mg2JDb5wVfyP6R+MCm5grgXvurcIcKWvo44QiQ=="],
"@tailwindcss/oxide-linux-arm64-musl": ["@tailwindcss/oxide-linux-arm64-musl@4.0.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-LmOdshJBfAGIBG0DdBWhI0n5LTMurnGGJCHcsm9F//ISfsHtCnnYIKgYQui5oOz1SUCkqsMGfkAzWyNKZqbGNw=="],
"@tailwindcss/oxide-linux-x64-gnu": ["@tailwindcss/oxide-linux-x64-gnu@4.0.12", "", { "os": "linux", "cpu": "x64" }, "sha512-OSK667qZRH30ep8RiHbZDQfqkXjnzKxdn0oRwWzgCO8CoTxV+MvIkd0BWdQbYtYuM1wrakARV/Hwp0eA/qzdbw=="],
"@tailwindcss/oxide-linux-x64-musl": ["@tailwindcss/oxide-linux-x64-musl@4.0.12", "", { "os": "linux", "cpu": "x64" }, "sha512-uylhWq6OWQ8krV8Jk+v0H/3AZKJW6xYMgNMyNnUbbYXWi7hIVdxRKNUB5UvrlC3RxtgsK5EAV2i1CWTRsNcAnA=="],
"@tailwindcss/oxide-win32-arm64-msvc": ["@tailwindcss/oxide-win32-arm64-msvc@4.0.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-XDLnhMoXZEEOir1LK43/gHHwK84V1GlV8+pAncUAIN2wloeD+nNciI9WRIY/BeFTqES22DhTIGoilSO39xDb2g=="],
"@tailwindcss/oxide-win32-x64-msvc": ["@tailwindcss/oxide-win32-x64-msvc@4.0.12", "", { "os": "win32", "cpu": "x64" }, "sha512-I/BbjCLpKDQucvtn6rFuYLst1nfFwSMYyPzkx/095RE+tuzk5+fwXuzQh7T3fIBTcbn82qH/sFka7yPGA50tLw=="],
"@tailwindcss/postcss": ["@tailwindcss/postcss@4.0.12", "", { "dependencies": { "@alloc/quick-lru": "^5.2.0", "@tailwindcss/node": "4.0.12", "@tailwindcss/oxide": "4.0.12", "lightningcss": "^1.29.1", "postcss": "^8.4.41", "tailwindcss": "4.0.12" } }, "sha512-r59Sdr8djCW4dL3kvc4aWU8PHdUAVM3O3te2nbYzXsWwKLlHPCuUoZAc9FafXb/YyNDZOMI7sTbKTKFmwOrMjw=="],
"@trpc/client": ["@trpc/client@10.45.2", "", { "peerDependencies": { "@trpc/server": "10.45.2" } }, "sha512-ykALM5kYWTLn1zYuUOZ2cPWlVfrXhc18HzBDyRhoPYN0jey4iQHEFSEowfnhg1RvYnrAVjNBgHNeSAXjrDbGwg=="],
"@trpc/server": ["@trpc/server@10.45.2", "", {}, "sha512-wOrSThNNE4HUnuhJG6PfDRp4L2009KDVxsd+2VYH8ro6o/7/jwYZ8Uu5j+VaW+mOmc8EHerHzGcdbGNQSAUPgg=="],
"@tsconfig/node22": ["@tsconfig/node22@22.0.0", "", {}, "sha512-twLQ77zevtxobBOD4ToAtVmuYrpeYUh3qh+TEp+08IWhpsrIflVHqQ1F1CiPxQGL7doCdBIOOCF+1Tm833faNg=="],
"@types/bun": ["@types/bun@1.2.5", "", { "dependencies": { "bun-types": "1.2.5" } }, "sha512-w2OZTzrZTVtbnJew1pdFmgV99H0/L+Pvw+z1P67HaR18MHOzYnTYOi6qzErhK8HyT+DB782ADVPPE92Xu2/Opg=="],
"@types/estree": ["@types/estree@1.0.6", "", {}, "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="],
"@types/lodash": ["@types/lodash@4.17.16", "", {}, "sha512-HX7Em5NYQAXKW+1T+FiuG27NGwzJfCX3s1GjOa7ujxZa52kjJLOr4FUxT+giF6Tgxv1e+/czV/iTtBw27WTU9g=="],
"@types/node": ["@types/node@22.13.9", "", { "dependencies": { "undici-types": "~6.20.0" } }, "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw=="],
"@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
"@vitejs/plugin-vue": ["@vitejs/plugin-vue@5.2.1", "", { "peerDependencies": { "vite": "^5.0.0 || ^6.0.0", "vue": "^3.2.25" } }, "sha512-cxh314tzaWwOLqVes2gnnCtvBDcM1UMdn+iFR+UjAn411dPT3tOmqrJjbMd7koZpMAmBM/GqeV4n9ge7JSiJJQ=="],
"@vitejs/plugin-vue-jsx": ["@vitejs/plugin-vue-jsx@4.1.1", "", { "dependencies": { "@babel/core": "^7.26.0", "@babel/plugin-transform-typescript": "^7.25.9", "@vue/babel-plugin-jsx": "^1.2.5" }, "peerDependencies": { "vite": "^5.0.0 || ^6.0.0", "vue": "^3.0.0" } }, "sha512-uMJqv/7u1zz/9NbWAD3XdjaY20tKTf17XVfQ9zq4wY1BjsB/PjpJPMe2xiG39QpP4ZdhYNhm4Hvo66uJrykNLA=="],
"@volar/language-core": ["@volar/language-core@2.4.12", "", { "dependencies": { "@volar/source-map": "2.4.12" } }, "sha512-RLrFdXEaQBWfSnYGVxvR2WrO6Bub0unkdHYIdC31HzIEqATIuuhRRzYu76iGPZ6OtA4Au1SnW0ZwIqPP217YhA=="],
"@volar/source-map": ["@volar/source-map@2.4.12", "", {}, "sha512-bUFIKvn2U0AWojOaqf63ER0N/iHIBYZPpNGogfLPQ68F5Eet6FnLlyho7BS0y2HJ1jFhSif7AcuTx1TqsCzRzw=="],
"@volar/typescript": ["@volar/typescript@2.4.12", "", { "dependencies": { "@volar/language-core": "2.4.12", "path-browserify": "^1.0.1", "vscode-uri": "^3.0.8" } }, "sha512-HJB73OTJDgPc80K30wxi3if4fSsZZAOScbj2fcicMuOPoOkcf9NNAINb33o+DzhBdF9xTKC1gnPmIRDous5S0g=="],
"@vue/babel-helper-vue-transform-on": ["@vue/babel-helper-vue-transform-on@1.3.0", "", {}, "sha512-vrNyYNQcz1gfc87uuN+Z+On9fFOBQTYRlTUEDovpeCmjuwH83lAm6YM0VBvTx6eRTHg3SU5jP2CD+kSXY30PGg=="],
"@vue/babel-plugin-jsx": ["@vue/babel-plugin-jsx@1.3.0", "", { "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/plugin-syntax-jsx": "^7.25.9", "@babel/template": "^7.26.9", "@babel/traverse": "^7.26.9", "@babel/types": "^7.26.9", "@vue/babel-helper-vue-transform-on": "1.3.0", "@vue/babel-plugin-resolve-type": "1.3.0", "@vue/shared": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" }, "optionalPeers": ["@babel/core"] }, "sha512-ODZSs93FCxLMOiMFAGJXe7QMJp1tk8hkMbk84OcHOTVwYU2cFwFu1z7jjrRv44wCCfPNkflqn6hnexVprb+G7A=="],
"@vue/babel-plugin-resolve-type": ["@vue/babel-plugin-resolve-type@1.3.0", "", { "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "@babel/parser": "^7.26.9", "@vue/compiler-sfc": "^3.5.13" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, "sha512-3SmusE11QKNKtnVfbsKegUEArpf1fXE85Dzi/Q6lvaz3MA3tmL8BXyq/vA7GJeZ183XeNpLIZHrHDdUh9V348A=="],
"@vue/compiler-core": ["@vue/compiler-core@3.5.13", "", { "dependencies": { "@babel/parser": "^7.25.3", "@vue/shared": "3.5.13", "entities": "^4.5.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.0" } }, "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q=="],
"@vue/compiler-dom": ["@vue/compiler-dom@3.5.13", "", { "dependencies": { "@vue/compiler-core": "3.5.13", "@vue/shared": "3.5.13" } }, "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA=="],
"@vue/compiler-sfc": ["@vue/compiler-sfc@3.5.13", "", { "dependencies": { "@babel/parser": "^7.25.3", "@vue/compiler-core": "3.5.13", "@vue/compiler-dom": "3.5.13", "@vue/compiler-ssr": "3.5.13", "@vue/shared": "3.5.13", "estree-walker": "^2.0.2", "magic-string": "^0.30.11", "postcss": "^8.4.48", "source-map-js": "^1.2.0" } }, "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ=="],
"@vue/compiler-ssr": ["@vue/compiler-ssr@3.5.13", "", { "dependencies": { "@vue/compiler-dom": "3.5.13", "@vue/shared": "3.5.13" } }, "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA=="],
"@vue/compiler-vue2": ["@vue/compiler-vue2@2.7.16", "", { "dependencies": { "de-indent": "^1.0.2", "he": "^1.2.0" } }, "sha512-qYC3Psj9S/mfu9uVi5WvNZIzq+xnXMhOwbTFKKDD7b1lhpnn71jXSFdTQ+WsIEk0ONCd7VV2IMm7ONl6tbQ86A=="],
"@vue/devtools-api": ["@vue/devtools-api@7.7.2", "", { "dependencies": { "@vue/devtools-kit": "^7.7.2" } }, "sha512-1syn558KhyN+chO5SjlZIwJ8bV/bQ1nOVTG66t2RbG66ZGekyiYNmRO7X9BJCXQqPsFHlnksqvPhce2qpzxFnA=="],
"@vue/devtools-core": ["@vue/devtools-core@7.7.2", "", { "dependencies": { "@vue/devtools-kit": "^7.7.2", "@vue/devtools-shared": "^7.7.2", "mitt": "^3.0.1", "nanoid": "^5.0.9", "pathe": "^2.0.2", "vite-hot-client": "^0.2.4" }, "peerDependencies": { "vue": "^3.0.0" } }, "sha512-lexREWj1lKi91Tblr38ntSsy6CvI8ba7u+jmwh2yruib/ltLUcsIzEjCnrkh1yYGGIKXbAuYV2tOG10fGDB9OQ=="],
"@vue/devtools-kit": ["@vue/devtools-kit@7.7.2", "", { "dependencies": { "@vue/devtools-shared": "^7.7.2", "birpc": "^0.2.19", "hookable": "^5.5.3", "mitt": "^3.0.1", "perfect-debounce": "^1.0.0", "speakingurl": "^14.0.1", "superjson": "^2.2.1" } }, "sha512-CY0I1JH3Z8PECbn6k3TqM1Bk9ASWxeMtTCvZr7vb+CHi+X/QwQm5F1/fPagraamKMAHVfuuCbdcnNg1A4CYVWQ=="],
"@vue/devtools-shared": ["@vue/devtools-shared@7.7.2", "", { "dependencies": { "rfdc": "^1.4.1" } }, "sha512-uBFxnp8gwW2vD6FrJB8JZLUzVb6PNRG0B0jBnHsOH8uKyva2qINY8PTF5Te4QlTbMDqU5K6qtJDr6cNsKWhbOA=="],
"@vue/language-core": ["@vue/language-core@2.2.8", "", { "dependencies": { "@volar/language-core": "~2.4.11", "@vue/compiler-dom": "^3.5.0", "@vue/compiler-vue2": "^2.7.16", "@vue/shared": "^3.5.0", "alien-signals": "^1.0.3", "minimatch": "^9.0.3", "muggle-string": "^0.4.1", "path-browserify": "^1.0.1" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-rrzB0wPGBvcwaSNRriVWdNAbHQWSf0NlGqgKHK5mEkXpefjUlVRP62u03KvwZpvKVjRnBIQ/Lwre+Mx9N6juUQ=="],
"@vue/reactivity": ["@vue/reactivity@3.5.13", "", { "dependencies": { "@vue/shared": "3.5.13" } }, "sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg=="],
"@vue/runtime-core": ["@vue/runtime-core@3.5.13", "", { "dependencies": { "@vue/reactivity": "3.5.13", "@vue/shared": "3.5.13" } }, "sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw=="],
"@vue/runtime-dom": ["@vue/runtime-dom@3.5.13", "", { "dependencies": { "@vue/reactivity": "3.5.13", "@vue/runtime-core": "3.5.13", "@vue/shared": "3.5.13", "csstype": "^3.1.3" } }, "sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog=="],
"@vue/server-renderer": ["@vue/server-renderer@3.5.13", "", { "dependencies": { "@vue/compiler-ssr": "3.5.13", "@vue/shared": "3.5.13" }, "peerDependencies": { "vue": "3.5.13" } }, "sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA=="],
"@vue/shared": ["@vue/shared@3.5.13", "", {}, "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ=="],
"@vue/tsconfig": ["@vue/tsconfig@0.7.0", "", { "peerDependencies": { "typescript": "5.x", "vue": "^3.4.0" }, "optionalPeers": ["typescript", "vue"] }, "sha512-ku2uNz5MaZ9IerPPUyOHzyjhXoX2kVJaVf7hL315DC17vS6IiZRmmCPfggNbU16QTvM80+uYYy3eYJB59WCtvg=="],
"alien-signals": ["alien-signals@1.0.4", "", {}, "sha512-DJqqQD3XcsaQcQ1s+iE2jDUZmmQpXwHiR6fCAim/w87luaW+vmLY8fMlrdkmRwzaFXhkxf3rqPCR59tKVv1MDw=="],
"ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="],
"autoprefixer": ["autoprefixer@10.4.20", "", { "dependencies": { "browserslist": "^4.23.3", "caniuse-lite": "^1.0.30001646", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.0.1", "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "^8.1.0" }, "bin": { "autoprefixer": "bin/autoprefixer" } }, "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g=="],
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"birpc": ["birpc@0.2.19", "", {}, "sha512-5WeXXAvTmitV1RqJFppT5QtUiz2p1mRSYU000Jkft5ZUCLJIk4uQriYNO50HknxKwM6jd8utNc66K1qGIwwWBQ=="],
"brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
"browserslist": ["browserslist@4.24.4", "", { "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", "node-releases": "^2.0.19", "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" } }, "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A=="],
"bun-plugin-tailwind": ["bun-plugin-tailwind@0.0.15", "", { "peerDependencies": { "typescript": "^5.0.0" } }, "sha512-qtAXMNGG4R0UGGI8zWrqm2B7BdXqx48vunJXBPzfDOHPA5WkRUZdTSbE7TFwO4jLhYqSE23YMWsM9NhE6ovobw=="],
"bun-types": ["bun-types@1.2.5", "", { "dependencies": { "@types/node": "*", "@types/ws": "~8.5.10" } }, "sha512-3oO6LVGGRRKI4kHINx5PIdIgnLRb7l/SprhzqXapmoYkFl5m4j6EvALvbDVuuBFaamB46Ap6HCUxIXNLCGy+tg=="],
"bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="],
"caniuse-lite": ["caniuse-lite@1.0.30001702", "", {}, "sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA=="],
"convert-source-map": ["convert-source-map@2.0.0", "", {}, "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg=="],
"copy-anything": ["copy-anything@3.0.5", "", { "dependencies": { "is-what": "^4.1.8" } }, "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
"daisyui": ["daisyui@5.0.0", "", {}, "sha512-U0K9Bac3Bi3zZGm6ojrw12F0vBHTpEgf46zv/BYxLe07hF0Xnx7emIQliwaRBgJuYhY0BhwQ6wSnq5cJXHA2yA=="],
"de-indent": ["de-indent@1.0.2", "", {}, "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg=="],
"debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="],
"default-browser": ["default-browser@5.2.1", "", { "dependencies": { "bundle-name": "^4.1.0", "default-browser-id": "^5.0.0" } }, "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg=="],
"default-browser-id": ["default-browser-id@5.0.0", "", {}, "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA=="],
"define-lazy-prop": ["define-lazy-prop@3.0.0", "", {}, "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="],
"detect-libc": ["detect-libc@2.0.3", "", {}, "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw=="],
"electron-to-chromium": ["electron-to-chromium@1.5.113", "", {}, "sha512-wjT2O4hX+wdWPJ76gWSkMhcHAV2PTMX+QetUCPYEdCIe+cxmgzzSSiGRCKW8nuh4mwKZlpv0xvoW7OF2X+wmHg=="],
"enhanced-resolve": ["enhanced-resolve@5.18.1", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" } }, "sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg=="],
"entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],
"error-stack-parser-es": ["error-stack-parser-es@0.1.5", "", {}, "sha512-xHku1X40RO+fO8yJ8Wh2f2rZWVjqyhb1zgq1yZ8aZRQkv6OOKhKWRUaht3eSCUbAOBaKIgM+ykwFLE+QUxgGeg=="],
"esbuild": ["esbuild@0.25.0", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.25.0", "@esbuild/android-arm": "0.25.0", "@esbuild/android-arm64": "0.25.0", "@esbuild/android-x64": "0.25.0", "@esbuild/darwin-arm64": "0.25.0", "@esbuild/darwin-x64": "0.25.0", "@esbuild/freebsd-arm64": "0.25.0", "@esbuild/freebsd-x64": "0.25.0", "@esbuild/linux-arm": "0.25.0", "@esbuild/linux-arm64": "0.25.0", "@esbuild/linux-ia32": "0.25.0", "@esbuild/linux-loong64": "0.25.0", "@esbuild/linux-mips64el": "0.25.0", "@esbuild/linux-ppc64": "0.25.0", "@esbuild/linux-riscv64": "0.25.0", "@esbuild/linux-s390x": "0.25.0", "@esbuild/linux-x64": "0.25.0", "@esbuild/netbsd-arm64": "0.25.0", "@esbuild/netbsd-x64": "0.25.0", "@esbuild/openbsd-arm64": "0.25.0", "@esbuild/openbsd-x64": "0.25.0", "@esbuild/sunos-x64": "0.25.0", "@esbuild/win32-arm64": "0.25.0", "@esbuild/win32-ia32": "0.25.0", "@esbuild/win32-x64": "0.25.0" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw=="],
"escalade": ["escalade@3.2.0", "", {}, "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA=="],
"estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="],
"execa": ["execa@9.5.2", "", { "dependencies": { "@sindresorhus/merge-streams": "^4.0.0", "cross-spawn": "^7.0.3", "figures": "^6.1.0", "get-stream": "^9.0.0", "human-signals": "^8.0.0", "is-plain-obj": "^4.1.0", "is-stream": "^4.0.1", "npm-run-path": "^6.0.0", "pretty-ms": "^9.0.0", "signal-exit": "^4.1.0", "strip-final-newline": "^4.0.0", "yoctocolors": "^2.0.0" } }, "sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q=="],
"figures": ["figures@6.1.0", "", { "dependencies": { "is-unicode-supported": "^2.0.0" } }, "sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg=="],
"fraction.js": ["fraction.js@4.3.7", "", {}, "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew=="],
"fs-extra": ["fs-extra@11.3.0", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew=="],
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
"gensync": ["gensync@1.0.0-beta.2", "", {}, "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg=="],
"get-stream": ["get-stream@9.0.1", "", { "dependencies": { "@sec-ant/readable-stream": "^0.4.1", "is-stream": "^4.0.1" } }, "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA=="],
"globals": ["globals@11.12.0", "", {}, "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA=="],
"graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
"he": ["he@1.2.0", "", { "bin": { "he": "bin/he" } }, "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="],
"hookable": ["hookable@5.5.3", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="],
"human-signals": ["human-signals@8.0.0", "", {}, "sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA=="],
"is-docker": ["is-docker@3.0.0", "", { "bin": { "is-docker": "cli.js" } }, "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ=="],
"is-inside-container": ["is-inside-container@1.0.0", "", { "dependencies": { "is-docker": "^3.0.0" }, "bin": { "is-inside-container": "cli.js" } }, "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA=="],
"is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="],
"is-stream": ["is-stream@4.0.1", "", {}, "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A=="],
"is-unicode-supported": ["is-unicode-supported@2.1.0", "", {}, "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ=="],
"is-what": ["is-what@4.1.16", "", {}, "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A=="],
"is-wsl": ["is-wsl@3.1.0", "", { "dependencies": { "is-inside-container": "^1.0.0" } }, "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw=="],
"isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="],
"jiti": ["jiti@2.4.2", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A=="],
"js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="],
"jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="],
"json-parse-even-better-errors": ["json-parse-even-better-errors@4.0.0", "", {}, "sha512-lR4MXjGNgkJc7tkQ97kb2nuEMnNCyU//XYVH0MKTGcXEiSudQ5MKGKen3C5QubYy0vmq+JGitUg92uuywGEwIA=="],
"json5": ["json5@2.2.3", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
"jsonfile": ["jsonfile@6.1.0", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ=="],
"kolorist": ["kolorist@1.8.0", "", {}, "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ=="],
"lightningcss": ["lightningcss@1.29.2", "", { "dependencies": { "detect-libc": "^2.0.3" }, "optionalDependencies": { "lightningcss-darwin-arm64": "1.29.2", "lightningcss-darwin-x64": "1.29.2", "lightningcss-freebsd-x64": "1.29.2", "lightningcss-linux-arm-gnueabihf": "1.29.2", "lightningcss-linux-arm64-gnu": "1.29.2", "lightningcss-linux-arm64-musl": "1.29.2", "lightningcss-linux-x64-gnu": "1.29.2", "lightningcss-linux-x64-musl": "1.29.2", "lightningcss-win32-arm64-msvc": "1.29.2", "lightningcss-win32-x64-msvc": "1.29.2" } }, "sha512-6b6gd/RUXKaw5keVdSEtqFVdzWnU5jMxTUjA2bVcMNPLwSQ08Sv/UodBVtETLCn7k4S1Ibxwh7k68IwLZPgKaA=="],
"lightningcss-darwin-arm64": ["lightningcss-darwin-arm64@1.29.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-cK/eMabSViKn/PG8U/a7aCorpeKLMlK0bQeNHmdb7qUnBkNPnL+oV5DjJUo0kqWsJUapZsM4jCfYItbqBDvlcA=="],
"lightningcss-darwin-x64": ["lightningcss-darwin-x64@1.29.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-j5qYxamyQw4kDXX5hnnCKMf3mLlHvG44f24Qyi2965/Ycz829MYqjrVg2H8BidybHBp9kom4D7DR5VqCKDXS0w=="],
"lightningcss-freebsd-x64": ["lightningcss-freebsd-x64@1.29.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-wDk7M2tM78Ii8ek9YjnY8MjV5f5JN2qNVO+/0BAGZRvXKtQrBC4/cn4ssQIpKIPP44YXw6gFdpUF+Ps+RGsCwg=="],
"lightningcss-linux-arm-gnueabihf": ["lightningcss-linux-arm-gnueabihf@1.29.2", "", { "os": "linux", "cpu": "arm" }, "sha512-IRUrOrAF2Z+KExdExe3Rz7NSTuuJ2HvCGlMKoquK5pjvo2JY4Rybr+NrKnq0U0hZnx5AnGsuFHjGnNT14w26sg=="],
"lightningcss-linux-arm64-gnu": ["lightningcss-linux-arm64-gnu@1.29.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-KKCpOlmhdjvUTX/mBuaKemp0oeDIBBLFiU5Fnqxh1/DZ4JPZi4evEH7TKoSBFOSOV3J7iEmmBaw/8dpiUvRKlQ=="],
"lightningcss-linux-arm64-musl": ["lightningcss-linux-arm64-musl@1.29.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-Q64eM1bPlOOUgxFmoPUefqzY1yV3ctFPE6d/Vt7WzLW4rKTv7MyYNky+FWxRpLkNASTnKQUaiMJ87zNODIrrKQ=="],
"lightningcss-linux-x64-gnu": ["lightningcss-linux-x64-gnu@1.29.2", "", { "os": "linux", "cpu": "x64" }, "sha512-0v6idDCPG6epLXtBH/RPkHvYx74CVziHo6TMYga8O2EiQApnUPZsbR9nFNrg2cgBzk1AYqEd95TlrsL7nYABQg=="],
"lightningcss-linux-x64-musl": ["lightningcss-linux-x64-musl@1.29.2", "", { "os": "linux", "cpu": "x64" }, "sha512-rMpz2yawkgGT8RULc5S4WiZopVMOFWjiItBT7aSfDX4NQav6M44rhn5hjtkKzB+wMTRlLLqxkeYEtQ3dd9696w=="],
"lightningcss-win32-arm64-msvc": ["lightningcss-win32-arm64-msvc@1.29.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-nL7zRW6evGQqYVu/bKGK+zShyz8OVzsCotFgc7judbt6wnB2KbiKKJwBE4SGoDBQ1O94RjW4asrCjQL4i8Fhbw=="],
"lightningcss-win32-x64-msvc": ["lightningcss-win32-x64-msvc@1.29.2", "", { "os": "win32", "cpu": "x64" }, "sha512-EdIUW3B2vLuHmv7urfzMI/h2fmlnOQBk1xlsDxkN1tCWKjNFjfLhGxYk8C8mzpSfr+A6jFFIi8fU6LbQGsRWjA=="],
"lodash": ["lodash@4.17.21", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
"log-symbols": ["log-symbols@7.0.0", "", { "dependencies": { "is-unicode-supported": "^2.0.0", "yoctocolors": "^2.1.1" } }, "sha512-zrc91EDk2M+2AXo/9BTvK91pqb7qrPg2nX/Hy+u8a5qQlbaOflCKO+6SqgZ+M+xUFxGdKTgwnGiL96b1W3ikRA=="],
"lru-cache": ["lru-cache@5.1.1", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"magic-string": ["magic-string@0.30.17", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="],
"memorystream": ["memorystream@0.3.1", "", {}, "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw=="],
"minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
"mitt": ["mitt@3.0.1", "", {}, "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw=="],
"mrmime": ["mrmime@2.0.1", "", {}, "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"muggle-string": ["muggle-string@0.4.1", "", {}, "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ=="],
"nanoid": ["nanoid@3.3.9", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg=="],
"node-releases": ["node-releases@2.0.19", "", {}, "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="],
"normalize-range": ["normalize-range@0.1.2", "", {}, "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA=="],
"npm-normalize-package-bin": ["npm-normalize-package-bin@4.0.0", "", {}, "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w=="],
"npm-run-all2": ["npm-run-all2@7.0.2", "", { "dependencies": { "ansi-styles": "^6.2.1", "cross-spawn": "^7.0.6", "memorystream": "^0.3.1", "minimatch": "^9.0.0", "pidtree": "^0.6.0", "read-package-json-fast": "^4.0.0", "shell-quote": "^1.7.3", "which": "^5.0.0" }, "bin": { "run-p": "bin/run-p/index.js", "run-s": "bin/run-s/index.js", "npm-run-all": "bin/npm-run-all/index.js", "npm-run-all2": "bin/npm-run-all/index.js" } }, "sha512-7tXR+r9hzRNOPNTvXegM+QzCuMjzUIIq66VDunL6j60O4RrExx32XUhlrS7UK4VcdGw5/Wxzb3kfNcFix9JKDA=="],
"npm-run-path": ["npm-run-path@6.0.0", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="],
"open": ["open@10.1.0", "", { "dependencies": { "default-browser": "^5.2.1", "define-lazy-prop": "^3.0.0", "is-inside-container": "^1.0.0", "is-wsl": "^3.1.0" } }, "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw=="],
"parse-ms": ["parse-ms@4.0.0", "", {}, "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw=="],
"path-browserify": ["path-browserify@1.0.1", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="],
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
"pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
"perfect-debounce": ["perfect-debounce@1.0.0", "", {}, "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA=="],
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
"picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
"pidtree": ["pidtree@0.6.0", "", { "bin": { "pidtree": "bin/pidtree.js" } }, "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g=="],
"pinia": ["pinia@3.0.1", "", { "dependencies": { "@vue/devtools-api": "^7.7.2" }, "peerDependencies": { "typescript": ">=4.4.4", "vue": "^2.7.0 || ^3.5.11" }, "optionalPeers": ["typescript"] }, "sha512-WXglsDzztOTH6IfcJ99ltYZin2mY8XZCXujkYWVIJlBjqsP6ST7zw+Aarh63E1cDVYeyUcPCxPHzJpEOmzB6Wg=="],
"postcss": ["postcss@8.5.3", "", { "dependencies": { "nanoid": "^3.3.8", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A=="],
"postcss-value-parser": ["postcss-value-parser@4.2.0", "", {}, "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ=="],
"pretty-ms": ["pretty-ms@9.2.0", "", { "dependencies": { "parse-ms": "^4.0.0" } }, "sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg=="],
"read-package-json-fast": ["read-package-json-fast@4.0.0", "", { "dependencies": { "json-parse-even-better-errors": "^4.0.0", "npm-normalize-package-bin": "^4.0.0" } }, "sha512-qpt8EwugBWDw2cgE2W+/3oxC+KTez2uSVR8JU9Q36TXPAGCaozfQUs59v4j4GFpWTaw0i6hAZSvOmu1J0uOEUg=="],
"rfdc": ["rfdc@1.4.1", "", {}, "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA=="],
"rollup": ["rollup@4.34.9", "", { "dependencies": { "@types/estree": "1.0.6" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.34.9", "@rollup/rollup-android-arm64": "4.34.9", "@rollup/rollup-darwin-arm64": "4.34.9", "@rollup/rollup-darwin-x64": "4.34.9", "@rollup/rollup-freebsd-arm64": "4.34.9", "@rollup/rollup-freebsd-x64": "4.34.9", "@rollup/rollup-linux-arm-gnueabihf": "4.34.9", "@rollup/rollup-linux-arm-musleabihf": "4.34.9", "@rollup/rollup-linux-arm64-gnu": "4.34.9", "@rollup/rollup-linux-arm64-musl": "4.34.9", "@rollup/rollup-linux-loongarch64-gnu": "4.34.9", "@rollup/rollup-linux-powerpc64le-gnu": "4.34.9", "@rollup/rollup-linux-riscv64-gnu": "4.34.9", "@rollup/rollup-linux-s390x-gnu": "4.34.9", "@rollup/rollup-linux-x64-gnu": "4.34.9", "@rollup/rollup-linux-x64-musl": "4.34.9", "@rollup/rollup-win32-arm64-msvc": "4.34.9", "@rollup/rollup-win32-ia32-msvc": "4.34.9", "@rollup/rollup-win32-x64-msvc": "4.34.9", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ=="],
"run-applescript": ["run-applescript@7.0.0", "", {}, "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A=="],
"semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
"shell-quote": ["shell-quote@1.8.2", "", {}, "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA=="],
"signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
"sirv": ["sirv@3.0.1", "", { "dependencies": { "@polka/url": "^1.0.0-next.24", "mrmime": "^2.0.0", "totalist": "^3.0.0" } }, "sha512-FoqMu0NCGBLCcAkS1qA+XJIQTR6/JHfQXl+uGteNCQ76T91DMUjPa9xfmeqMY3z80nLSg9yQmNjK0Px6RWsH/A=="],
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
"speakingurl": ["speakingurl@14.0.1", "", {}, "sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ=="],
"strip-final-newline": ["strip-final-newline@4.0.0", "", {}, "sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw=="],
"superjson": ["superjson@2.2.2", "", { "dependencies": { "copy-anything": "^3.0.2" } }, "sha512-5JRxVqC8I8NuOUjzBbvVJAKNM8qoVuH0O77h4WInc/qC2q5IreqKxYwgkga3PfA22OayK2ikceb/B26dztPl+Q=="],
"tailwindcss": ["tailwindcss@4.0.12", "", {}, "sha512-bT0hJo91FtncsAMSsMzUkoo/iEU0Xs5xgFgVC9XmdM9bw5MhZuQFjPNl6wxAE0SiQF/YTZJa+PndGWYSDtuxAg=="],
"tapable": ["tapable@2.2.1", "", {}, "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="],
"tinypool": ["tinypool@1.0.2", "", {}, "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA=="],
"totalist": ["totalist@3.0.1", "", {}, "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ=="],
"trpc-bun-adapter": ["trpc-bun-adapter@1.2.2", "", { "peerDependencies": { "@trpc/server": "^11.0.0-rc.566" } }, "sha512-TVhZEDXZvhIM2lfNTVCx9u5fu7/86b7RuhQSM0CUs4vlIan64Sfko5m0stbjqSHNgvLBsvXKtUD8FeQOQGLfpg=="],
"ts-log": ["ts-log@2.2.7", "", {}, "sha512-320x5Ggei84AxzlXp91QkIGSw5wgaLT6GeAH0KsqDmRZdVWW2OiSeVvElVoatk3f7nicwXlElXsoFkARiGE2yg=="],
"ts-results-es": ["ts-results-es@5.0.1", "", {}, "sha512-HjX/7HxQe2bXkbp8pHTjy4Ir9eHIDnDDsLDphhGqy6I9iZ/vD4QXWEIlrVRZsEX+kS2jIiiF/mnl0nKnPTiYFw=="],
"typescript": ["typescript@5.7.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw=="],
"undici-types": ["undici-types@6.20.0", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],
"unicorn-magic": ["unicorn-magic@0.3.0", "", {}, "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA=="],
"universalify": ["universalify@2.0.1", "", {}, "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw=="],
"update-browserslist-db": ["update-browserslist-db@1.1.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw=="],
"vite": ["vite@6.2.1", "", { "dependencies": { "esbuild": "^0.25.0", "postcss": "^8.5.3", "rollup": "^4.30.1" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.16.0", "tsx": "^4.8.1", "yaml": "^2.4.2" }, "optionalPeers": ["@types/node", "jiti", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser", "tsx", "yaml"], "bin": { "vite": "bin/vite.js" } }, "sha512-n2GnqDb6XPhlt9B8olZPrgMD/es/Nd1RdChF6CBD/fHW6pUyUTt2sQW2fPRX5GiD9XEa6+8A6A4f2vT6pSsE7Q=="],
"vite-hot-client": ["vite-hot-client@0.2.4", "", { "peerDependencies": { "vite": "^2.6.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0" } }, "sha512-a1nzURqO7DDmnXqabFOliz908FRmIppkBKsJthS8rbe8hBEXwEwe4C3Pp33Z1JoFCYfVL4kTOMLKk0ZZxREIeA=="],
"vite-plugin-inspect": ["vite-plugin-inspect@0.8.9", "", { "dependencies": { "@antfu/utils": "^0.7.10", "@rollup/pluginutils": "^5.1.3", "debug": "^4.3.7", "error-stack-parser-es": "^0.1.5", "fs-extra": "^11.2.0", "open": "^10.1.0", "perfect-debounce": "^1.0.0", "picocolors": "^1.1.1", "sirv": "^3.0.0" }, "peerDependencies": { "vite": "^3.1.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.1" } }, "sha512-22/8qn+LYonzibb1VeFZmISdVao5kC22jmEKm24vfFE8siEn47EpVcCLYMv6iKOYMJfjSvSJfueOwcFCkUnV3A=="],
"vite-plugin-vue-devtools": ["vite-plugin-vue-devtools@7.7.2", "", { "dependencies": { "@vue/devtools-core": "^7.7.2", "@vue/devtools-kit": "^7.7.2", "@vue/devtools-shared": "^7.7.2", "execa": "^9.5.1", "sirv": "^3.0.0", "vite-plugin-inspect": "0.8.9", "vite-plugin-vue-inspector": "^5.3.1" }, "peerDependencies": { "vite": "^3.1.0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0" } }, "sha512-5V0UijQWiSBj32blkyPEqIbzc6HO9c1bwnBhx+ay2dzU0FakH+qMdNUT8nF9BvDE+i6I1U8CqCuJiO20vKEdQw=="],
"vite-plugin-vue-inspector": ["vite-plugin-vue-inspector@5.3.1", "", { "dependencies": { "@babel/core": "^7.23.0", "@babel/plugin-proposal-decorators": "^7.23.0", "@babel/plugin-syntax-import-attributes": "^7.22.5", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-typescript": "^7.22.15", "@vue/babel-plugin-jsx": "^1.1.5", "@vue/compiler-dom": "^3.3.4", "kolorist": "^1.8.0", "magic-string": "^0.30.4" }, "peerDependencies": { "vite": "^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.0-0" } }, "sha512-cBk172kZKTdvGpJuzCCLg8lJ909wopwsu3Ve9FsL1XsnLBiRT9U3MePcqrgGHgCX2ZgkqZmAGR8taxw+TV6s7A=="],
"vscode-uri": ["vscode-uri@3.1.0", "", {}, "sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ=="],
"vue": ["vue@3.5.13", "", { "dependencies": { "@vue/compiler-dom": "3.5.13", "@vue/compiler-sfc": "3.5.13", "@vue/runtime-dom": "3.5.13", "@vue/server-renderer": "3.5.13", "@vue/shared": "3.5.13" }, "peerDependencies": { "typescript": "*" }, "optionalPeers": ["typescript"] }, "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ=="],
"vue-router": ["vue-router@4.5.0", "", { "dependencies": { "@vue/devtools-api": "^6.6.4" }, "peerDependencies": { "vue": "^3.2.0" } }, "sha512-HDuk+PuH5monfNuY+ct49mNmkCRK4xJAV9Ts4z9UFc4rzdDnxQLyCMGGc8pKhZhHTVzfanpNwB/lwqevcBwI4w=="],
"vue-tsc": ["vue-tsc@2.2.8", "", { "dependencies": { "@volar/typescript": "~2.4.11", "@vue/language-core": "2.2.8" }, "peerDependencies": { "typescript": ">=5.0.0" }, "bin": { "vue-tsc": "./bin/vue-tsc.js" } }, "sha512-jBYKBNFADTN+L+MdesNX/TB3XuDSyaWynKMDgR+yCSln0GQ9Tfb7JS2lr46s2LiFUT1WsmfWsSvIElyxzOPqcQ=="],
"which": ["which@5.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ=="],
"yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="],
"yoctocolors": ["yoctocolors@2.1.1", "", {}, "sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ=="],
"zod": ["zod@3.24.2", "", {}, "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ=="],
"@vue/devtools-core/nanoid": ["nanoid@5.1.3", "", { "bin": { "nanoid": "bin/nanoid.js" } }, "sha512-zAbEOEr7u2CbxwoMRlz/pNSpRP0FdAU4pRaYunCdEezWohXFs+a0Xw7RfkKaezMsmSM1vttcLthJtwRnVtOfHQ=="],
"cross-spawn/which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"npm-run-path/path-key": ["path-key@4.0.0", "", {}, "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ=="],
"vue-router/@vue/devtools-api": ["@vue/devtools-api@6.6.4", "", {}, "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g=="],
"cross-spawn/which/isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
}
}

View File

@@ -1,2 +0,0 @@
[serve.static]
plugins = ["bun-plugin-tailwind"]

56
components.d.ts vendored Normal file
View File

@@ -0,0 +1,56 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
// biome-ignore lint: disable
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
BaseBoard: typeof import('./src/components/equipments/BaseBoard.vue')['default']
Canvas: typeof import('./src/components/Canvas.vue')['default']
CollapsibleSection: typeof import('./src/components/CollapsibleSection.vue')['default']
ComponentSelector: typeof import('./src/components/LabCanvas/ComponentSelector.vue')['default']
DDR: typeof import('./src/components/equipments/DDR.vue')['default']
DDS: typeof import('./src/components/equipments/DDS.vue')['default']
DDSPropertyEditor: typeof import('./src/components/equipments/DDSPropertyEditor.vue')['default']
DiagramCanvas: typeof import('./src/components/LabCanvas/DiagramCanvas.vue')['default']
Dialog: typeof import('./src/components/Dialog.vue')['default']
ETH: typeof import('./src/components/equipments/ETH.vue')['default']
HDMI: typeof import('./src/components/equipments/HDMI.vue')['default']
LabCanvas: typeof import('./src/components/LabCanvasNew/LabCanvas.vue')['default']
LabCanvasNew: typeof import('./src/components/LabCanvas/LabCanvasNew.vue')['default']
LabComponentsDrawer: typeof import('./src/components/LabCanvasNew/LabComponentsDrawer.vue')['default']
LabComponentsDrawerNew: typeof import('./src/components/LabCanvas/LabComponentsDrawerNew.vue')['default']
LoginCard: typeof import('./src/components/LoginCard.vue')['default']
MarkdownRenderer: typeof import('./src/components/MarkdownRenderer.vue')['default']
MechanicalButton: typeof import('./src/components/equipments/MechanicalButton.vue')['default']
MotherBoard: typeof import('./src/components/equipments/MotherBoard.vue')['default']
MotherBoardCaps: typeof import('./src/components/equipments/MotherBoardCaps.vue')['default']
Navbar: typeof import('./src/components/Navbar.vue')['default']
PG2L100H_FBG676: typeof import('./src/components/equipments/PG2L100H_FBG676.vue')['default']
Pin: typeof import('./src/components/equipments/Pin.vue')['default']
PopButton: typeof import('./src/components/PopButton.vue')['default']
PropertyEditor: typeof import('./src/components/PropertyEditor.vue')['default']
PropertyPanel: typeof import('./src/components/PropertyPanel.vue')['default']
RekaSplitterGroup: typeof import('reka-ui')['SplitterGroup']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SD: typeof import('./src/components/equipments/SD.vue')['default']
SevenSegmentDisplay: typeof import('./src/components/equipments/SevenSegmentDisplay.vue')['default']
SFP: typeof import('./src/components/equipments/SFP.vue')['default']
Sidebar: typeof import('./src/components/Sidebar.vue')['default']
SMA: typeof import('./src/components/equipments/SMA.vue')['default']
SMT_LED: typeof import('./src/components/equipments/SMT_LED.vue')['default']
SplitterGroup: typeof import('reka-ui')['SplitterGroup']
SplitterPanel: typeof import('reka-ui')['SplitterPanel']
SplitterResizeHandle: typeof import('reka-ui')['SplitterResizeHandle']
Switch: typeof import('./src/components/equipments/Switch.vue')['default']
ThemeControlButton: typeof import('./src/components/ThemeControlButton.vue')['default']
ThemeControlToggle: typeof import('./src/components/ThemeControlToggle.vue')['default']
TutorialCarousel: typeof import('./src/components/TutorialCarousel.vue')['default']
UploadCard: typeof import('./src/components/UploadCard.vue')['default']
Wire: typeof import('./src/components/equipments/Wire.vue')['default']
}
}

10
flake.lock generated
View File

@@ -2,12 +2,12 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1741246872,
"narHash": "sha256-Q6pMP4a9ed636qilcYX8XUguvKl/0/LGXhHcRI91p0U=",
"rev": "10069ef4cf863633f57238f179a0297de84bd8d3",
"revCount": 763342,
"lastModified": 1748929857,
"narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=",
"rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4",
"revCount": 810143,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.763342%2Brev-10069ef4cf863633f57238f179a0297de84bd8d3/01956ed4-f66c-7a87-98e4-b7e58f4aa591/source.tar.gz"
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.810143%2Brev-c2a03962b8e24e669fb37b7df10e7c79531ff1a4/01973914-8b42-7168-9ee2-4d6ea6946695/source.tar.gz"
},
"original": {
"type": "tarball",

View File

@@ -7,7 +7,10 @@
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs {
inherit system;
config.permittedInsecurePackages = ["dotnet-sdk-6.0.428"];
};
});
in
{
@@ -15,10 +18,11 @@
default = pkgs.mkShell {
packages = with pkgs; [
# Frontend
bun
nodejs
sqlite
sqls
sql-studio
zlib
# Backend
(dotnetCorePackages.combinePackages [
dotnetCorePackages.sdk_9_0
@@ -26,6 +30,7 @@
dotnetCorePackages.sdk_8_0
])
nuget
# msbuild
omnisharp-roslyn
csharpier
@@ -33,7 +38,8 @@
typescript-language-server
];
shellHook = ''
export PATH=$PATH:$HOME/.bun/bin
export PATH=$PATH:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${pkgs.zlib}/lib
'';
};

4743
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,53 @@
{
"name": "fpga-weblab",
"version": "0.0.0",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./server/index.ts",
"scripts": {
"dev": "bunx --bun vite",
"dev": "vite --host",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "bunx --bun vite preview",
"build-only": "bunx --bun vite build",
"type-check": "bunx --bun vue-tsc --build",
"server": "bun run --watch ./server/index.ts"
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build",
"pregen-api": "cd server && dotnet run --property:Configuration=Release &",
"gen-api": "npx nswag openapi2tsclient /input:http://localhost:5000/swagger/v1/swagger.json /output:src/APIClient.ts",
"postgen-api": "pkill server"
},
"dependencies": {
"@trpc/client": "^10.45.2",
"@trpc/server": "^10.45.2",
"@svgdotjs/svg.js": "^3.2.4",
"@types/lodash": "^4.17.16",
"@vueuse/core": "^13.5.0",
"async-mutex": "^0.5.0",
"highlight.js": "^11.11.1",
"lodash": "^4.17.21",
"log-symbols": "^7.0.0",
"lucide-vue-next": "^0.525.0",
"marked": "^12.0.0",
"mathjs": "^14.4.0",
"pinia": "^3.0.1",
"tinypool": "^1.0.2",
"trpc-bun-adapter": "^1.2.2",
"reka-ui": "^2.3.1",
"ts-log": "^2.2.7",
"ts-results-es": "^5.0.1",
"vue": "^3.5.13",
"vue-router": "4",
"yocto-queue": "^1.2.1",
"zod": "^3.24.2"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.12",
"@tsconfig/node22": "^22.0.0",
"@types/bun": "^1.2.5",
"@types/node": "^22.13.4",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vue/tsconfig": "^0.7.0",
"autoprefixer": "^10.4.20",
"bun-plugin-tailwind": "^0.0.15",
"daisyui": "^5.0.0",
"npm-run-all2": "^7.0.2",
"nswag": "^14.3.0",
"postcss": "^8.5.3",
"tailwindcss": "^4.0.12",
"typescript": "~5.7.3",
"unplugin-vue-components": "^28.8.0",
"vite": "^6.1.0",
"vite-plugin-vue-devtools": "^7.7.2",
"vue-tsc": "^2.2.2"

View File

@@ -0,0 +1,314 @@
{
"version": 1,
"author": "template",
"editor": "system",
"parts": [
{
"id": "board",
"type": "BaseBoard",
"x": 0,
"y": 0,
"attrs": {
"size": 1.2,
"width": 400,
"height": 400,
"roundCorner": 20
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": false,
"isOn": true,
"index": 0
},
{
"id": "key_0_0",
"type": "MechanicalButton",
"x": 50,
"y": 50,
"attrs": {
"size": 0.5,
"bindKey": "1",
"bindMatrixKey": "0",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 0
},
{
"id": "key_0_1",
"type": "MechanicalButton",
"x": 150,
"y": 50,
"attrs": {
"size": 0.5,
"bindKey": "2",
"bindMatrixKey": "1",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 1
},
{
"id": "key_0_2",
"type": "MechanicalButton",
"x": 250,
"y": 50,
"attrs": {
"size": 0.5,
"bindKey": "3",
"bindMatrixKey": "2",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 2
},
{
"id": "key_0_3",
"type": "MechanicalButton",
"x": 350,
"y": 50,
"attrs": {
"size": 0.5,
"bindKey": "A",
"bindMatrixKey": "3",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 3
},
{
"id": "key_1_0",
"type": "MechanicalButton",
"x": 50,
"y": 150,
"attrs": {
"size": 0.5,
"bindKey": "4",
"bindMatrixKey": "4",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 4
},
{
"id": "key_1_1",
"type": "MechanicalButton",
"x": 150,
"y": 150,
"attrs": {
"size": 0.5,
"bindKey": "5",
"bindMatrixKey": "5",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 5
},
{
"id": "key_1_2",
"type": "MechanicalButton",
"x": 250,
"y": 150,
"attrs": {
"size": 0.5,
"bindKey": "6",
"bindMatrixKey": "6",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 6
},
{
"id": "key_1_3",
"type": "MechanicalButton",
"x": 350,
"y": 150,
"attrs": {
"size": 0.5,
"bindKey": "B",
"bindMatrixKey": "7",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 7
},
{
"id": "key_2_0",
"type": "MechanicalButton",
"x": 50,
"y": 250,
"attrs": {
"size": 0.5,
"bindKey": "7",
"bindMatrixKey": "8",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 8
},
{
"id": "key_2_1",
"type": "MechanicalButton",
"x": 150,
"y": 250,
"attrs": {
"size": 0.5,
"bindKey": "8",
"bindMatrixKey": "9",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 9
},
{
"id": "key_2_2",
"type": "MechanicalButton",
"x": 250,
"y": 250,
"attrs": {
"size": 0.5,
"bindKey": "9",
"bindMatrixKey": "10",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 10
},
{
"id": "key_2_3",
"type": "MechanicalButton",
"x": 350,
"y": 250,
"attrs": {
"size": 0.5,
"bindKey": "C",
"bindMatrixKey": "11",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 11
},
{
"id": "key_3_0",
"type": "MechanicalButton",
"x": 50,
"y": 350,
"attrs": {
"size": 0.5,
"bindKey": "*",
"bindMatrixKey": "12",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 12
},
{
"id": "key_3_1",
"type": "MechanicalButton",
"x": 150,
"y": 350,
"attrs": {
"size": 0.5,
"bindKey": "0",
"bindMatrixKey": "13",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 13
},
{
"id": "key_3_2",
"type": "MechanicalButton",
"x": 250,
"y": 350,
"attrs": {
"size": 0.5,
"bindKey": "#",
"bindMatrixKey": "14",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 14
},
{
"id": "key_3_3",
"type": "MechanicalButton",
"x": 350,
"y": 350,
"attrs": {
"size": 0.5,
"bindKey": "D",
"bindMatrixKey": "15",
"pins": []
},
"rotate": 0,
"group": "MatrixKeypad",
"positionlock": false,
"hidepins": true,
"isOn": false,
"index": 15
}
],
"connections": []
}

File diff suppressed because it is too large Load Diff

BIN
public/doc/01/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

175
public/doc/01/doc.md Normal file
View File

@@ -0,0 +1,175 @@
# 基础-1-流水灯
## 1.1 章节导读
流水灯实验作为基础实验的第一个实验是非常合适的本章我们利用试验箱中的LED进行点亮LED并实现流水灯的功能。
## 1.2 理论学习
相信大家之前肯定接触过单片机等设备而学习这些设备的第一个实验例程往往都是点亮一个LED。本次实验在点亮LED的基础上另LED灯依次闪亮循环不止实现“流水”的功能。其原理是依次控制连接到LED的IO口的电平高低让LED的闪亮间隔为0.5s,以实现流水灯的效果。
## 1.3 实战演练
### 1.3.1实验目标
依次点亮实验板中的8个LED灯两灯点亮间隔为0.5s每次点亮持续0.5s,实现流水灯效果。
### 1.3.2硬件资源
实验板上有0~31共32个LED灯的资源每4个LED灯为一组分别是绿黄四种颜色本次实验使用8个LED进行验证。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图1.LED扩展板 <!--标题-->
</center>
</div>
通过原理图可以得知本试验箱的LED灯为高电平时点亮。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/2.png"
alt="无法显示图片时显示的文字"
style="zoom:40%"/>
<br> <!--换行-->
图2.LED扩展板原理图 <!--标题-->
</center>
</div>
### 1.3.3程序设计
流水灯的设计与分频器计数器的逻辑相似只是多了LED灯的点亮部分。为了实现计数器肯定需要时钟信号sysclk也需要一个复位信号rstn同时为了驱动LED需要8个IO口。所以模块的端口如下表所示
| 端口名称 | 端口位宽 | 端口类型 |功能描述
|:----------:|:----:|:----:|:--------------------:|
| sysclk | 1Bit | Input | 输入时钟频率27M |
| rstn | 1Bit | Input | 复位信号,低电平有效 |
| led | 8Bit | Output | LED控制信号 |
为了使灯点亮0.5s我们应该设计一个计数器或者是分频器先将板载27M高频时钟降速。在27M时钟下计数0.5s需要计数器计数13_500_000个数也就是计数器从0开始计数到13_499_999。所以我们定义一个寄存器cnt每一次时钟上升沿cnt就加1当计数到13_499_999时led的状态改变同时cnt归零重新开始计数。
为了实现8个led流水的效果我们将0定义为led灭1表示亮初始状态led = 8b0000_0001当经过0.5s后也就是cnt等于13_499_999的时候第一个led灭第二个led亮起也就是led = 8b0000_0010。同理再过0.5sled = 8b0000_0100再过0.5sled = 8b0000_1000以此类推。
根据上面的规律我们很容易发现led的流水是靠1的移位来实现的也就是最基本的左移(<<)和右移(>>)运算符去实现。在这里我们需要向左移位并且每次只需要移动1位。模块的参考代码waterled_top.v如下所示
```verilog
module waterled_top(
input sysclk, //27MHz system clock
input rstn, //active low reset
output [7:0] led
);
parameter CNT_MAX = 32'd13_499_999;
reg [7:0] led_reg;
reg [31:0] cnt;
//cnt 当cnt == CNT_MAX时变为0计数0.5秒
always @(posedge sysclk) begin
if (!rstn)
cnt <= 0;
else if (cnt < CNT_MAX)
cnt <= cnt + 1;
else
cnt <= 0;
end
//led_reg 当cnt == CNT_MAX时左移一位。
always @(posedge sysclk) begin
if (!rstn)
led_reg <= 8'b0000_0001;
else if (led_reg == 8'b1000_0000 && cnt == CNT_MAX)//led7亮0.5s后重回led0
led_reg <= 8'b0000_0001;
else if (cnt == CNT_MAX) //0.5s后左移
led_reg <= led_reg << 1;
else
led_reg <= led_reg;
end
//led
assign led = led_reg;
endmodule
```
### 1.3.4仿真验证
为上述模块编写仿真模块参考代码waterled_top_tb.v如下
```verilog
`timescale 1ns/1ns
module waterled_top_tb;
reg sysclk;
reg rstn;
wire [7:0] led;
// 实例化待测试模块
waterled_top #(
.CNT_MAX(32'd100)//为了加快仿真速度将模块内部CNT_MAX由13_499_999变为1000
)uut (
.sysclk(sysclk),
.rstn(rstn),
.led(led)
);
// 产生系统时钟:周期约为 27Mhz
initial begin
sysclk = 0;
forever #(500/27) sysclk = ~sysclk;
end
// 初始化和复位过程
initial begin
// 初始化
rstn = 0;
#100; // 保持复位100ns
rstn = 1; // 释放复位
end
endmodule
```
为了加速仿真我们在仿真文件中另CNT_MAX的值为100。同时为了便于仿真可以直接点击sim文件夹下hebav文件夹中的do.bat文件即可利用ModuleSim对模块进行仿真仿真波形如下
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/3.png"
alt="无法显示图片时显示的文字"
style="zoom:70%"/>
<br> <!--换行-->
图3.流水灯仿真波形(一) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/4.png"
alt="无法显示图片时显示的文字"
style="zoom:70%"/>
<br> <!--换行-->
图4.流水灯仿真波形(二) <!--标题-->
</center>
</div>
从图3我们可以看到端口信号led的值经过一定时间之后就进行了左移并且在图4中我们也可以发现当cnt的值等于CNT_MAX的时候led进行左移与我们设计的目标相符合可以进行下一步上板验证了。
### 1.3.5上板验证
仿真已经通过,可以进行上板验证,上板前要先进行管脚约束。端口与对应管脚如下表所示:
| 端口名称 |信号类型| 对应管脚|功能
|:----:|:----:|:----:|:----:|
| sysclk | Input | | 时钟 |
| rstn | Input | | 复位 |
| led[0] | Output | | LED |
| led[1] | Output | | LED |
| led[2] | Output | | LED |
| led[3] | Output | | LED |
| led[4] | Output | | LED |
| led[5] | Output | | LED |
| led[6] | Output | | LED |
| led[7] | Output | | LED |
管脚分配可以直接编写.fdc文件也可以使用PDS内置的工具进行分配。
完成管脚分配之后就可以生成sbit文件将文件提交到网站后点击烧录即可将sbit下载到实验板中在摄像头页面即可观察到流水灯的现象。
## 1.4 章末总结
本次实验主要学习使用左移(<<)和右移(>>)运算符实现移位,但实际应用中也可以使用位拼接({})进行更加复杂的移位操作,各位同学可以尝试学习。

BIN
public/doc/01/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
public/doc/01/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
public/doc/01/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

BIN
public/doc/01/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 KiB

BIN
public/doc/02/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

258
public/doc/02/doc.md Normal file
View File

@@ -0,0 +1,258 @@
# 基础-2-按键检测与消抖
## 2.1 章节导读
在数字电路中,按键是最常用的人机交互输入方式。然而,机械式按键在按下或释放过程中会产生抖动信号,直接读取会引起误触发。本章我们将实现一个可靠的按键检测模块,完成信号的消抖和下降沿检测,以便为更复杂的模块如状态机切换、模式转换等提供稳定的触发信号。
## 2.2 理论学习
由于机械结构的限制按键在触发的一瞬间其接触点会发生数次抖动导致输出信号在0和1之间反复跳变。这种现象称为“抖动”。为避免系统错误响应需要对按键信号进行“消抖”处理。
常见的软件消抖方法包括定时器延时,而在软件中通常使用计数器。在本实验中,采用对输入信号进行采样判断,当其状态发生变化时开始计数,若持续稳定一定时长后,才认为按键真正改变。
在此基础上,若需检测按键的“按下事件”,则还需进一步提取其上升沿(或下降沿)作为一个单周期的“有效触发”信号。
## 2.3 实战演练
### 2.3.1 实验目标
实现一个具有消抖功能的按键检测模块,并进一步提取其下降沿触发信号,输出一个单时钟周期宽度的 `btn_flag` 信号用于后级逻辑判断。同时为了使实验现象更加明显设置8位的IO输出连接led当检测到 `btn_flag` 信号后8位信号`led`会自加1。
### 2.3.2 硬件资源
本实验使用试验箱上普通按键输入资源,输入信号经过电平转换后进入 FPGA 芯片,输出信号可连接状态指示灯以观察效果。
根据原理图可知实验板的按键按下是低电平,不按为高电平。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图1.实验板的按键资源 <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/2.png"
alt="实验板按键原理图"
style="zoom:60%"/>
<br> <!--换行-->
图2.实验板按键原理图 <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/xx.png"
alt="数字孪生"
style="zoom:60%"/>
<br> <!--换行-->
图3.远程实验界面按键 <!--标题-->
</center>
</div>
### 2.3.3 程序设计
为了实现稳定的按键检测逻辑,设计流程如下:
1. 对输入 `btn` 进行采样,形成 `btn_temp`
2. 若检测到 `btn_temp` 与当前 `btn` 状态不一致,则开始计数;
3. 若计数器 `cnt` 达到设定阈值如255则认为按键状态稳定更新 `btn_ggle`
4. 实验板的按键按下是低电平,不按为高电平。所以对 `btn_ggle` 打两拍形成 `btn_flag_d0``btn_flag_d1`,再判断其下降沿,输出一个时钟周期的`btn_flag`
5. 检测到信号`btn_flag`后,信号`led <= led + 1`
该模块的参考代码如下(`btn_ggle.v`
```verilog
module btn_ggle(
input wire clk,
input wire rstn,
input wire btn,
output wire btn_flag,
output reg [7:0] led
);
reg btn_ggle;
reg btn_flag_d0,btn_flag_d1;
reg [7:0] cnt;
reg btn_temp;
//检测按键状态
always @(posedge clk) btn_temp <= btn;
//按键状态改变时开始计数
always @(posedge clk) begin
if(~rstn) cnt <= 0;
else if(btn_temp != btn) cnt <= 1;
else if(cnt != 0) cnt <= cnt + 1;
else cnt <= 0;
end
//计数到255时认为按键值稳定
always @(posedge clk) begin
if(~rstn) btn_ggle <= btn;
else if(cnt == 8'hFF) btn_ggle <= btn_temp;
else btn_ggle <= btn_ggle;
end
//对btn_ggle信号延迟打拍
always @(posedge clk) begin
if(~rstn) begin
btn_flag_d0 <= 0;
btn_flag_d1 <= 0;
end
else begin
btn_flag_d0 <= btn_ggle;
btn_flag_d1 <= btn_flag_d0;
end
end
//btn_flag检测btn_ggle的下降沿
assign btn_flag = ~btn_flag_d0 && btn_flag_d1;
//检测到按键按下的标志位btn_flagled会加1
always @(posedge clk) begin
if(~rstn) led <= 0;
else if(btn_flag) led <= led + 1;
else led <= led;
end
endmodule
```
### 2.3.4 仿真验证
为验证功能的正确性,设计测试平台(`btn_ggle_tb.v`),代码如下:
```verilog
`timescale 1ns/1ns
module btn_ggle_tb;
reg clk;
reg rstn;
reg btn;
wire btn_flag;
wire [7:0] led;
btn_ggle btn_ggle_inst (
.clk(clk),
.rstn(rstn),
.btn(btn),
.btn_flag(btn_flag),
.led(led)
);
// 27MHz 时钟周期约为 37.037ns取37ns近似
always #(500/27) clk = ~clk; // 半周期18.5ns ≈ 27MHz
initial begin
// 初始化
clk = 0;
rstn = 0;
btn = 1; // 按键默认未按下,高电平有效
// 释放复位
#200;
rstn = 1;
// 模拟带抖动的按下过程
#1000 btn = 0;
#100 btn = 1; // 抖动
#100 btn = 0;
#100 btn = 1;
#100 btn = 0;
// 稳定按下
#100000 btn = 0;
// 模拟抖动松开过程
#300000 btn = 1;
#100 btn = 0;
#100 btn = 1;
#100 btn = 0;
#100 btn = 1;
// 稳定松开
#100000 btn = 1;
// 第二次按下
#300000 btn = 0;
#100000 btn = 0;
#300000 $finish;
end
endmodule
```
利用ModuleSim进行仿真部分仿真波形如下图所示
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/3.png"
alt="仿真波形(一)"
style="zoom:60%"/>
<br> <!--换行-->
图4.仿真波形(一) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/4.png"
alt="仿真波形(二)"
style="zoom:60%"/>
<br> <!--换行-->
图5.仿真波形(二) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/5.png"
alt="仿真波形(三)"
style="zoom:60%"/>
<br> <!--换行-->
图6.仿真波形(三) <!--标题-->
</center>
</div>
从仿真波形二和三中我们可以看到当我们模拟按键按下1 ----> 0当按键抖动`btn`在0和1之间来回跳转`cnt`的值会变回1重新开始计数直到按键稳定按下`btn`的值稳定不变为0`cnt`稳定增加,当`cnt`的值增加到`8hFF`时,认为按键按下,`btn_ggle`存储此时的按键状态,同时`btn_flag`检测到下降沿,拉高一个时钟周期。`led`信号也加一。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/6.png"
alt="仿真波形(四)"
style="zoom:60%"/>
<br> <!--换行-->
图7.仿真波形(四) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/7.png"
alt="仿真波形(五)"
style="zoom:60%"/>
<br> <!--换行-->
图8.仿真波形(五) <!--标题-->
</center>
</div>
从波形三和四中我们可以看到当模拟按键抬起时0 ----> 1按键的抖动也会使`cnt`重新计数,直到稳定,`cnt`计数到`8hFF`时,更新`btn_ggle`,由于按键是抬起,`btn_flag`不变,`led`不变。
### 2.3.5 上板验证
完成仿真后,可进行上板验证。端口连接如下表所示:
| 端口名称 | 类型 | 管脚 |说明 |
| -------- | ------ | ------ | ---------- |
| clk | Input | | 27MHz 时钟 |
| rstn | Input | | 低电平复位 |
| btn | Input | | 外部按钮 |
| btn_flag | Output | | 上升沿标志 |
| led[0] | Output | | 驱动led |
| led[1] | Output | | 驱动led |
| led[2] | Output | | 驱动led |
| led[3] | Output | | 驱动led |
| led[4] | Output | | 驱动led |
| led[5] | Output | | 驱动led |
| led[6] | Output | | 驱动led |
| led[7] | Output | | 驱动led |
`.sbit`文件上传至平台并下载到实验板多次按下按键观察led灯跳转如果按下1次按键led只跳转一次那么说明达成实验目标。
## 2.4 章末总结
本实验通过一个典型的按键检测例子,介绍了数字系统中常用的消抖和边沿检测方法,掌握了如何利用计数器和触发器组合进行抖动抑制与事件捕捉。在更复杂的设计中,这类基础模块可作为控制逻辑的可靠触发信号源,具有广泛应用价值。

BIN
public/doc/02/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 KiB

BIN
public/doc/02/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

BIN
public/doc/02/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
public/doc/02/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
public/doc/02/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
public/doc/02/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
public/doc/02/images/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
public/doc/03/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

244
public/doc/03/doc.md Normal file
View File

@@ -0,0 +1,244 @@
# 基础-3-数码管实验
---
在许多项目设计中,我们通常需要一些显示设备来显示我们需要的信息,可以选择的显示设备有很多,而数码管是使用最多,最简单的显示设备之一。
## 3.1 章节导读
本章将通过数码管驱动实验讲解FPGA数字系统中重要的"选通控制"概念。读者将学习到:
1. 数码管工作原理与动态扫描技术
2. 多路复用Multiplexing设计方法
3. 参数化模块设计技巧
4. 外设驱动时序规划
5. ASCII到段码的转换原理
实验将使用Verilog HDL实现一个支持8位数码管显示、包含字符动态滚动和选通控制的完整系统。
## 3.2 理论学习
### 3.2.1 数码管结构
- 7段数码管组成A-G段+DP小数点
- 共阳/共阴类型区分(本实验采用共阳型,低电平有效)
### 3.2.2 动态扫描原理
```
显示周期 = 刷新周期 × 数码管数量
人眼视觉暂留效应(>60Hz
扫描频率计算公式f_scan = f_clk / CLK_CYCLE
```
### 3.2.3 关键技术
- 时分复用:分时选通数码管
- 段码生成ASCII字符到七段码转换
- 消隐处理:消除切换时的视觉残留
### 3.2.4 设计指标
| 参数 | 值 | 说明 |
|-------|-----|-------------------|
| 位数 | 8 | 数码管数量 |
| 频率 | 200Hz | 单管刷新频率 |
| 分辨率 | 8bit | 段码控制(含小数点)|
## 3.2 实战演练
### 3.3.1 系统架构
```verilog
[Top模块] [] []
ASCII数据生成
```
### 3.3.2 模块设计
#### led_display_selector
```verilog
module led_display_selector #(
parameter NUM = 4,
parameter VALID_SIGNAL = 1'b0,
parameter CLK_CYCLE = 1000
)(
input wire clk,
input wire rstn,
input wire [NUM*8-1:0] led_in,
output reg [7:0] led_display_seg,//[DP,G,F,E,D,C,B,A]
output reg [NUM-1:0] led_display_sel
);
reg [31:0] clk_cnt;
always @(posedge clk or negedge rstn) begin
if (!rstn) clk_cnt <= 0;
else if(clk_cnt == CLK_CYCLE) clk_cnt <= 0;
else clk_cnt <= clk_cnt + 1;
end
wire seg_change = (clk_cnt == CLK_CYCLE) ? 1'b1 : 1'b0;
always @(posedge clk or negedge rstn) begin
if(!rstn) led_display_sel <= {{(NUM-1){~VALID_SIGNAL}}, VALID_SIGNAL};
else if (seg_change) led_display_sel <= {led_display_sel[NUM-2:0], led_display_sel[NUM-1]};
else led_display_sel <= led_display_sel;
end
integer i;
always @(*) begin
for(i=0;i<NUM;i=i+1) begin
if(led_display_sel[NUM-1-i] == VALID_SIGNAL)
led_display_seg = led_in[i*8 +: 8] ^ ({8{~VALID_SIGNAL}});
end
end
endmodule //led_display_ctrl
```
#### led_display_driver
```verilog
module led_display_driver(// 8个数码管显示阳极管在selector中已经做了阴阳处理
input wire clk,
input wire rstn,
input wire [8*8-1:0] assic_seg, //ASSIC coding
input wire [7:0] seg_point, //显示小数点
output wire [7:0] led_display_seg,
output wire [7:0] led_display_sel
);
reg [8*8-1:0] led_in;
integer i;
always @(*) begin
led_in = 0;
for(i=0;i<8;i=i+1) begin //led_in[i*8 +: 8] <---> assic_seg[i*8 +: 8]
case (assic_seg[i*8 +: 8])
"0": led_in[i*8 +: 8] = (8'h3f) | {seg_point[i],7'b0};
"1": led_in[i*8 +: 8] = (8'h06) | {seg_point[i],7'b0};
"2": led_in[i*8 +: 8] = (8'h5b) | {seg_point[i],7'b0};
"3": led_in[i*8 +: 8] = (8'h4f) | {seg_point[i],7'b0};
"4": led_in[i*8 +: 8] = (8'h66) | {seg_point[i],7'b0};
"5": led_in[i*8 +: 8] = (8'h6d) | {seg_point[i],7'b0};
"6": led_in[i*8 +: 8] = (8'h7d) | {seg_point[i],7'b0};
"7": led_in[i*8 +: 8] = (8'h07) | {seg_point[i],7'b0};
"8": led_in[i*8 +: 8] = (8'h7f) | {seg_point[i],7'b0};
"9": led_in[i*8 +: 8] = (8'h6f) | {seg_point[i],7'b0};
"A","a": led_in[i*8 +: 8] = (8'h77) | {seg_point[i],7'b0};
"B","b": led_in[i*8 +: 8] = (8'h7c) | {seg_point[i],7'b0};
"C","c": led_in[i*8 +: 8] = (8'h39) | {seg_point[i],7'b0};
"D","d": led_in[i*8 +: 8] = (8'h5e) | {seg_point[i],7'b0};
"E","e": led_in[i*8 +: 8] = (8'h79) | {seg_point[i],7'b0};
"F","f": led_in[i*8 +: 8] = (8'h71) | {seg_point[i],7'b0};
"G","g": led_in[i*8 +: 8] = (8'h3d) | {seg_point[i],7'b0};
"H","h": led_in[i*8 +: 8] = (8'h76) | {seg_point[i],7'b0};
"I","i": led_in[i*8 +: 8] = (8'h0f) | {seg_point[i],7'b0};
"J","j": led_in[i*8 +: 8] = (8'h0e) | {seg_point[i],7'b0};
"K","k": led_in[i*8 +: 8] = (8'h75) | {seg_point[i],7'b0};
"L","l": led_in[i*8 +: 8] = (8'h38) | {seg_point[i],7'b0};
"M","m": led_in[i*8 +: 8] = (8'h37) | {seg_point[i],7'b0};
"N","n": led_in[i*8 +: 8] = (8'h54) | {seg_point[i],7'b0};
"O","o": led_in[i*8 +: 8] = (8'h5c) | {seg_point[i],7'b0};
"P","p": led_in[i*8 +: 8] = (8'h73) | {seg_point[i],7'b0};
"Q","q": led_in[i*8 +: 8] = (8'h67) | {seg_point[i],7'b0};
"R","r": led_in[i*8 +: 8] = (8'h31) | {seg_point[i],7'b0};
"S","s": led_in[i*8 +: 8] = (8'h49) | {seg_point[i],7'b0};
"T","t": led_in[i*8 +: 8] = (8'h78) | {seg_point[i],7'b0};
"U","u": led_in[i*8 +: 8] = (8'h3e) | {seg_point[i],7'b0};
"V","v": led_in[i*8 +: 8] = (8'h1c) | {seg_point[i],7'b0};
"W","w": led_in[i*8 +: 8] = (8'h7e) | {seg_point[i],7'b0};
"X","x": led_in[i*8 +: 8] = (8'h64) | {seg_point[i],7'b0};
"Y","y": led_in[i*8 +: 8] = (8'h6e) | {seg_point[i],7'b0};
"Z","z": led_in[i*8 +: 8] = (8'h59) | {seg_point[i],7'b0};
" ": led_in[i*8 +: 8] = (8'h00) | {seg_point[i],7'b0};
"-": led_in[i*8 +: 8] = (8'h40) | {seg_point[i],7'b0};
"_": led_in[i*8 +: 8] = (8'h08) | {seg_point[i],7'b0};
"=": led_in[i*8 +: 8] = (8'h48) | {seg_point[i],7'b0};
"+": led_in[i*8 +: 8] = (8'h5c) | {seg_point[i],7'b0};
"(": led_in[i*8 +: 8] = (8'h39) | {seg_point[i],7'b0};
")": led_in[i*8 +: 8] = (8'h0F) | {seg_point[i],7'b0};
default: led_in[i*8 +: 8] = (8'h00) | {seg_point[i],7'b0};
endcase
end
end
led_display_selector #(
.NUM ( 8 ),
.VALID_SIGNAL ( 1'b0 ), //阳极管,低电平亮
.CLK_CYCLE ( 5000 ))
u_led_display_selector(
.clk ( clk ),
.rstn ( rstn ),
.led_in ( led_in ),
.led_display_seg ( led_display_seg ),
.led_display_sel ( led_display_sel )
);
endmodule //moduleName
```
#### led_display_top
```verilog
module led_diaplay_top(
//system io
input wire external_clk ,
input wire external_rstn,
//led display io
output wire [7:0] led_display_seg,
output wire [7:0] led_display_sel
);
reg [43*8-1:0] assic_seg;
reg [7:0] seg_point;
reg [31:0] clk_cnt;
always @(posedge external_clk or negedge external_rstn) begin
if(!external_rstn) clk_cnt <= 0;
else clk_cnt <= clk_cnt + 1;
end
always @(posedge external_clk or negedge external_rstn) begin
if(!external_rstn) begin
assic_seg <= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -_=+()";
seg_point <= 8'b00000001;
end else if({clk_cnt[24]==1'b1} && (clk_cnt[23:0]==25'b0))begin
assic_seg <= {assic_seg[8*43-8-1:0], assic_seg[8*43-1 -: 8]};
seg_point <= {seg_point[6:0], seg_point[7]};
end else begin
assic_seg <= assic_seg;
seg_point <= seg_point;
end
end
led_display_driver u_led_display_driver(
.clk ( external_clk ),
.rstn ( external_rstn ),
.assic_seg ( assic_seg[8*43-1 -: 8*8] ),
.seg_point ( seg_point ),
.led_display_seg ( led_display_seg ),
.led_display_sel ( led_display_sel )
);
endmodule //led_diaplay_top
```
### 3.3.3 上板验证步骤
1. 设置参数CLK_CYCLE=5000对应200Hz扫描频率
2. 绑定管脚:连接数码管段选/位选信号
3. 观察现象:字符"01234567"应稳定显示
4. 修改assic_seg初始值验证滚动功能
---
## 3.4 章末总结
**关键收获:**
1. 掌握动态扫描消除器件闪烁的原理
2. 理解参数化设计NUM/VALID_SIGNAL的优势
3. 学习时序控制中计数器的重要作用
4. 实践ASCII到硬件编码的转换方法
**设计亮点:**
- 支持阴阳极自动适配通过VALID_SIGNAL参数
- 字符环形缓冲区实现无缝滚动
- 参数化设计增强模块复用性
---
## 3.5 拓展训练
结合流水灯实验和数码管实验:数码管显示数字,标识出当前流水到了哪一个灯

BIN
public/doc/04/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

212
public/doc/04/doc.md Normal file
View File

@@ -0,0 +1,212 @@
# 基础-4-矩阵键盘实验
## 4.1 章节导读
本章将介绍**矩阵键盘检测电路的设计与实现方法**通过Verilog HDL语言完成4×4矩阵键盘的扫描识别模块掌握**多键输入设备的行列扫描原理、消抖机制以及按键编码处理方式**。
矩阵键盘作为常见的人机交互接口之一广泛应用于嵌入式系统、数字电路和微控制器项目中。与独立按键不同矩阵键盘在节省IO资源的同时对扫描逻辑和时序处理提出了更高的要求。实验中我们将采用**逐行扫描法**,结合状态机与延时消抖手段,确保按键信息的准确采集。
## 4.2 理论学习
### 4.2.1 矩阵键盘结构
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:80%"/>
<br> <!--换行-->
图1.矩阵键盘原理图 <!--标题-->
</center>
</div>
实验板8个引脚分别连接矩阵键盘的KEY1~KEY8该矩阵键盘的原理如下将KEY1~KEY4脚设置为输出引脚KEY5~KEY8设置为输入引脚。以KEY1和KEY5为例当没有按键按下时KEY1和VCC之间是断路此时R1为上拉电阻电路几乎没有电流流过KEY5检测到的电压恰好是VCC为1。**所以按键不按下KEY5~KEY8检测到1。**
如果按键按下。此时KEY5~KEY8检测到的值与KEY1~KEY4的输出电压有关。以KEY1和KEY5为例如果KEY1输出为0按键1按下VCC和KEY1之间形成通路KEY5检测到0。但如果KEY1输出为1此时即使按键按下VCC和KEY1之间也几乎没有电流此时KEY5检测到高阻态也就是1。所以**如果行输出电平为0并且按键按下KEY5~8会检测到0如果行输出电平为1按键按下KEY5~8检测到1。**
现在我们看懂了原理图就可以开始设计verilog根据原理图我们知道只有行电平KEY1~4的输出电平为0时按键按下KEY5~8才会检测到0。那么我们可以用行扫描的逻辑设计
1. FPGA按顺序将1到4行中的一行输出为低电平其余3行为高电平或高阻态
2. FPGA逐个读取每列引脚KEY5~8的电平若某列为低电平则说明该行和该列交汇处的按键被按下。
3. 可以在没有按键按下时把所有行的输出电平都拉低直到有按键按下时重复1~2的步骤扫描。
## 4.2 实战演练
### 4.3.1 系统架构
``` verilog
系统框图:
[Top模块] = {矩阵键盘扫描模块 → 按键上升沿检测模块}
```
### 4.3.2 模块设计
根据上述原理,设计行扫描矩阵键盘检测模块如下:
#### matrix_key
```verilog
module matrix_key #(
parameter ROW_NUM = 4,
parameter COL_NUM = 4,
parameter DEBOUNCE_TIME = 2000,
parameter DELAY_TIME = 200
) (
input wire clk,
input wire rstn,
output reg [ROW_NUM-1:0] row,
input wire [COL_NUM-1:0] col,
output reg [ROW_NUM*COL_NUM-1:0] key_out
);
localparam ROW_ACTIVE = 1'b0; // 行有效电平
localparam ROW_INACTIVE = 1'b1; // 行无效电平
localparam COL_PRESSED = 1'b0; // 列按下电平
localparam COL_RELEASED = 1'b1; // 列释放电平
reg [ROW_NUM-1:0][COL_NUM-1:0] key; // 按键状态寄存器
reg [2:0] cu_st, nt_st;
localparam [2:0] ST_IDLE = 3'b001;
localparam [2:0] ST_SCAN = 3'b010;
localparam [2:0] ST_DEBOUNCE = 3'b100;
wire btn_pressed = ((|(~(col ^ {COL_NUM{COL_PRESSED}}))) && (cu_st == ST_IDLE)) || (key_out != 0); // 只要有一个按键按下btn_pressed为1
reg [31:0] delay_cnt; // 延时计数器
reg [31:0] debounce_cnt; // 消抖计数器
reg [ROW_NUM-1:0] row_cnt; // 行计数器
always @(posedge clk or negedge rstn) begin
if(!rstn) delay_cnt <= 0;
else if(cu_st == ST_SCAN) begin
if(delay_cnt == DELAY_TIME) delay_cnt <= 0;
else delay_cnt <= delay_cnt + 1;
end else delay_cnt <= 0;
end
always @(posedge clk or negedge rstn) begin
if(!rstn) row_cnt <= 0;
else if(cu_st == ST_SCAN) begin
if(delay_cnt == DELAY_TIME) row_cnt <= row_cnt + 1;
else row_cnt <= row_cnt;
end else row_cnt <= 0;
end
always @(posedge clk or negedge rstn) begin
if(!rstn) debounce_cnt <= 0;
else if(cu_st == ST_DEBOUNCE) begin
if(debounce_cnt == DEBOUNCE_TIME) debounce_cnt <= 0;
else debounce_cnt <= debounce_cnt + 1;
end else debounce_cnt <= 0;
end
/*
处理逻辑
ROW作为输出COL作为输入
1. ST_IDLE状态所有ROW都拉至有效电平
2. 若没有按键按下所有COL都为释放电平
3. 若有按键按下按下的按键所在的COL会变为按下电平
4. 进入ST_SCAN状态启动扫描ROW全部置为无效电平并逐次改变为有效电平。此时COL会都变成列释放电平
5. 如果某一个ROW行有效电平时COL变成了列按下电平则说明该ROW和COL交点的按键被按下
6. 每一行都扫描一遍。
7. 进入ST_DEBOUNCE状态所有ROW都拉至行有效电平在此期间不进行扫描。
8. DEBOUNCE时间到后进入IDLE状态。
*/
always @(posedge clk or negedge rstn) begin
if(!rstn) cu_st <= ST_IDLE;
else cu_st <= nt_st;
end
always @(*) begin
if(!rstn) nt_st <= ST_IDLE;
else case(cu_st)
ST_IDLE: begin
if(btn_pressed) nt_st <= ST_SCAN;
else nt_st <= ST_IDLE;
end
ST_SCAN: begin
if((delay_cnt == DELAY_TIME) && (row_cnt == ROW_NUM-1)) nt_st <= ST_DEBOUNCE;
else nt_st <= ST_SCAN;
end
ST_DEBOUNCE: begin
if(debounce_cnt == DEBOUNCE_TIME) nt_st <= ST_IDLE;
else nt_st <= ST_DEBOUNCE;
end
default: nt_st <= ST_IDLE;
endcase
end
integer i, j;
always @(posedge clk or negedge rstn) begin
if(!rstn) key <= 0;
else for(i=0; i<ROW_NUM; i=i+1)
for(j=0; j<COL_NUM; j=j+1)
if((cu_st == ST_SCAN) && (delay_cnt == DELAY_TIME) && (row_cnt == i)) key[i][j] <= (col[j] == COL_PRESSED)?(1'b1):(1'b0);
else key[i][j] <= key[i][j]; // 其他情况不变
end
always @(*) begin
for(i=0;i<ROW_NUM;i=i+1) begin
for(j=0;j<COL_NUM;j=j+1) begin
key_out[i*COL_NUM+j] <= key[i][j];
end
end
end
always @(posedge clk or negedge rstn) begin
if(!rstn) row <= {ROW_NUM{ROW_ACTIVE}};
else if(cu_st == ST_IDLE && nt_st == ST_SCAN) row <= {{(ROW_NUM-1){ROW_INACTIVE}}, ROW_ACTIVE};
else if(cu_st == ST_SCAN) begin
if(delay_cnt == DELAY_TIME) row <= {row[ROW_NUM-1:0],ROW_INACTIVE};
else row <= row;
end else row <= {ROW_NUM{ROW_ACTIVE}};
end
endmodule //matrix_key
```
为了能够观察到现象使用板载8个led和实验箱8个led进行显示按下矩阵键盘的按键对应led就会亮顶层文件如下所示
#### matrix_key_top
```verilog
module matrix_key_top(
//system io
input wire external_clk ,
input wire external_rstn,
input wire [ 3:0] col,
output wire [ 3:0] row,
output wire [15:0] led
);
wire [15:0] key_out;
assign led = key_out;
matrix_key #(
.ROW_NUM ( 4 ),
.COL_NUM ( 4 ),
.DEBOUNCE_TIME ( 10000 ),
.DELAY_TIME ( 2000 ))
u_matrix_key(
.clk ( external_clk ),
.rstn ( external_rstn ),
.row ( row ),
.col ( col ),
.key_out ( key_out )
);
endmodule
```
### 4.3.3 上板验证步骤
1. 设置参数CLK_CYCLE=5000对应200Hz扫描频率
2. 绑定管脚连接led和矩阵键盘管脚
---
## 4.4 章末总结
**关键收获:**
1. 掌握矩阵键盘行扫描原理,能看懂原理图
3. 学习时序控制中计数器的重要作用
---
## 4.5 拓展训练
可以将数码管与矩阵键盘相结合

BIN
public/doc/04/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
public/doc/05/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

194
public/doc/05/doc.md Normal file
View File

@@ -0,0 +1,194 @@
# 基础-5-PWM呼吸灯
## 5.1 章节导读
本章将实现 PWM脉宽调制呼吸灯效果即控制 LED 灯的亮度在一个周期内从暗到亮再从亮到暗,形成如人呼吸般的灯光变化。通过该实验可以掌握 PWM 占空比调节以及 FPGA 控制 LED 的基本方法。
## 5.2 理论学习
呼吸灯在我们的生活中很常见在电脑上多作为消息提醒指示灯而被广泛使用其效果是小灯在一段时间内从完全熄灭的状态逐渐变到最亮再在同样的时间段内逐渐达到完全熄灭的状态并循环往复。这种效果就像“呼吸”一样。而实现”呼吸“的方法就是PWM技术。
PWMPulse Width Modulation是一种常用的控制技术其核心思想是通过控制一个周期内信号为高电平的时间比例占空比来实现输出电压或亮度的变化。也就是说只要我们在小时间段内led灯的亮度依次增加然后依次减小即可实现”呼吸“的效果。
## 5.3 实战演练
### 5.3.1 实验目标
实现 LED 呼吸灯效果亮度逐渐变亮再逐渐变暗周而复始整体周期约为2秒视觉上更加自然流畅。
### 5.3.2 硬件资源
实验板提供 32 颗 LED 灯,本实验选用其中的 1 颗绿色 LED 进行 PWM 控制
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图1.LED扩展板 <!--标题-->
</center>
</div>
通过原理图可以得知本试验箱的LED灯为高电平时点亮。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/2.png"
alt="无法显示图片时显示的文字"
style="zoom:40%"/>
<br> <!--换行-->
图2.LED扩展板原理图 <!--标题-->
</center>
</div>
### 5.3.3 程序设计
本模块的设计事实上是两个计数器所以肯定需要时钟信号sysclk也需要一个rstn复位信号同时需要一个IO口驱动LED。所以模块的端口如下表所示
| 端口名称 | 端口位宽 | 端口类型 |功能描述|
|:----------:|:----:|:----:|:--------------------:|
| sysclk | 1Bit | Input | 输入时钟频率27M |
| rstn | 1Bit | Input | 复位信号,低电平有效 |
| led | 1Bit | Output | LED控制信号 |
为了实现一个视觉上柔和自然的 LED 呼吸效果,我们设定完整的呼吸周期为 2 秒,即 LED 亮度在 1 秒内逐渐增强,接着在另 1 秒内逐渐减弱。整个过程由占空比duty cycle的变化来控制 PWM 输出的高电平持续时间。
在本设计中,使用实验板的 27MHz 系统时钟。为了获得合适的 PWM 控制精度,我们将一个 PWM 周期设定为 1ms这对应 27000 个时钟周期27M ÷ 1000。通过一个名为 `pwm_cnt` 的计数器来实现这一周期性计数,当 `pwm_cnt` 小于占空比 `duty` 的值时LED 输出高电平,从而控制亮度。
为了实现“呼吸”变化,我们再设计另一个计数器 `duty`,它每 1ms`pwm_cnt` 计满一次)更新一次。前 1000ms 内占空比逐渐增加,即 `duty` 每次增加从而输出高电平的时间逐步变长LED 亮度逐渐增强;后 1000ms 内占空比逐渐减小每次减小LED 亮度逐渐变弱。如此循环往复,即可实现 LED 的“柔和呼吸”效果。
那么,占空比 duty 的变化步长如何选择?考虑到:一个 1ms是 27000 个时钟如果我们希望1ms内led亮的时间为1us的倍数那么我们可以将27000分成1000份一份是27。如果duty的每次增减是27那么也就对应了led每次亮灭的时间增减了1us。也就是说当duty为27时led亮的时间为1us1ms过后duty变为54led亮的时间为2us以此类推当duty为27000时led亮满1ms。这样就实现了led亮的时间逐渐增加的效果。
模块的参考代码如下所示(`pwm.v`
```verilog
module pwm(
input wire sysclk, // 27MHz 系统时钟
input wire rstn, // 低有效复位
output wire led // PWM 控制LED输出
);
parameter PWM_PERIOD = 16'd27000;//1ms
// 单一PWM周期1ms
// duty上升的次数是1000次下降的次数也是1000次说明pwm的半周期是 1ms * 1000 = 1s
// pwm的一次全周期是 1s * 2 = 2s
reg [15:0] pwm_cnt;
reg [15:0] duty;
reg inc_dec_flag;//0表示duty+ 1表示duty-
//计数器1不断累加
always @(posedge sysclk or negedge rstn) begin
if (!rstn)
pwm_cnt <= 0;
else if (pwm_cnt < PWM_PERIOD - 1)
pwm_cnt <= pwm_cnt + 1;
else
pwm_cnt <= 0;
end
//计数器2控制占空比单一周期结束进行一次累加或者减
always @(posedge sysclk or negedge rstn) begin
if (!rstn)
duty <= 0;
else if (pwm_cnt == PWM_PERIOD - 1)begin
if(inc_dec_flag == 0)
duty <= duty + 27;
else
duty <= duty - 27;
end
else duty <= duty;
end
//加减的标志位,半周期结束后反转。
always @(posedge sysclk or negedge rstn) begin
if(~rstn)
inc_dec_flag <= 0;
else if(duty == PWM_PERIOD)
inc_dec_flag <= 1;
else if(duty == 0)
inc_dec_flag <= 0;
else
inc_dec_flag <= inc_dec_flag;
end
assign led = (pwm_cnt < duty) ? 1'b1 : 1'b0;
endmodule
```
### 5.3.4 仿真验证
为了验证模块功能,我们可以编写仿真模块,并将 `PWM_PERIOD` 等比例缩小为270以便快速验证。以下为仿真文件`pwm_tb.v`
```verilog
`timescale 1ns/1ns
module pwm_tb;
reg sysclk;
reg rstn;
wire led;
// 实例化待测试模块
pwm #(
.PWM_PERIOD(270)//为了减少仿真时间将单一pwm周期从27000等比例缩小为270
) pwm_inst (
.sysclk(sysclk),
.rstn(rstn),
.led(led)
);
// 产生系统时钟:周期约为 27Mhz
initial begin
sysclk = 0;
forever #(500/27) sysclk = ~sysclk;
end
// 初始化和复位过程
initial begin
// 初始化
rstn = 0;
#100; // 保持复位100ns
rstn = 1; // 释放复位
end
endmodule
```
同时为了便于仿真可以直接点击sim文件夹下hebav文件夹中的do.bat文件即可利用ModuleSim对模块进行仿真仿真波形如下
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/3.png"
alt="无法显示图片时显示的文字"
style="zoom:60%"/>
<br> <!--换行-->
图3.呼吸灯仿真波形(一) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/4.png"
alt="无法显示图片时显示的文字"
style="zoom:60%"/>
<br> <!--换行-->
图4.呼吸灯仿真波形(二) <!--标题-->
</center>
</div>
通过观察波形我们发现led输出为1的时间在逐步增加之后逐步减小duty的值从0增加到270后减小符合设计预期可以进行下一步上板验证。
### 5.3.5 上板验证
仿真验证通过后,即可进行上板测试。在实际使用时需要进行管脚约束。以下为参考端口与分配示例:
| 端口名称 | 信号类型 | 对应管脚 | 功能 |
| -------- | -------- | -------- | ------------------ |
| clk | Input | | 27MHz时钟 |
| rstn | Input | | 复位 |
| led | Output | | 输出PWM信号连接LED |
完成管脚绑定后生成 `.sbit` 文件,上传到实验平台后进行烧录,即可在摄像头画面中看到 LED 呼吸闪烁效果。
## 5.4 章末总结
本章我们学习了 PWM 控制的基本原理及其在 LED 呼吸灯上的应用同时通过不断改变PWM占空比方式使呼吸过程更加平滑自然。该方法不仅适用于视觉灯效控制还广泛应用于马达调速、音量控制等模拟量调节领域。你可以进一步尝试调整占空比范围、节奏速度甚至扩展到多个 LED 同步/异步呼吸控制,实现更加炫酷的视觉效果。

BIN
public/doc/05/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
public/doc/05/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

BIN
public/doc/05/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 KiB

BIN
public/doc/05/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
public/doc/06/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

650
public/doc/06/doc.md Normal file
View File

@@ -0,0 +1,650 @@
# 基础-6-HDMI显示
## 6.1 章节导读
随着多媒体技术的快速发展高清显示已成为嵌入式系统与FPGA应用中不可或缺的一部分。HDMIHigh-Definition Multimedia Interface作为目前最主流的视频数字传输标准广泛应用于电视、显示器、笔记本、摄像头等各类终端设备中。相比传统的模拟VGA接口HDMI具有传输带宽高、支持音视频同步、无压缩信号传输等优点能更好地满足现代图像处理和显示系统的需求。
在FPGA开发中掌握HDMI显示技术不仅是实现图像/视频输出的基础能力更是后续图像识别、视频监控、图形用户界面GUI等复杂系统设计的前提。因此本实验以HDMI显示为核心内容带领大家从零开始构建一个完整的视频输出链路。通过配置显示参数、生成时序控制信号、输出RGB图像数据等关键步骤最终实现在HDMI接口上稳定输出画面。
在本次实验中我们将学习利用实验板的HDMI接口和MS7210芯片进行HDMI显示实验的设计。
## 6.2 理论学习
### 6.2.1 VGA时序
VGA显示是在行同步和帧同步场同步的信号同步下按照从上到下从左到右的顺序扫描到显示屏上。VGA扫描方式见下图所示
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:50%"/>
<br> <!--换行-->
图1.VGA扫描顺序 <!--标题-->
</center>
</div>
如上图所示每一帧图像都是从左上角开始逐行扫描形成所以规定最左上角的像素点为第一个像素点坐标是00以这个像素为起点向右x坐标逐渐增大向下y坐标逐渐增大重复若干次后扫描到右下角完成一帧图像的扫描扫描完成后进行图像消隐随后指针跳回左上角重新进行新一帧的扫描。
在扫描的过程中会对每一个像素点进行单独赋值使每个像素点显示对应色彩信息当扫描速度足够快加之人眼的视觉暂留特性我们会看到一幅完整的图片这就是VGA 显示的原理。
VGA显示除了要有像素点的信息还需要有行同步HSync和场同步VSync两个信号辅助显示。行同步信号规定了一行像素的开始与结束场同步信号规定了一帧图像的开始与结束。在VESA DMT 1.12版本的标准文档中给出的VGA时序图如下图所示
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/2.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图2.VGA标准时序 <!--标题-->
</center>
</div>
行同步时序如下图所示:
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/3.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图3.行同步时序 <!--标题-->
</center>
</div>
行同步的一个扫周期要经过6个部分分别是Sync同步、 Back Porch后沿、 Left Border左边框、 “Addressable” Video有效图像、 Right Border右边框、 Front Porch前沿这些过程的长度都是以像素为单位的也就是以像素时钟为单位例如Sync的值为96也就意味着Sync阶段要经历96个像素时钟。HSync信号会在Sync同步阶段拉高不同的芯片可能有不同标准以确定新一行的开始与上一行的结束。而完整的一行像素很多但有效的真正能显示在屏幕上的像素只有 “Addressable” Video有效图像部分的像素其他阶段的像素均无效无法显示在屏幕中。
场同步时序如下图所示:
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/4.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图4.场同步时序 <!--标题-->
</center>
</div>
场同步时序与行同步时序相同也是分为6个部分在Sync同步阶段拉高标志着一帧的结束和新一帧的开始其中像素只有在“Addressable” Video有效图像阶段才有效其他阶段均无效。而场同步信号的基本单位是行比如Sync的值为2也就意味着Sync同步阶段要经历两行。
那么我们将行同步和场同步信号结合起来,遍可以得到一帧图像的样貌,如下图所示:
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/5.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图5.一帧图像组成示意图 <!--标题-->
</center>
</div>
可以看到在行场同步信号构成了一个二维坐标系,原点在左上方,中间遍形成了一帧图像,而真正能显示在屏幕中的图像只有 “Addressable” Video有效图像部分。
现在我们知道了行同步和场同步都要经历6个部分那么这些部分的长度都是如何规定的呢VGA 行时序对行同步时间、 消隐时间、 行视频有效时间和行前肩时间有特定的规范, 场时序也是如此。 常用VGA 分辨率时序参数如下表所示:
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/6.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图6.常用VGA分辨率时序参数 <!--标题-->
</center>
</div>
### 6.2.2 MS7210芯片
MS7210是一款HD发送芯片支持4K@30Hz的视频3D传输格式。可以支持的最高分辨率高达4K@30Hz最高采样率达到300MHz。MS7210支持YUV和RGB 之间的色彩空间转换数字接口支持YUV以及RGB格式输入。MS7210的IIS接口以及S/PDIF 接口支持高清音频的传输其中S/PDIF接口既可以兼容IEC61937标准下的压缩音频传输同时还支持高比特音频HBR的传输在高比特音频HBR模式下音频采样率最高为768KHz。MS7210的IIC 地址可以根据SA引脚进行选择。当 SA引脚上拉到电源电压或者悬空时地址为 OxB2。当 SA 引脚连接到 GND 时地址为0x56。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/7.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图7.MS7210芯片 <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/8.png"
alt="无法显示图片时显示的文字"
style="zoom:50%"/>
<br> <!--换行-->
图8.MS7210功能框图 <!--标题-->
</center>
</div>
MS7210芯片可以通过IIC协议对内部寄存器进行配置有关芯片寄存器配置需要向芯片厂家进行申请。
## 6.3 实战演练
### 6.3.1实验目标
### 6.3.2硬件资源
实验板共有一个HDMI-OUT接口由MS7210驱动一个HDMI-IN接口由MS7200驱动。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/9.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图9.板载HDMI芯片 <!--标题-->
</center>
</div>
实验箱配备一个小型HDMI显示器该显示器HDMI接口与HDMI-OUT接口连接图像可以显示在显示屏中通过摄像头可以在网站观察现象
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/xxx.png"
alt="实验箱显示器"
style="zoom:40%"/>
<br> <!--换行-->
图10.实验箱显示器 <!--标题-->
</center>
</div>
### 6.3.3程序设计
在设计程序时我们先对本实验工程有一个整体认知首先来看一下HDMI彩条显示实验的整体框图。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/xxxx.png"
alt="实验箱显示器"
style="zoom:40%"/>
<br> <!--换行-->
图11.HDMI彩条显示整体框图 <!--标题-->
</center>
</div>
可见整个实验一共由好多个模块组成,下面是各个模块简介
| 模块名称 |功能描述| 备注 |
|:----:|:----:|:----:|
| hdmi_top | 顶层模块 ||
| ms7210_ctrl_iic_top | ms7210芯片配置和iic顶层模块 |参考小眼睛例程|
| ms7210_ctl | ms7210芯片配置和时序控制模块 |使用小眼睛例程|
| iic_dri | iic驱动模块 |使用小眼睛例程|
| vga_ctrl | vga时序信号生成模块 |参考野火例程|
| vga_pic | vga像素数据生成模块 |参考野火例程|
本次实验主要完成vga_ctrl和vga_pic模块的设计。
对于vga_ctrl模块我们主要完成hsyncvsync信号xy坐标数据有效rgb_valid信号的设计。经过我们前面的学习已经对vga时序有了一定的了解我们可以想象到这几个信号也只是一种计数器而已。
本实验要实现640x480的彩条显示相关参数如下所示
```Verilog
//parameter define
parameter H_SYNC = 10'd96 , //行同步
H_BACK = 10'd40 , //行时序后沿
H_LEFT = 10'd8 , //行时序左边框
H_VALID = 10'd640 , //行有效数据
H_RIGHT = 10'd8 , //行时序右边框
H_FRONT = 10'd8 , //行时序前沿
H_TOTAL = 10'd800 ; //行扫描周期
parameter V_SYNC = 10'd2 , //场同步
V_BACK = 10'd25 , //场时序后沿
V_TOP = 10'd8 , //场时序上边框
V_VALID = 10'd480 , //场有效数据
V_BOTTOM = 10'd8 , //场时序下边框
V_FRONT = 10'd2 , //场时序前沿
V_TOTAL = 10'd525 ; //场扫描周期
```
首先设计两个计数器`cnt_h``cnt_v`分别对像素和行进行计数,一个像素时钟过后`cnt_h`加一,一行过后`cnt_v`加一,扫描完一帧之后,计数器归零。
而其他的状态信号则可以根据计数器的计数进行设计。hsync信号只要`cnt_h < H_SYNC`就拉高vsync信号类似。当计数到有效数据部分数据有效信号rgb_valid就可以拉高注意由于时序逻辑有一个时钟周期的反应时间所以xy的坐标变化比rgb_valid提前一个时钟周期。参考代码如下所示
```verilog
`timescale 1ns/1ns
////////////////////////////////////////////////////////////////////////
// Author : EmbedFire
// 实验平台: 野火FPGA系列开发板
// 公司 : http://www.embedfire.com
// 论坛 : http://www.firebbs.cn
// 淘宝 : https://fire-stm32.taobao.com
////////////////////////////////////////////////////////////////////////
module vga_ctrl
(
input wire vga_clk , //输入工作时钟,频率25MHz
input wire sys_rst_n , //输入复位信号,低电平有效
input wire [15:0] pix_data , //输入像素点色彩信息
output wire [11:0] pix_x , //输出VGA有效显示区域像素点X轴坐标
output wire [11:0] pix_y , //输出VGA有效显示区域像素点Y轴坐标
output wire hsync , //输出行同步信号
output wire vsync , //输出场同步信号
output wire rgb_valid ,
output wire [15:0] rgb //输出像素点色彩信息
);
//********************************************************************//
//****************** Parameter and Internal Signal *******************//
//********************************************************************//
//parameter define
parameter H_SYNC = 10'd96 , //行同步
H_BACK = 10'd40 , //行时序后沿
H_LEFT = 10'd8 , //行时序左边框
H_VALID = 10'd640 , //行有效数据
H_RIGHT = 10'd8 , //行时序右边框
H_FRONT = 10'd8 , //行时序前沿
H_TOTAL = 10'd800 ; //行扫描周期
parameter V_SYNC = 10'd2 , //场同步
V_BACK = 10'd25 , //场时序后沿
V_TOP = 10'd8 , //场时序上边框
V_VALID = 10'd480 , //场有效数据
V_BOTTOM = 10'd8 , //场时序下边框
V_FRONT = 10'd2 , //场时序前沿
V_TOTAL = 10'd525 ; //场扫描周期
//wire define
wire pix_data_req ; //像素点色彩信息请求信号
//reg define
reg [11:0] cnt_h ; //行同步信号计数器
reg [11:0] cnt_v ; //场同步信号计数器
//********************************************************************//
//***************************** Main Code ****************************//
//********************************************************************//
//cnt_h:行同步信号计数器
always@(posedge vga_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_h <= 12'd0 ;
else if(cnt_h == H_TOTAL - 1'd1)
cnt_h <= 12'd0 ;
else
cnt_h <= cnt_h + 1'd1 ;
//hsync:行同步信号
assign hsync = (cnt_h <= H_SYNC - 1'd1) ? 1'b1 : 1'b0 ;
//cnt_v:场同步信号计数器
always@(posedge vga_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
cnt_v <= 12'd0 ;
else if((cnt_v == V_TOTAL - 1'd1) && (cnt_h == H_TOTAL-1'd1))
cnt_v <= 12'd0 ;
else if(cnt_h == H_TOTAL - 1'd1)
cnt_v <= cnt_v + 1'd1 ;
else
cnt_v <= cnt_v ;
//vsync:场同步信号
assign vsync = (cnt_v <= V_SYNC - 1'd1) ? 1'b1 : 1'b0 ;
//rgb_valid:VGA有效显示区域
assign rgb_valid = (((cnt_h >= H_SYNC + H_BACK + H_LEFT)
&& (cnt_h < H_SYNC + H_BACK + H_LEFT + H_VALID))
&&((cnt_v >= V_SYNC + V_BACK + V_TOP)
&& (cnt_v < V_SYNC + V_BACK + V_TOP + V_VALID)))
? 1'b1 : 1'b0;
//pix_data_req:像素点色彩信息请求信号,超前rgb_valid信号一个时钟周期
assign pix_data_req = (((cnt_h >= H_SYNC + H_BACK + H_LEFT - 1'b1)
&& (cnt_h < H_SYNC + H_BACK + H_LEFT + H_VALID - 1'b1))
&&((cnt_v >= V_SYNC + V_BACK + V_TOP)
&& (cnt_v < V_SYNC + V_BACK + V_TOP + V_VALID)))
? 1'b1 : 1'b0;
//pix_x,pix_y:VGA有效显示区域像素点坐标
assign pix_x = (pix_data_req == 1'b1)
? (cnt_h - (H_SYNC + H_BACK + H_LEFT - 1'b1)) : 12'hfff;
assign pix_y = (pix_data_req == 1'b1)
? (cnt_v - (V_SYNC + V_BACK + V_TOP)) : 12'hfff;
//rgb:输出像素点色彩信息
assign rgb = (rgb_valid == 1'b1) ? pix_data : 16'b0 ;
endmodule
```
对于vga_pic模块我们可以根据x坐标范围0~639分成十份每一份输出不同的颜色。参考代码如下所示
```verilog
`timescale 1ns/1ns
////////////////////////////////////////////////////////////////////////
// Author : EmbedFire
// 实验平台: 野火FPGA系列开发板
// 公司 : http://www.embedfire.com
// 论坛 : http://www.firebbs.cn
// 淘宝 : https://fire-stm32.taobao.com
////////////////////////////////////////////////////////////////////////
module vga_pic
(
input wire vga_clk , //输入工作时钟,频率25MHz
input wire sys_rst_n , //输入复位信号,低电平有效
input wire [11:0] pix_x , //输入VGA有效显示区域像素点X轴坐标
input wire [11:0] pix_y , //输入VGA有效显示区域像素点Y轴坐标
output reg [15:0] pix_data //输出像素点色彩信息
);
//********************************************************************//
//****************** Parameter and Internal Signal *******************//
//********************************************************************//
//parameter define
parameter H_VALID = 12'd640 , //行有效数据
V_VALID = 12'd480 ; //场有效数据
parameter RED = 16'hF800, //红色
ORANGE = 16'hFC00, //橙色
YELLOW = 16'hFFE0, //黄色
GREEN = 16'h07E0, //绿色
CYAN = 16'h07FF, //青色
BLUE = 16'h001F, //蓝色
PURPPLE = 16'hF81F, //紫色
BLACK = 16'h0000, //黑色
WHITE = 16'hFFFF, //白色
GRAY = 16'hD69A; //灰色
//********************************************************************//
//***************************** Main Code ****************************//
//********************************************************************//
//pix_data:输出像素点色彩信息,根据当前像素点坐标指定当前像素点颜色数据
always@(posedge vga_clk or negedge sys_rst_n)
if(sys_rst_n == 1'b0)
pix_data <= 16'd0;
else if((pix_x >= 0) && (pix_x < (H_VALID/10)*1))
pix_data <= RED;
else if((pix_x >= (H_VALID/10)*1) && (pix_x < (H_VALID/10)*2))
pix_data <= ORANGE;
else if((pix_x >= (H_VALID/10)*2) && (pix_x < (H_VALID/10)*3))
pix_data <= YELLOW;
else if((pix_x >= (H_VALID/10)*3) && (pix_x < (H_VALID/10)*4))
pix_data <= GREEN;
else if((pix_x >= (H_VALID/10)*4) && (pix_x < (H_VALID/10)*5))
pix_data <= CYAN;
else if((pix_x >= (H_VALID/10)*5) && (pix_x < (H_VALID/10)*6))
pix_data <= BLUE;
else if((pix_x >= (H_VALID/10)*6) && (pix_x < (H_VALID/10)*7))
pix_data <= PURPPLE;
else if((pix_x >= (H_VALID/10)*7) && (pix_x < (H_VALID/10)*8))
pix_data <= BLACK;
else if((pix_x >= (H_VALID/10)*8) && (pix_x < (H_VALID/10)*9))
pix_data <= WHITE;
else if((pix_x >= (H_VALID/10)*9) && (pix_x < H_VALID))
pix_data <= GRAY;
else
pix_data <= BLACK;
endmodule
```
在顶层模块我们首先要利用PLL ip核生成iic的驱动时钟进行初始化由于ms7210芯片的需要我们通过计数设置一个延迟复位信号由于我们的彩条颜色是按照RGB565格式生成的所以需要向RGB888进行转换只需要填0补位即可同时由于板载时钟是27M与25.175M相差不大,所以直接使用板载时钟作为像素时钟输出。然后我们将输出的行场同步信号,像素时钟,像素数据,像素数据有效信号等与模块相连接即可完成设计。顶层模块参考代码如下:
```Verilog
`timescale 1ns / 1ns
module hdmi_top(
input wire sys_clk ,// input system clock 50MHz
input rstn_in ,
output rstn_out ,
output hd_scl ,
inout hd_sda ,
output led_int ,
//hdmi_out
output pixclk_out ,//pixclk
output wire vs_out ,
output wire hs_out ,
output wire de_out ,
output wire [7:0] r_out ,
output wire [7:0] g_out ,
output wire [7:0] b_out
);
wire cfg_clk ;
wire locked ;
wire rstn ;
wire init_over ;
reg [15:0] rstn_1ms ;
//**********************************************//
//*****************MS7210初始化******************//
//**********************************************//
//**************仿真时不编译此部分***************//
`ifndef SIM
//初始化成功标志
assign led_int = init_over;
//生成10M IIC时钟
PLL u_pll (
.clkout0(cfg_clk), // output
.lock(locked), // output
.clkin1(sys_clk) // input
);
//ms7210初始化模块
ms7210_ctrl_iic_top ms7210_ctrl_iic_top_inst(
.clk ( cfg_clk ), //input clk,
.rst_n ( rstn_out ), //input rstn,
.init_over ( init_over ), //output init_over,
.iic_scl ( hd_scl ), //output iic_scl,
.iic_sda ( hd_sda ) //inout iic_sda
);
//延迟复位
always @(posedge cfg_clk)
begin
if(!locked)
rstn_1ms <= 16'd0;
else
begin
if(rstn_1ms == 16'h2710)
rstn_1ms <= rstn_1ms;
else
rstn_1ms <= rstn_1ms + 1'b1;
end
end
assign rstn_out = (rstn_1ms == 16'h2710) && rstn_in;
//**********************************************//
`else
assign led_int = 1;
assign rstn_out = rstn_in;
`endif
//**********************************************//
//**********************************************//
//**********************************************//
//**********************************************//
wire [15:0] rgb565;
wire [15:0] pix_data ;
wire [11:0] pix_x;
wire [11:0] pix_y;
//vga行场同步控制模块
vga_ctrl vga_ctrl_inst (
.vga_clk (sys_clk ),
.sys_rst_n (rstn_out ),
.pix_data (pix_data ),
.pix_x (pix_x ),
.pix_y (pix_y ),
.hsync (hs_out ),
.vsync (vs_out ),
.rgb_valid (de_out ),
.rgb (rgb565 )
);
//彩条数据生成模块
vga_pic vga_pic_inst (
.vga_clk (sys_clk ),
.sys_rst_n (rstn_out ),
.pix_x (pix_x ),
.pix_y (pix_y ),
.pix_data_out (pix_data )
);
//RGB565转RGB888
assign pixclk_out = sys_clk ;//直接使用27M时钟与25.175相差不大
assign r_out = {rgb565[15:11],3'b0};
assign g_out = {rgb565[10: 5],2'b0};
assign b_out = {rgb565[ 4: 0],3'b0};
endmodule
```
### 6.3.4仿真验证
由于仿真不需要对MS7210芯片进行初始化所以我们在top文件中加入条件编译指令并且在仿真文件中定义SIM宏那么就可以在仿真中不编译ms7210初始化相关代码只对vga时序进行仿真。我们只需要提供时钟和复位即可对模块进行仿真。仿真文件如下所示
```verilog
`timescale 1ns / 1ns
`define SIM
module hdmi_top_tb;
// Parameters
//Ports
reg sys_clk;
reg rstn_in;
wire rstn_out;
wire hd_scl;
wire hd_sda;
wire led_int;
wire pixclk_out;
wire vs_out;
wire hs_out;
wire de_out;
wire [7:0] r_out;
wire [7:0] g_out;
wire [7:0] b_out;
initial begin
sys_clk = 0;
rstn_in = 0;
#100
rstn_in = 1;
end
always #(500/27) sys_clk = ~sys_clk;
hdmi_top hdmi_top_inst (
.sys_clk(sys_clk),
.rstn_in(rstn_in),
.rstn_out(rstn_out),
.hd_scl(hd_scl),
.hd_sda(hd_sda),
.led_int(led_int),
.pixclk_out(pixclk_out),
.vs_out(vs_out),
.hs_out(hs_out),
.de_out(de_out),
.r_out(r_out),
.g_out(g_out),
.b_out(b_out)
);
endmodule
```
直接点击sim文件夹下hebav文件夹中的do.bat文件即可利用ModuleSim对模块进行仿真仿真波形如下
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/10.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图10.仿真波形(一) <!--标题-->
</center>
</div>
从上图我们可以发现vsync信号拉高了两个行同步信号的长度与设计相符
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/11.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图11.仿真波形(二) <!--标题-->
</center>
</div>
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/12.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图12.仿真波形(三) <!--标题-->
</center>
</div>
从图11和12中我们可以看到当cnt_h信号计数结束后会恢复0cnt_v会加一hsync信号会拉高96个像素时钟0~95cnt_h和hsync与设计相符。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/13.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图13.仿真波形(四) <!--标题-->
</center>
</div>
如图13所示当cnt_h计数到H_SYNC + H_BACK + H_LEFT也就是144时rgb_valid拉高xy轴坐标比rgb_valid提前一个时钟周期以便pix_data准备好数据符合设计。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/14.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图14.仿真波形(五) <!--标题-->
</center>
</div>
从每一行看每一行被分成了10个部分每部分像素数据分别对应不同颜色符合设计要求。可以进行下一步上板验证。
### 6.3.5上板验证
仿真已经通过,可以进行上板验证,上板前要先进行管脚约束。端口与对应管脚如下表所示:
| 端口名称 |信号类型| 对应管脚|功能|
|:----:|:----:|:----:|:----:|
| sysclk | Input | D18 | 27M时钟 |
| rstn_in | Input | C22 | 外部输入复位 |
| rstn_out | Output | G25 | 输出ms7210复位 |
| hd_scl | Output | K22 | iic SCL信号 |
| hd_sda | Output | K23 | iic SDA信号 |
| led_int | Output | A20 | 配置完成信号 |
| pixclk_out | Output | G25 | 像素时钟输出 |
| vs_out | Output | R21 | Vsync输出 |
| hs_out | Output | R20 | Hsync输出 |
| de_out | Output | N19 | RGB_valid输出 |
| r_out[0] | Output | N21 | RGB888输出 |
| r_out[1] | Output | L23 | RGB888输出 |
| r_out[2] | Output | L22 | RGB888输出 |
| r_out[3] | Output | L25 | RGB888输出 |
| r_out[4] | Output | L24 | RGB888输出 |
| r_out[5] | Output | K26 | RGB888输出 |
| r_out[6] | Output | K25 | RGB888输出 |
| r_out[7] | Output | P16 | RGB888输出 |
| g_out[0] | Output | T25 | RGB888输出 |
| g_out[1] | Output | P25 | RGB888输出 |
| g_out[2] | Output | R25 | RGB888输出 |
| g_out[3] | Output | P24 | RGB888输出 |
| g_out[4] | Output | P23 | RGB888输出 |
| g_out[5] | Output | N24 | RGB888输出 |
| g_out[6] | Output | N23 | RGB888输出 |
| g_out[7] | Output | N22 | RGB888输出 |
| b_out[0] | Output | P19 | RGB888输出 |
| b_out[1] | Output | P21 | RGB888输出 |
| b_out[2] | Output | P20 | RGB888输出 |
| b_out[3] | Output | M22 | RGB888输出 |
| b_out[4] | Output | M21 | RGB888输出 |
| b_out[5] | Output | N18 | RGB888输出 |
| b_out[6] | Output | R22 | RGB888输出 |
| b_out[7] | Output | T22 | RGB888输出 |
管脚分配可以直接编写.fdc文件也可以使用PDS内置的工具进行分配。完成管脚分配之后就可以生成sbit文件将文件提交到网站后点击烧录即可将sbit下载到实验板中在摄像头页面即可观察到显示屏中显示出彩条。
## 6.4 章末总结
本次实验主要学习VGA时序的相关知识并使用HD硬核进行HDMI显示感兴趣的同学可以尝试使用HDMI显示其他图像。

BIN
public/doc/06/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
public/doc/06/images/10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

BIN
public/doc/06/images/11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 KiB

BIN
public/doc/06/images/12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 KiB

BIN
public/doc/06/images/13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 942 KiB

BIN
public/doc/06/images/14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 KiB

BIN
public/doc/06/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 KiB

BIN
public/doc/06/images/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
public/doc/06/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
public/doc/06/images/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

BIN
public/doc/06/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
public/doc/06/images/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

BIN
public/doc/06/images/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

BIN
public/doc/06/images/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
public/doc/11/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

400
public/doc/11/doc.md Normal file
View File

@@ -0,0 +1,400 @@
# 进阶-1-密码锁实验
## 1.1 章节导读
本章作为进阶的第一个实验,主要学习状态机的写法和使用,同时联系前面所学的数码管和矩阵键盘,完成一个密码锁的设计。
## 1.2 理论学习
### 1.2.1 FSM状态机
在数字逻辑设计中,**有限状态机FSM, Finite State Machine**是一种根据输入和当前状态决定下一个状态和输出的模型,广泛用于顺序逻辑电路的控制部分。
在本实验中,我们将使用 FSM 构建密码锁的控制逻辑,用于管理**按键输入过程、密码比对、开锁显示、错误处理等多个步骤**。
FSM 通常包含以下几个组成部分:
- **状态定义State**:用来描述系统当前所处的逻辑阶段。例如:待输入、输入中、校验中、成功、失败等。
- **状态转移条件Transition**:根据输入信号(如按键、定时器、复位)从一个状态跳转到另一个状态。
- **输出控制Output**:每个状态下系统应有的行为,比如更新数码管、检测密码、拉高开锁信号等。
常见的 FSM 类型包括:
- **Moore 状态机:**输出只与当前状态有关,结构更稳定;
- **Mealy 状态机:**输出与当前状态和输入有关,反应更灵敏。
在本例中我们要设计一个状态机去对密码锁进行控制。首先我们应该先给密码锁分一下他会处于什么状态每个状态有什么输出本例中将密码锁设计成下述4个状态
1. SETUP状态该状态下可以设置4位密码输入4位数字后按#键设置密码有效*清空设置数码管输出4位数字输入
2. LOCK状态锁定状态可以输入密码解锁#确定*键清空输入数码管输出4位数字输入
3. ERROR状态如果输入密码错误或者操作错误进入此状态数码管输出ERROR
4. UNLOCK状态解锁状态可以按*重设密码,也可以按#重新锁定数码管输出UNLOCK
然后确定状态之间如何进行转移:
1. SETUP状态输入4位数字后按#键设置密码有效有效后进入LOCK状态
2. LOCK状态输入密码#确定后如果密码正确进入UNLOCK状态如果错误进入ERROR状态
3. ERROR状态按下任意按键后进入LOCK状态
4. UNLOCK状态按下#键进入LOCK状态,按*键进入SETUP状态重设密码
根据上述状态转移逻辑,我们可以画出状态转移图,状态转移图如下图所示:
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:100%"/>
<br> <!--换行-->
图1.状态转移图 <!--标题-->
</center>
</div>
我们已经了解了本次实验所使用的状态机那么如何使用verilog编写状态机呢主要有三种方法分别是三段式状态机二段式状态机一段式状态机。
三段式状态机写法如下:
- 状态机第一段,时序逻辑,非阻塞赋值,传递寄存器的状态。
- 状态机第二段,组合逻辑,阻塞赋值,根据当前状态和当前输入,确定下一个状态机的状态。
- 状态机第三代,时序逻辑,非阻塞赋值,因为是 Mealy 型状态机,根据当前状态和当前输入,确定输出信号。
二段式状态机将三段式状态机二三段糅合在一起,一段式状态机则将三段式状态机三段融合。推荐使用三段式状态机,只有在状态转移逻辑非常简单,状态很少时会采用一段式状态机。
### 1.2.2 数码管
见基础实验3
### 1.2.3 矩阵键盘
见基础实验4
## 1.3 实战演练
### 1.3.1 系统架构
``` verilog
系统框图:
```
### 1.3.2 模块设计
首先是密码锁状态机逻辑,本例采用三段式状态机写法。代码如下:
#### password_lock
```verilog
module password_lock(
input wire clk,
input wire rstn,
input wire [15:0] key_trigger,
output reg [8*8-1:0] assic_seg,
output wire [7:0] seg_point
);
/*
K00 K01 K02 K03 | 1 2 3 A
|
K04 K05 K06 K07 | 4 5 6 B
|
K08 K09 K10 K11 | 7 8 9 C
|
K12 K13 K14 K15 | * 0 # D
*/
/*
密码锁状态机设定:
1. SETUP状态 :设置密码,按*清空输入,按#确认输入进入LOCK状态不足4位#键无效
2. LOCK状态 :锁定状态,按*清空输入,按#确认输入不足4位#键无效密码正确解锁错误则进入ERROR状态
3. ERROR状态 密码错误状态按任意键返回LCOK状态
4. UNLOCK状态解锁状态按*重设密码,按#重新锁定,其余键无效
1-D键为输入
*为清空之前的输入
#为确认输入
*/
wire flag_setup_password;
wire flag_input_pass;
wire flag_input_confirm;
wire flag_error_return;
wire flag_relock;
wire flag_reset;
localparam [2:0] ST_SETUP = 3'b001;
localparam [2:0] ST_LOCK = 3'b010;
localparam [2:0] ST_ERROR = 3'b100;
localparam [2:0] ST_UNLOCK = 3'b101;
reg [2:0] cu_st, nt_st;
reg [4*4-1:0] password, input_password;
reg [2:0] input_num;
assign flag_setup_password = (cu_st == ST_SETUP) && (key_trigger[14]) && (input_num == 3'b100);
assign flag_input_confirm = (cu_st == ST_LOCK) && (key_trigger[14]) && (input_num == 3'b100);
assign flag_input_pass = (cu_st == ST_LOCK) && (password == input_password) && (input_num == 3'b100);
assign flag_error_return = (cu_st == ST_ERROR) && (|key_trigger);
assign flag_relock = (cu_st == ST_UNLOCK) && (key_trigger[14]);
assign flag_reset = (cu_st == ST_UNLOCK) && (key_trigger[12]);
//状态机第一段,传递寄存器状态
always @(posedge clk or negedge rstn) begin
if(~rstn) cu_st <= ST_SETUP;
else cu_st <= nt_st;
end
//状态机第二段,确定下一个状态机状态
always @(*) begin
case(cu_st)
ST_SETUP : nt_st <= (flag_setup_password)?(ST_LOCK):(ST_SETUP);
ST_LOCK : nt_st <= (flag_input_confirm)?((flag_input_pass)?(ST_UNLOCK):(ST_ERROR)):(ST_LOCK);
ST_ERROR : nt_st <= (flag_error_return)?(ST_LOCK):(ST_ERROR);
ST_UNLOCK: nt_st <= (flag_relock)?(ST_LOCK):((flag_reset)?(ST_SETUP):(ST_UNLOCK));
default : nt_st <= ST_SETUP;
endcase
end
//状态机第三段根据状态和输入确定输出这里由于信号较多分了多个always块也可以用case语句写在同一个always块中
always @(posedge clk or negedge rstn) begin
if(~rstn) password <= 0;
else if((cu_st == ST_SETUP) && (input_num != 3'b100)) begin
if(key_trigger[00]) password <= {password[0+:3*4], 4'h1};
else if(key_trigger[01]) password <= {password[0+:3*4], 4'h2};
else if(key_trigger[02]) password <= {password[0+:3*4], 4'h3};
else if(key_trigger[03]) password <= {password[0+:3*4], 4'hA};
else if(key_trigger[04]) password <= {password[0+:3*4], 4'h4};
else if(key_trigger[05]) password <= {password[0+:3*4], 4'h5};
else if(key_trigger[06]) password <= {password[0+:3*4], 4'h6};
else if(key_trigger[07]) password <= {password[0+:3*4], 4'hB};
else if(key_trigger[08]) password <= {password[0+:3*4], 4'h7};
else if(key_trigger[09]) password <= {password[0+:3*4], 4'h8};
else if(key_trigger[10]) password <= {password[0+:3*4], 4'h9};
else if(key_trigger[11]) password <= {password[0+:3*4], 4'hC};
else if(key_trigger[12]) password <= 0;
else if(key_trigger[13]) password <= {password[0+:3*4], 4'h0};
else if(key_trigger[14]) password <= password;
else if(key_trigger[15]) password <= {password[0+:3*4], 4'hD};
else password <= password;
end else password <= password;
end
always @(posedge clk or negedge rstn) begin
if(~rstn) input_password <= 0;
else if(cu_st == ST_LOCK) begin
if(input_num == 3'b100) input_password <= input_password;
else if(key_trigger[00]) input_password <= {input_password[0+:3*4], 4'h1};
else if(key_trigger[01]) input_password <= {input_password[0+:3*4], 4'h2};
else if(key_trigger[02]) input_password <= {input_password[0+:3*4], 4'h3};
else if(key_trigger[03]) input_password <= {input_password[0+:3*4], 4'hA};
else if(key_trigger[04]) input_password <= {input_password[0+:3*4], 4'h4};
else if(key_trigger[05]) input_password <= {input_password[0+:3*4], 4'h5};
else if(key_trigger[06]) input_password <= {input_password[0+:3*4], 4'h6};
else if(key_trigger[07]) input_password <= {input_password[0+:3*4], 4'hB};
else if(key_trigger[08]) input_password <= {input_password[0+:3*4], 4'h7};
else if(key_trigger[09]) input_password <= {input_password[0+:3*4], 4'h8};
else if(key_trigger[10]) input_password <= {input_password[0+:3*4], 4'h9};
else if(key_trigger[11]) input_password <= {input_password[0+:3*4], 4'hC};
else if(key_trigger[12]) input_password <= 0;
else if(key_trigger[13]) input_password <= {input_password[0+:3*4], 4'h0};
else if(key_trigger[14]) input_password <= input_password;
else if(key_trigger[15]) input_password <= {input_password[0+:3*4], 4'hD};
else input_password <= input_password;
end else input_password <= 0;
end
always @(posedge clk or negedge rstn) begin
if(~rstn) input_num <= 0;
else if(cu_st == ST_SETUP || cu_st == ST_LOCK) begin
if(flag_setup_password || flag_input_confirm) input_num <= 0;
else if(key_trigger[00] || key_trigger[01] || key_trigger[02] || key_trigger[03] ||
key_trigger[04] || key_trigger[05] || key_trigger[06] || key_trigger[07] ||
key_trigger[08] || key_trigger[09] || key_trigger[10] || key_trigger[11] ||
key_trigger[13] || key_trigger[15])
input_num <= (input_num < 3'b100)?(input_num + 1):(input_num);
else if(key_trigger[12]) input_num <= 0;
else input_num <= input_num;
end else input_num <= 0;
end
assign seg_point = 8'b0;
always @(posedge clk or negedge rstn) begin
if(~rstn) assic_seg <= "12345678";
else case(cu_st)
ST_SETUP :begin
assic_seg[0+:8] <= "-";
assic_seg[8+:8] <= "-";
assic_seg[16+:8] <= (input_num > 0)?(hex2assic(password[0+:4])):("_");
assic_seg[24+:8] <= (input_num > 1)?(hex2assic(password[4+:4])):("_");
assic_seg[32+:8] <= (input_num > 2)?(hex2assic(password[8+:4])):("_");
assic_seg[40+:8] <= (input_num > 3)?(hex2assic(password[12+:4])):("_");
assic_seg[48+:8] <= "-";
assic_seg[56+:8] <= "-";
end
ST_LOCK :begin
assic_seg[0+:8] <= "=";
assic_seg[8+:8] <= "=";
assic_seg[16+:8] <= (input_num > 0)?(hex2assic(input_password[0+:4])):("-");
assic_seg[24+:8] <= (input_num > 1)?(hex2assic(input_password[4+:4])):("-");
assic_seg[32+:8] <= (input_num > 2)?(hex2assic(input_password[8+:4])):("-");
assic_seg[40+:8] <= (input_num > 3)?(hex2assic(input_password[12+:4])):("-");
assic_seg[48+:8] <= "=";
assic_seg[56+:8] <= "=";
end
ST_ERROR : assic_seg <= " ERROR ";
ST_UNLOCK: assic_seg <= " unlock ";
default : assic_seg <= "12345678";
endcase
end
function [7:0] hex2assic;
input [3:0] hex;
case(hex)
4'h0: hex2assic = "0"; // 0
4'h1: hex2assic = "1"; // 1
4'h2: hex2assic = "2"; // 2
4'h3: hex2assic = "3"; // 3
4'h4: hex2assic = "4"; // 4
4'h5: hex2assic = "5"; // 5
4'h6: hex2assic = "6"; // 6
4'h7: hex2assic = "7"; // 7
4'h8: hex2assic = "8"; // 8
4'h9: hex2assic = "9"; // 9
4'hA: hex2assic = "A"; // A
4'hB: hex2assic = "B"; // B
4'hC: hex2assic = "C"; // C
4'hD: hex2assic = "D"; // D
4'hE: hex2assic = "E"; // E
4'hF: hex2assic = "F"; // F
default: hex2assic = " ";
endcase
endfunction
endmodule //password_lock
```
矩阵键盘行扫描模块在前面基础实验已经介绍过,但这次实验还需要为矩阵键盘添加按键上升沿检测模块,代码如下:
#### matrix_key_trigger
```verilog
module matrix_key_trigger(
input wire clk,
input wire rstn,
input wire [15:0] key,
output wire [15:0] key_trigger
);
// 按键上升沿捕获模块
reg [15:0] key_d; // 上一时钟周期的按键状态
reg [15:0] key_d2; // 上两时钟周期的按键状态
assign key_trigger = (key_d) & (~key_d2);
always @(posedge clk or negedge rstn) begin
if (!rstn) begin
key_d <= 0;
key_d2 <= 0;
end else begin
key_d <= key;
key_d2 <= key_d;
end
end
endmodule //matrix_key_decode
```
至于数码管模块为了方便在led_display_driver模块添加了参数定义并未进行其他修改。
最后将几个模块例化在顶层,将端口相连接,代码如下所示:
#### password_lock_top
```verilog
module password_lock_top #(
parameter VALID_SIGNAL = 1'b0,
parameter CLK_CYCLE = 5000
)(
//system io
input wire external_clk ,
input wire external_rstn,
output wire [7:0] led_display_seg,
output wire [7:0] led_display_sel,
input wire [3:0] col,
output wire [3:0] row
);
wire [15:0] key_out;
wire [15:0] key_trigger;
wire [8*8-1:0] assic_seg;
wire [7:0] seg_point;
led_display_driver #(
.VALID_SIGNAL (VALID_SIGNAL),
.CLK_CYCLE (CLK_CYCLE)
)u_led_display_driver(
.clk ( external_clk ),
.rstn ( external_rstn ),
.assic_seg ( assic_seg ),
.seg_point ( seg_point ),
.led_display_seg ( led_display_seg ),
.led_display_sel ( led_display_sel )
);
matrix_key #(
.ROW_NUM ( 4 ),
.COL_NUM ( 4 ),
.DEBOUNCE_TIME ( 10000 ),
.DELAY_TIME ( 2000 ))
u_matrix_key(
.clk ( external_clk ),
.rstn ( external_rstn ),
.row ( row ),
.col ( col ),
.key_out ( key_out )
);
matrix_key_trigger u_matrix_key_trigger(
.clk ( external_clk ),
.rstn ( external_rstn),
.key ( key_out ),
.key_trigger ( key_trigger )
);
password_lock u_password_lock(
.clk ( external_clk ),
.rstn ( external_rstn),
.key_trigger ( key_trigger ),
.assic_seg ( assic_seg ),
.seg_point ( seg_point )
);
endmodule //led_diaplay_top
```
### 1.3.3 上板验证步骤
---
可以直接将矩阵键盘,数码管的管脚约束文件中的约束复制到本次实验的管脚约束文件中。
将生成的sbit文件烧录好后即可使用网页界面的虚拟按键进行使用。
## 1.4 章末总结
本章通过设计一个简易密码锁系统,综合运用了前面基础实验中学习的**矩阵键盘扫描**、**数码管显示**等知识,并引入了**有限状态机FSM**的设计方法,完成了一个具有较强工程实用性的综合实验。
通过本实验,你应该掌握了以下几点核心能力:
- 理解并运用 状态机进行系统流程控制;
- 将多个功能模块(键盘、数码管、比较器)整合为一个完整系统;
- 设计基于状态的控制逻辑,实现密码输入、校验、反馈显示等功能;
- 理解数字电路系统中控制与数据路径的分离思想。
密码锁系统虽然逻辑简单,但已经具备了完整嵌入式控制系统的基本结构,是后续更复杂项目设计的重要基础。
## 1.5 拓展训练
为了进一步加深对本实验内容的理解,并锻炼系统设计与工程实现能力,你可以尝试完成以下拓展任务:
1. **增加防爆破机制**限定密码错误尝试次数例如连续三次错误后锁定一段时间并在数码管上提示“Err”。
2. **利用按键实现简易菜单系统**拓展状态机结构,允许通过矩阵键盘导航菜单,如“输入密码”、“查看状态”、“设置新密码”等。

BIN
public/doc/11/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

736
public/doc/12/doc.md Normal file

File diff suppressed because one or more lines are too long

BIN
public/doc/12/images/1.jfif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
public/doc/12/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
public/doc/12/images/3.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

BIN
public/doc/12/images/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 KiB

BIN
public/doc/12/images/5.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

BIN
public/doc/12/images/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

BIN
public/doc/12/images/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 MiB

BIN
public/doc/12/images/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

BIN
public/doc/13/cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 KiB

350
public/doc/13/doc.md Normal file
View File

@@ -0,0 +1,350 @@
# 进阶-3-频率计
## 3.1 章节导读
本实验将基于实验平台设计并实现一个简易频率计用于测量输入信号的频率值并通过数码管进行实时显示。实验核心是掌握ADC模块的使用方法被测信号频率的获取方法及其在数字系统中的处理流程。
## 3.2 理论学习
### 3.2.1 ADC模块
实验平台有一块8bit高速ADDA模块其中ADC模块使用AD9280芯片支持最高32MSPS的速率模拟电压输入范围为-5~+5VADC模块可以根据输入电压的大小将其转换为0~2552的8次方的数值。模块有一个clk管脚和8个data管脚data的输入速率和驱动时钟有关给clk管脚的驱动时钟越快采样率越高data的输入速率越高。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/1.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图1.ADDA模块示意图 <!--标题-->
</center>
</div>
### 3.2.2 数码管模块
数码管模块在前面基础实验3已经介绍过这里不再赘述。
## 3.3 实战演练
### 3.3.1实验目标
能够驱动板载ADC模块对ADC模块的输入数据进行测试计算输入信号的频率值并在数码管模块中显示。
### 3.3.2硬件资源
实验所需的信号源来自我们的实验平台实验平台集成一个以FPGA为基础的dds信号发生器该dds信号发生器可以输出频率可调的方波正弦波三角波锯齿波等用户可以在web平台使用并且改变输出波形和频率。
<div> <!--块级封装-->
<center> <!--将图片和文字居中-->
<img src="./images/2.png"
alt="无法显示图片时显示的文字"
style="zoom:30%"/>
<br> <!--换行-->
图2.ADDA实验示意图 <!--标题-->
</center>
</div>
用户接收到信号源之后需自行设计逻辑处理数据并显示。
### 3.3.3程序设计
#### pulse_gen.v
首先用户接收到的是8bit波形数据要直接利用波形数据计算频率不是很方便计算频率数据我们只需要计算其脉冲的个数即可所以我们设计一个模块通过设计一个脉冲阈值trig_level高于阈值的就计算为一次脉冲输出一个周期的高电平方便后续模块计数模块代码如下
```verilog
module pulse_gen(
input rstn, //系统复位,低电平有效
input [7:0] trig_level,
input ad_clk, //AD9280驱动时钟
input [7:0] ad_data, //AD输入数据
output ad_pulse //输出的脉冲信号
);
//因为可能会有抖动,设置一个范围值避免反复触发
parameter THR_DATA = 3;
//reg define
reg pulse;
reg pulse_delay;
//*****************************************************
//** main code
//*****************************************************
assign ad_pulse = pulse & pulse_delay;
//根据触发电平将输入的AD采样值转换成高低电平
always @ (posedge ad_clk or negedge rstn)begin
if(!rstn)
pulse <= 1'b0;
else begin
if((trig_level >= THR_DATA) && (ad_data < trig_level - THR_DATA))
pulse <= 1'b0;
else if(ad_data > trig_level + THR_DATA)
pulse <= 1'b1;
end
end
//延时一个时钟周期,用于消除抖动
always @ (posedge ad_clk or negedge rstn)begin
if(!rstn)
pulse_delay <= 1'b0;
else
pulse_delay <= pulse;
end
endmodule
```
#### cymometer.v
下面根据pulse_gen信号生成的脉冲数据进行计数计算其频率。我们这里采用门控时钟法`clk_fs`(参考时钟)作为时间基准,测量 `clk_fx`(被测信号)的频率。
门控时钟法的原理很简单,也就是在一个**固定时间窗内**(即门控时间 `GATE_TIME`**计数被测时钟 clk_fx 的上升沿次数**,再结合参考时钟 `clk_fs` 的计数值,就可以算出频率:
$$
\text{频率} = \frac{\text{被测脉冲数量}}{\text{门控时间(秒)}} = \frac{fx\_cnt}{fs\_cnt / \text{CLK\_FS}} = \frac{\text{CLK\_FS} \times fx\_cnt}{fs\_cnt}
$$
| 步骤 | 描述 |
| ---- | ------------------------------------------------------------ |
| **1** | 使用 `clk_fx` 作为计数时钟,控制一个门控时间 `gate` 信号 |
| **2** | 当 `gate` 为高电平时,`fx_cnt_temp` 开始统计 `clk_fx` 的脉冲个数 |
| **3** | 同时将 `gate` 同步到参考时钟 `clk_fs`,并计数 `fs_cnt_temp`,记录 `gate` 高电平持续期间 `clk_fs` 的个数 |
| **4** | 一旦 `gate` 下降沿到来(通过打拍检测),将计数值冻结到 `fx_cnt``fs_cnt` 中 |
| **5** | 最后用上述表达式计算频率输出。 |
代码设计如下:
```verilog
module cymometer
#(parameter CLK_FS = 26'd50_000_000) // 基准时钟频率值
( //system clock
input clk_fs , // 基准时钟信号
input rstn , // 复位信号
//cymometer interface
input clk_fx , // 被测时钟信号
output reg [19:0] data_fx // 被测时钟频率输出
);
//parameter define
localparam MAX = 30; // 定义fs_cnt、fx_cnt的最大位宽
localparam GATE_TIME = 16'd2_000; // 门控时间设置
//reg define
reg gate ; // 门控信号
reg gate_fs ; // 同步到基准时钟的门控信号
reg gate_fs_r ; // 用于同步gate信号的寄存器
reg gate_fs_d0 ; // 用于采集基准时钟下gate下降沿
reg gate_fs_d1 ; //
reg gate_fx_d0 ; // 用于采集被测时钟下gate下降沿
reg gate_fx_d1 ; //
reg [ 58:0] data_fx_t ; //
reg [ 15:0] gate_cnt ; // 门控计数
reg [MAX-1:0] fs_cnt ; // 门控时间内基准时钟的计数值
reg [MAX-1:0] fs_cnt_temp ; // fs_cnt 临时值
reg [MAX-1:0] fx_cnt ; // 门控时间内被测时钟的计数值
reg [MAX-1:0] fx_cnt_temp ; // fx_cnt 临时值
//wire define
wire neg_gate_fs; // 基准时钟下门控信号下降沿
wire neg_gate_fx; // 被测时钟下门控信号下降沿
//*****************************************************
//** main code
//*****************************************************
//边沿检测,捕获信号下降沿
assign neg_gate_fs = gate_fs_d1 & (~gate_fs_d0);
assign neg_gate_fx = gate_fx_d1 & (~gate_fx_d0);
//门控信号计数器,使用被测时钟计数
always @(posedge clk_fx or negedge rstn) begin
if(!rstn)
gate_cnt <= 16'd0;
else if(gate_cnt == GATE_TIME + 5'd20)
gate_cnt <= 16'd0;
else
gate_cnt <= gate_cnt + 1'b1;
end
//门控信号拉高时间为GATE_TIME个实测时钟周期
always @(posedge clk_fx or negedge rstn) begin
if(!rstn)
gate <= 1'b0;
else if(gate_cnt < 4'd10)
gate <= 1'b0;
else if(gate_cnt < GATE_TIME + 4'd10)
gate <= 1'b1;
else if(gate_cnt <= GATE_TIME + 5'd20)
gate <= 1'b0;
else
gate <= 1'b0;
end
//将门控信号同步到基准时钟下
always @(posedge clk_fs or negedge rstn) begin
if(!rstn) begin
gate_fs_r <= 1'b0;
gate_fs <= 1'b0;
end
else begin
gate_fs_r <= gate;
gate_fs <= gate_fs_r;
end
end
//打拍采门控信号的下降沿(被测时钟下)
always @(posedge clk_fx or negedge rstn) begin
if(!rstn) begin
gate_fx_d0 <= 1'b0;
gate_fx_d1 <= 1'b0;
end
else begin
gate_fx_d0 <= gate;
gate_fx_d1 <= gate_fx_d0;
end
end
//打拍采门控信号的下降沿(基准时钟下)
always @(posedge clk_fs or negedge rstn) begin
if(!rstn) begin
gate_fs_d0 <= 1'b0;
gate_fs_d1 <= 1'b0;
end
else begin
gate_fs_d0 <= gate_fs;
gate_fs_d1 <= gate_fs_d0;
end
end
//门控时间内对被测时钟计数
always @(posedge clk_fx or negedge rstn) begin
if(!rstn) begin
fx_cnt_temp <= 32'd0;
fx_cnt <= 32'd0;
end
else if(gate)
fx_cnt_temp <= fx_cnt_temp + 1'b1;
else if(neg_gate_fx) begin
fx_cnt_temp <= 32'd0;
fx_cnt <= fx_cnt_temp;
end
end
//门控时间内对基准时钟计数
always @(posedge clk_fs or negedge rstn) begin
if(!rstn) begin
fs_cnt_temp <= 32'd0;
fs_cnt <= 32'd0;
end
else if(gate_fs)
fs_cnt_temp <= fs_cnt_temp + 1'b1;
else if(neg_gate_fs) begin
fs_cnt_temp <= 32'd0;
fs_cnt <= fs_cnt_temp;
end
end
//计算被测信号频率
always @(posedge clk_fs or negedge rstn) begin
if(!rstn) begin
data_fx_t <= 1'b0;
end
else if(gate_fs == 1'b0)
data_fx_t <= CLK_FS * fx_cnt ;
end
always @(posedge clk_fs or negedge rstn) begin
if(!rstn) begin
data_fx <= 20'd0;
end
else if(gate_fs == 1'b0)
data_fx <= data_fx_t / fs_cnt ;
end
endmodule
```
#### frequency_meter.v
由于之前基础实验设计过数码管显示模块本次实验不在赘述但因为数码管模块是输入ascii码进行显示的而现在输出频率数据是一个20bit的二进制数所以我们应该先想办法将二进制转成ascii码再连接数码管模块进行显示。BCD转ascii码通过查表的方式即可完成。但二进制转BCD码的算法不是特别简单之后会在基础实验部分讲解。
顶层模块代码如下:
```verilog
module frequency_meter(
input clk,
input rstn, // 复位信号
output ad_clk, // AD时钟
input [7:0] ad_data, // AD输入数据
output [7:0] led_display_seg,
output wire [7:0] led_display_sel
);
wire ad_pulse;
wire [19:0] data_fx;
wire [25:0] bcd;
wire [31:0] data_bcd;
wire [63:0] asciidata;
assign data_bcd = {6'b00,bcd};
//生成ad驱动时钟由于使用杜邦线连接ad_clk不要超过10M
PLL PLLinst(
.clkout0(ad_clk), // output 10M
.lock(),
.clkin1(clk) // input
);
pulse_gen pulse_gen_inst (
.rstn(rstn),
.trig_level(8'd128),
.ad_clk(ad_clk),
.ad_data(ad_data),
.ad_pulse(ad_pulse)
);
cymometer # (
.CLK_FS(32'd27_000_000)
)
cymometer_inst (
.clk_fs(clk),
.rstn(rstn),
.clk_fx(ad_pulse),
.data_fx(data_fx)
);
//二进制转bcd码模块
bin2bcd # (
.W(20)
)
bin2bcd_inst (
.bin(data_fx),
.bcd(bcd)
);
//4位BCD码转ascii模块例化8次使8个bcd同时输出ascii
genvar i;
generate
for (i = 0; i < 8; i = i + 1) begin : generate_module
bcd2ascii bcd2ascii_inst (
.bcd(data_bcd[i*4 +:4]),
.asciidata(asciidata[i*8 +: 8])
);
end
endgenerate
//数码管显示模块
led_display_driver led_display_driver_inst (
.clk(clk),
.rstn(rstn),
.assic_seg(asciidata),
.seg_point(8'b00000000),
.led_display_seg(led_display_seg),
.led_display_sel(led_display_sel)
);
endmodule
```
### 3.3.4仿真验证
### 3.3.5上板验证
## 3.4 章末总结

BIN
public/doc/13/images/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

BIN
public/doc/13/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
public/doc/13/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

3
server.test/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
bin
obj
bitstream

61
server.test/CommonTest.cs Normal file
View File

@@ -0,0 +1,61 @@
using System.Buffers.Binary;
using Common;
namespace server.test;
public class CommonTest
{
[Fact]
public void ReverseBytesTest()
{
var rnd = new Random();
var bytesLen = 8;
var bytesArray = new byte[bytesLen];
rnd.NextBytes(bytesArray);
var rev2Bytes = new byte[] {
bytesArray[1],
bytesArray[0],
bytesArray[3],
bytesArray[2],
bytesArray[5],
bytesArray[4],
bytesArray[7],
bytesArray[6],
};
Assert.Equal(Number.ReverseBytes(bytesArray, 2).Value, rev2Bytes);
var rev4Bytes = new byte[] {
bytesArray[3],
bytesArray[2],
bytesArray[1],
bytesArray[0],
bytesArray[7],
bytesArray[6],
bytesArray[5],
bytesArray[4],
};
Assert.Equal(Number.ReverseBytes(bytesArray, 4).Value, rev4Bytes);
}
[Fact]
public void ToBitTest()
{
Assert.Equal(true, Number.ToBit(0xFF, 3).Value);
Assert.Equal(false, Number.ToBit(0x00, 3).Value);
Assert.Equal(true, Number.ToBit(0xAA, 3).Value);
Assert.Equal(false, Number.ToBit(0xAA, 2).Value);
}
[Fact]
public void ReverseBits()
{
Assert.Equal((byte)0x05, Common.Number.ReverseBits((byte)0xA0));
var bytesSrc = new byte[] { 0xAB, 0x00, 0x00, 0x01 };
var bytes = new byte[4];
for (int i = 0; i < 4; i++)
bytes[i] = Common.Number.ReverseBits(bytesSrc[i]);
Assert.Equal(new byte[] { 0xD5, 0x00, 0x00, 0x80 }, bytes);
}
}

View File

@@ -0,0 +1,138 @@
using System.Net;
using System.Text;
using Common;
using Xunit.Abstractions;
namespace server.test;
public class UDPServerTest
{
const string address = "127.0.0.1";
const int port = 33000;
private static readonly UDPServer udpServer = new UDPServer(port);
private readonly ITestOutputHelper output;
public UDPServerTest(ITestOutputHelper output)
{
this.output = output;
udpServer.Start();
}
[Fact]
public void UDPDataDeepClone()
{
var udpData = new UDPData()
{
DateTime = DateTime.Now,
Address = "127.0.0.1",
Port = 1234,
Data = new byte[] { 0xf0, 00, 00, 00 },
HasRead = false
};
var cloneUdpData = udpData.DeepClone();
Assert.Equal(udpData.DateTime, cloneUdpData.DateTime);
Assert.Equal(udpData.Address, cloneUdpData.Address);
Assert.Equal(udpData.Port, cloneUdpData.Port);
Assert.Equal(udpData.Data, cloneUdpData.Data);
Assert.Equal(udpData.HasRead, cloneUdpData.HasRead);
udpData.DateTime = DateTime.Now;
udpData.Address = "192.168.1.1";
udpData.Port = 33000;
udpData.Data = new byte[] { 0xFF, 00, 00, 00 };
udpData.HasRead = true;
Assert.NotNull(cloneUdpData.DateTime);
Assert.NotNull(cloneUdpData.Address);
Assert.NotNull(cloneUdpData.Port);
Assert.NotNull(cloneUdpData.Data);
Assert.NotNull(cloneUdpData.HasRead);
Assert.NotEqual(udpData.DateTime, cloneUdpData.DateTime);
Assert.NotEqual(udpData.Address, cloneUdpData.Address);
Assert.NotEqual(udpData.Port, cloneUdpData.Port);
Assert.NotEqual(udpData.Data, cloneUdpData.Data);
Assert.NotEqual(udpData.HasRead, cloneUdpData.HasRead);
}
[Theory]
[InlineData(new object[] { new string[] { "Hello World!", "Hello Server!", "What is your problem?" } })]
public async Task UDPServerFindString(string[] textArray)
{
Assert.True(udpServer.IsRunning);
var serverEP = new IPEndPoint(IPAddress.Parse(address), port);
foreach (var text in textArray)
{
Assert.True(await UDPClientPool.SendStringAsync(serverEP, [text]));
var ret = await udpServer.FindDataAsync(address);
Assert.True(ret.HasValue);
var data = ret.Value;
Assert.Equal(address, data.Address);
Assert.Equal(text, Encoding.ASCII.GetString(data.Data));
}
}
[Theory]
[InlineData(new object[] { new UInt32[] { 0xF0_00_00_00, 0xFF_00_00_00, 0xFF_FF_FF_FF } })]
public async Task UDPServerFindBytes(UInt32[] bytesArray)
{
Assert.True(udpServer.IsRunning);
var serverEP = new IPEndPoint(IPAddress.Parse(address), port);
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 4).Value));
var ret = await udpServer.FindDataAsync(address);
Assert.True(ret.HasValue);
var data = ret.Value;
Assert.Equal(address, data.Address);
Assert.Equal(number, Number.BytesToUInt32(data.Data).Value);
}
}
[Theory]
[InlineData(new object[] { new UInt32[] { 0xF0_00_00_00, 0xF0_01_00_00 } })]
public async Task UDPServerWaitResp(UInt32[] bytesArray)
{
Assert.True(udpServer.IsRunning);
var serverEP = new IPEndPoint(IPAddress.Parse(address), port);
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 4).Value));
var ret = await udpServer.WaitForAckAsync(address);
Assert.True(ret.IsSuccessful);
var data = ret.Value;
Assert.True(data.IsSuccessful);
Assert.Equal(number, Number.BytesToUInt32(data.ToBytes()).Value);
}
}
[Theory]
[InlineData(new object[] { new UInt64[] { 0x0F_00_00_00_01_02_02_02, 0x0F_01_00_00_FF_FF_FF_FF } })]
public async Task UDPServerWaitData(UInt64[] bytesArray)
{
Assert.True(udpServer.IsRunning);
var serverEP = new IPEndPoint(IPAddress.Parse(address), port);
foreach (var number in bytesArray)
{
Assert.True(await UDPClientPool.SendBytesAsync(serverEP, Number.NumberToBytes(number, 8).Value));
var ret = await udpServer.WaitForDataAsync(address);
Assert.True(ret.IsSuccessful);
var data = ret.Value;
Assert.True(data.IsSuccessful);
Assert.Equal((UInt64)number, Number.BytesToUInt64(data.ToBytes()).Value);
}
}
}

View File

@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.4" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\server\server.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
{
"showLiveOutput": true
}

2
server/.gitignore vendored
View File

@@ -1,3 +1,5 @@
obj
bin
bitstream
bsdl

View File

@@ -1,41 +1,151 @@
using System.Net;
using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.FileProviders;
using Newtonsoft.Json;
using NLog;
using NLog.Web;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
// Early init of NLog to allow startup and exception logging, before host is built
var logger = NLog.LogManager.Setup()
.LoadConfigurationFromAppSettings()
.GetCurrentClassLogger();
logger.Debug("Init Main...");
try
{
c.SwaggerDoc("v1", new OpenApiInfo
var builder = WebApplication.CreateBuilder(args);
// Services Settings
// Add services to the container.
// builder.Services.AddControllersWithViews();
// NLog: Setup NLog for Dependency injection
builder.Logging.ClearProviders();
builder.Host.UseNLog();
builder.Services.AddEndpointsApiExplorer();
builder.Services.Configure<FormOptions>(options =>
{
options.MultipartBodyLengthLimit = 32 * 1024 * 1024;
});
// Add Json.Net Serializer
builder.Services.AddControllersWithViews().AddNewtonsoftJson(options =>
{
// Configure Newtonsoft.Json options here
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
});
// Add CORS policy
if (builder.Environment.IsDevelopment())
{
builder.Services.AddCors(options =>
{
options.AddPolicy("Development", policy => policy
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader()
);
});
}
builder.Services.AddCors(options =>
{
options.AddPolicy("Users", policy => policy
.AllowAnyOrigin()
.AllowAnyHeader()
);
});
// Add Swagger
builder.Services.AddControllers();
builder.Services.AddOpenApiDocument(options =>
{
options.PostProcess = document =>
{
document.Info = new NSwag.OpenApiInfo
{
Version = "v1",
Title = "FPGA Web Lab API",
Description = "Use FPGA in the cloud",
Version = "v1"
// TermsOfService = "https://example.com/terms",
// Contact = new NSwag.OpenApiContact
// {
// Name = "Example Contact",
// Url = "https://example.com/contact"
// },
// License = new NSwag.OpenApiLicense
// {
// Name = "Example License",
// Url = "https://example.com/license"
// }
};
};
});
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c =>
// Application Settings
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "FPAG WebLab API V1");
// app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
// Serve static files
logger.Info($"Use Static Files : {Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")}");
app.UseDefaultFiles();
app.UseStaticFiles(); // Serves files from wwwroot by default
// Assets Files
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "assets")),
RequestPath = "/assets"
});
// Log Files
if (!Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "log")))
{
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "log"));
}
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "log")),
RequestPath = "/log"
});
app.MapFallbackToFile("index.html");
}
// Add logs
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors();
app.UseAuthorization();
// Swagger
app.UseOpenApi();
app.UseSwaggerUi();
// Router
app.MapControllers();
// Setup Program
MsgBus.Init();
app.Run();
}
catch (Exception exception)
{
// NLog: catch setup errors
logger.Error(exception, "Stopped program because of exception");
throw;
}
finally
{
// Close UDP Server
logger.Info("Program is Closing now...");
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
NLog.LogManager.Shutdown();
// Close Program
MsgBus.Exit();
}
// Setup UDP Server
var udpServer = new UDPServer(33000);
udpServer.Start();
// Router
app.MapGet("/", () => "Hello World!");
app.MapPut("/api/SendString", Router.API.SendString);
app.MapPut("/api/SendAddrPackage", Router.API.SendAddrPackage);
app.MapPut("/api/SendDataPackage", Router.API.SendDataPackage);
app.Run("http://localhost:5000");
// Close UDP Server
Console.WriteLine("UDP Server is Closing now...");
udpServer.Stop();

View File

@@ -5,18 +5,20 @@
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5188",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7070;http://localhost:5188",
"applicationUrl": "https://localhost:7278;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.SpaProxy"
}
}
}

28
server/PublishAllRids.xml Normal file
View File

@@ -0,0 +1,28 @@
<Project DefaultTargets="Build">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<!-- Enable roll-forward to latest patch. This allows one restore operation
to apply to all of the self-contained publish operations. -->
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<Target Name="PublishAllRids">
<ItemGroup>
<!-- Transform RuntimeIdentifiers property to item -->
<RuntimeIdentifierForPublish Include="$(RuntimeIdentifiers)" />
<!-- Transform RuntimeIdentifierForPublish items to project items to pass to MSBuild task -->
<ProjectToPublish Include="@(RuntimeIdentifierForPublish->'$(MSBuildProjectFullPath)')">
<AdditionalProperties>RuntimeIdentifier=%(RuntimeIdentifierForPublish.Identity)</AdditionalProperties>
</ProjectToPublish>
</ItemGroup>
<MSBuild Projects="@(ProjectToPublish)"
Targets="Publish"
BuildInParallel="true"
/>
</Target>
</Project>

View File

@@ -2,8 +2,79 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"NLog": {
"RemoveLoggerFactoryFilter": true
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"NLog": {
"extensions": [
{
"assembly": "NLog.Web.AspNetCore"
}
],
"throwConfigExceptions": true,
"targets": {
"async": true,
"AllFile": {
"type": "File",
"fileName": "./log/all-${shortdate}.log"
},
"WebAllFile": {
"type": "File",
"fileName": "./log/web-all-${shortdate}.log"
},
"EachFile": {
"type": "File",
"fileName": "./log/${logger}-${shortdate}.log"
},
"Console": {
"type": "ColoredConsole"
}
},
"rules": [
{
"logger": "*",
"finalMinLevel": "Trace",
"writeTo": "AllFile"
},
{
"logger": "*",
"finalMinLevel": "Trace",
"writeTo": "WebAllFile"
},
{
"logger": "System.*",
"finalMinLevel": "Warn"
},
{
"logger": "Microsoft.*",
"finalMinLevel": "Warn"
},
{
"logger": "Microsoft.Hosting.Lifetime*",
"finalMinLevel": "Info",
"writeTo": "Console"
},
{
"logger": "server",
"finalMinLevel": "Trace",
"writeTo": "EachFile"
},
{
"logger": "server.*",
"finalMinLevel": "Trace",
"writeTo": "EachFile"
},
{
"logger": "server.*",
"finalMinLevel": "Debug",
"writeTo": "Console"
}
]
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="PublishAllRids.xml" />
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RuntimeIdentifiers>win-x64;linux-x64;</RuntimeIdentifiers>
<PublishSingleFile>true</PublishSingleFile>
<SpaRoot>../</SpaRoot>
<SpaProxyServerUrl>http://localhost:5173</SpaProxyServerUrl>
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNext" Version="5.19.1" />
<PackageReference Include="DotNext.Threading" Version="5.19.1" />
<PackageReference Include="Honoo.IO.Hashing.Crc" Version="1.3.3" />
<PackageReference Include="linq2db.AspNet" Version="5.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="9.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SpaProxy" Version="9.0.4" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.23" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.3.0" />
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
</ItemGroup>
</Project>

193
server/src/BsdlParser.cs Normal file
View File

@@ -0,0 +1,193 @@
using DotNext;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace BsdlParser;
/// <summary>
/// [TODO:description]
/// </summary>
public class BoundaryScanRegs
{
/// <summary>
/// [TODO:description]
/// </summary>
public class CellEntry
{
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("cell_number")]
[JsonRequired]
public int CellNumber { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("cell_name")]
[JsonRequired]
public string CellName { get; set; } = "UnknownCellName";
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("port_id")]
public string? PortID { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("function")]
[JsonRequired]
public string? Function { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("safe_bit")]
[JsonRequired]
public string? SafeBit { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("ccell")]
public string? CCell { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("disabel_value")]
public string? DisableValue { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("disabel_result")]
public string? DisableResult { get; set; }
}
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("register_length")]
[JsonRequired]
public int RegisterLength { get; set; }
/// <summary>
/// [TODO:description]
/// </summary>
[JsonProperty("registers")]
[JsonRequired]
public CellEntry[] Registers { get; set; } = new CellEntry[] { };
}
/// <summary>
/// [TODO:description]
/// </summary>
public class Parser
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private const string BOUNDARY_REGS_DESP = "boundary_registers.json";
/// <summary>
/// [TODO:description]
/// </summary>
public JObject BoundaryRegsDesp { get; }
/// <summary>
/// [TODO:description]
/// </summary>
/// <returns>[TODO:return]</returns>
public Parser()
{
var filePath = Path.Combine(Environment.CurrentDirectory, BOUNDARY_REGS_DESP);
if (!Path.Exists(filePath))
throw new Exception($"Counld not find boundary_registers.json in {filePath}");
this.BoundaryRegsDesp = JObject.Parse(File.ReadAllText(filePath));
}
/// <summary>
/// [TODO:description]
/// </summary>
public Optional<int> GetBoundaryRegsNum()
{
var ret = this.BoundaryRegsDesp["register_length"];
if (ret is null) return new();
return Convert.ToInt32(ret);
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <returns>[TODO:return]</returns>
public Optional<List<BoundaryScanRegs.CellEntry>> GetBoundaryPorts()
{
var registers = this.BoundaryRegsDesp["registers"]?.ToList();
if (registers is null) return new();
var cellList = new List<BoundaryScanRegs.CellEntry>();
foreach (var item in registers)
{
var cell = item.ToObject<BoundaryScanRegs.CellEntry>();
if (cell is null) return new();
cellList.Add(cell);
}
return cellList;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <returns>[TODO:return]</returns>
public Optional<List<BoundaryScanRegs.CellEntry>> GetBoundaryLogicalPorts()
{
var registers = this.BoundaryRegsDesp["registers"]?.ToList().Where((item) =>
{
return item["port_id"] is not null;
});
if (registers is null) return new();
var cellList = new List<BoundaryScanRegs.CellEntry>();
foreach (var item in registers)
{
var cell = item.ToObject<BoundaryScanRegs.CellEntry>();
if (cell is null) return new();
cellList.Add(cell);
}
return cellList;
}
// public Result<string> GetLogicalPorts()
// {
// using (Py.GIL())
// {
// using (PyModule scope = Py.CreateScope())
// {
// string code = $@"
// bsdl_parser = BsdlParser({this.filePath})
// result = json.dumps(bsdl_parser.GetLogicPortDesp(), indent=2)
// ";
//
// var localVariables = new PyDict();
// scope.Exec(code, localVariables);
// if (!localVariables.HasKey("result"))
// return new(new Exception($"PythonNet doesn't has result from dict: {localVariables}"));
//
// var result = localVariables.GetItem("result");
// if (result is null)
// return new(new Exception($"PythonNet get null from dict: {localVariables}"));
//
// var resultString = result.ToString();
// if (resultString is null)
// return new(new Exception($"Pythonnet convert PyObject to string failed :{result}"));
// return resultString;
// }
// }
// }
}

View File

@@ -1,22 +1,68 @@
using System.Collections;
using DotNext;
namespace Common
{
class NumberProcessor
/// <summary>
/// 数字处理工具
/// </summary>
public class Number
{
public static Result<byte[]> NumberToBytes(ulong num, uint length, bool isRightHigh = false)
private static readonly byte[] BitReverseTable = new byte[] {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
/// <summary>
/// 整数转成二进制字节数组
/// </summary>
/// <param name="num">整数</param>
/// <param name="length">整数长度</param>
/// <param name="isLowNumHigh">是否高位在数组索引低</param>
/// <returns>二进制字节数组</returns>
public static Result<byte[]> NumberToBytes(ulong num, uint length, bool isLowNumHigh = false)
{
if (length > 8)
{
throw new ArgumentException(
return new(new ArgumentException(
"Unsigned long number can't over 8 bytes(64 bits).",
nameof(length)
);
));
}
var arr = new byte[length];
if (isRightHigh)
if (isLowNumHigh)
{
for (var i = 0; i < length; i++)
{
@@ -27,44 +73,230 @@ namespace Common
{
for (var i = 0; i < length; i++)
{
arr[i] = Convert.ToByte((num >> (i << 3)) & (0xFF));
arr[i] = Convert.ToByte((num >> ((int)(length - 1 - i) << 3)) & (0xFF));
}
}
return arr;
}
public static Result<ulong> BytesToNumber(byte[] bytes, bool isRightLeft = false)
/// <summary>
/// 二进制字节数组转成64bits整数
/// </summary>
/// <param name="bytes">二进制字节数组</param>
/// <param name="isLowNumHigh">是否高位在数组索引低</param>
/// <returns>整数</returns>
public static Result<UInt64> BytesToUInt64(byte[] bytes, bool isLowNumHigh = false)
{
if (bytes.Length > 8)
{
throw new ArgumentException(
return new(new ArgumentException(
"Unsigned long number can't over 8 bytes(64 bits).",
nameof(bytes)
);
));
}
ulong num = 0;
UInt64 num = 0;
int len = bytes.Length;
if (isRightLeft)
try
{
if (isLowNumHigh)
{
for (var i = 0; i < len; i++)
{
num += Convert.ToUInt64(bytes[len - 1 - i] << (i << 3));
num += Convert.ToUInt64((UInt64)bytes[len - 1 - i] << (i << 3));
}
}
else
{
for (var i = 0; i < len; i++)
{
num += Convert.ToUInt64(bytes[i] << (i << 3));
num += Convert.ToUInt64((UInt64)bytes[i] << ((int)(len - 1 - i) << 3));
}
}
return num;
}
catch (Exception error)
{
return new(error);
}
}
public static Result<byte[]> StringToBytes(string str, int numBase = 16)
/// <summary>
/// 二进制字节数组转成32bits整数
/// </summary>
/// <param name="bytes">二进制字节数组</param>
/// <param name="isLowNumHigh">是否高位在数组索引低</param>
/// <returns>整数</returns>
public static Result<UInt32> BytesToUInt32(byte[] bytes, bool isLowNumHigh = false)
{
if (bytes.Length > 4)
{
return new(new ArgumentException(
"Unsigned long number can't over 4 bytes(32 bits).",
nameof(bytes)
));
}
UInt32 num = 0;
int len = bytes.Length;
try
{
if (isLowNumHigh)
{
for (var i = 0; i < len; i++)
{
num += Convert.ToUInt32((UInt32)bytes[len - 1 - i] << (i << 3));
}
}
else
{
for (var i = 0; i < len; i++)
{
num += Convert.ToUInt32((UInt32)bytes[i] << ((int)(len - 1 - i) << 3));
}
}
return num;
}
catch (Exception error)
{
return new(error);
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="uintArray">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public static Result<byte[]> UInt32ArrayToBytes(UInt32[] uintArray)
{
byte[] byteArray = new byte[uintArray.Length * 4];
try
{
Buffer.BlockCopy(uintArray, 0, byteArray, 0, uintArray.Length * 4);
return byteArray;
}
catch (Exception error)
{
return new(error);
}
}
/// <summary>
/// 比特合并成二进制字节
/// </summary>
/// <param name="bits1">第一个比特值</param>
/// <param name="bits1Len">第一个比特值的长度(位数)</param>
/// <param name="bits2">第二个比特值</param>
/// <param name="bits2Len">第二个比特值的长度(位数)</param>
/// <returns>合并后的二进制字节数组</returns>
public static Result<byte[]> MultiBitsToBytes(ulong bits1, uint bits1Len, ulong bits2, uint bits2Len)
{
return NumberToBytes(MultiBitsToNumber(bits1, bits1Len, bits2, bits2Len).Value,
(bits1Len + bits2Len) % 8 != 0 ? (bits1Len + bits2Len) / 8 + 1 : (bits1Len + bits2Len) / 8);
}
/// <summary>
/// 比特合并成整型
/// </summary>
/// <param name="bits1">第一个比特值</param>
/// <param name="bits1Len">第一个比特值的长度(位数)</param>
/// <param name="bits2">第二个比特值</param>
/// <param name="bits2Len">第二个比特值的长度(位数)</param>
/// <returns>合并后的整型值</returns>
public static Result<ulong> MultiBitsToNumber(ulong bits1, uint bits1Len, ulong bits2, uint bits2Len)
{
if (bits1Len + bits2Len > 64) return new(new ArgumentException("Two Bits is more than 64 bits"));
ulong num = (bits1 << Convert.ToInt32(bits2Len)) | bits2;
return num;
}
/// <summary>
/// 比特合并成整型
/// </summary>
/// <param name="bits1">第一个比特值</param>
/// <param name="bits1Len">第一个比特值的长度(位数)</param>
/// <param name="bits2">第二个比特值</param>
/// <param name="bits2Len">第二个比特值的长度(位数)</param>
/// <returns>合并后的整型值</returns>
public static Result<uint> MultiBitsToNumber(uint bits1, uint bits1Len, uint bits2, uint bits2Len)
{
if (bits1Len + bits2Len > 64) return new(new ArgumentException("Two Bits is more than 64 bits"));
uint num = (bits1 << Convert.ToInt32(bits2Len)) | bits2;
return num;
}
/// <summary>
/// 比特位检查
/// </summary>
/// <param name="srcBits">源比特值</param>
/// <param name="dstBits">目标比特值</param>
/// <param name="mask">掩码默认为全1</param>
/// <returns>检查结果(是否匹配)</returns>
public static bool BitsCheck(ulong srcBits, ulong dstBits, ulong mask = 0xFFFF_FFFF_FFFF_FFFF)
{
return (srcBits & mask) == dstBits;
}
/// <summary>
/// 比特位检查
/// </summary>
/// <param name="srcBits">源比特值</param>
/// <param name="dstBits">目标比特值</param>
/// <param name="mask">掩码默认为全1</param>
/// <returns>检查结果(是否匹配)</returns>
public static bool BitsCheck(uint srcBits, uint dstBits, uint mask = 0xFFFF_FFFF)
{
return (srcBits & mask) == dstBits;
}
/// <summary>
/// 获取整型对应位置的比特
/// </summary>
/// <param name="srcBits">整型数字</param>
/// <param name="location">位置</param>
/// <returns>比特</returns>
public static Result<bool> ToBit(UInt32 srcBits, int location)
{
if (location < 0)
return new(new ArgumentException(
"Location can't be negetive", nameof(location)));
return ((srcBits >> location) & ((UInt32)0b1)) == 1;
}
/// <summary>
/// 将BitArray转化为32bits无符号整型
/// </summary>
/// <param name="bits">BitArray比特数组</param>
/// <returns>32bits无符号整型</returns>
public static Result<UInt32> BitsToNumber(BitArray bits)
{
if (bits.Length > 32)
throw new ArgumentException("Argument length shall be at most 32 bits.");
var array = new UInt32[1];
bits.CopyTo(array, 0);
return array[0];
}
/// <summary>
/// 字符串转二进制字节数组
/// </summary>
/// <param name="str">输入的字符串</param>
/// <param name="numBase">进制默认为16进制</param>
/// <returns>转换后的二进制字节数组</returns>
public static byte[] StringToBytes(string str, int numBase = 16)
{
var len = str.Length;
var bytesLen = len / 2;
@@ -78,6 +310,83 @@ namespace Common
return bytes;
}
/// <summary>
/// 反转字节数组中的子数组
/// </summary>
/// <param name="srcBytes">源字节数组</param>
/// <param name="distance">子数组的长度(反转的步长)</param>
/// <returns>反转后的字节数组</returns>
public static Result<byte[]> ReverseBytes(byte[] srcBytes, int distance)
{
if (distance <= 0)
return new(new ArgumentException("Distance can't be negetive", nameof(distance)));
var srcBytesLen = srcBytes.Length;
if (distance > srcBytesLen)
return new(new ArgumentException(
"Distance is larger than bytesArray", nameof(distance)));
if (srcBytesLen % distance != 0)
return new(new ArgumentException(
"The length of bytes can't be divided by distance without reminder", nameof(distance)));
var dstBytes = new byte[srcBytesLen];
var buffer = new byte[distance];
for (int i = 0; i < srcBytesLen; i += distance)
{
var end = i + distance;
buffer = srcBytes[i..end];
Array.Reverse(buffer);
Array.Copy(buffer, 0, dstBytes, i, distance);
}
return dstBytes;
}
/// <summary>
/// 反转字节内比特顺序(使用查找表的方法)
/// </summary>
/// <param name="srcByte">字节</param>
/// <returns>反转后的字节</returns>
public static byte ReverseBits(byte srcByte)
{
return BitReverseTable[srcByte];
}
/// <summary>
/// 反转字节数组的字节内比特顺序(使用查找表的方法)
/// </summary>
/// <param name="srcBytes">字节数组</param>
/// <returns>反转后的字节字节数组</returns>
public static byte[] ReverseBits(byte[] srcBytes)
{
var bytesLen = srcBytes.Length;
var dstBytes = new byte[bytesLen];
for (int i = 0; i < bytesLen; i++)
{
dstBytes[i] = BitReverseTable[srcBytes[i]];
}
return dstBytes;
}
}
/// <summary>
/// 字符串处理工具
/// </summary>
public class String
{
/// <summary>
/// 反转字符串
/// </summary>
/// <param name="s">输入的字符串</param>
/// <returns>反转后的字符串</returns>
public static string Reverse(string s)
{
char[] charArray = s.ToCharArray();
Array.Reverse(charArray);
return new string(charArray);
}
}
}

View File

@@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// [TODO:description]
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class BsdlParserController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
/// <summary>
/// [TODO:description]
/// </summary>
/// <returns>[TODO:return]</returns>
[EnableCors("Development")]
[HttpGet("GetBoundaryLogicalPorts")]
public IResult GetBoundaryLogicalPorts()
{
var parser = new BsdlParser.Parser();
var ret = parser.GetBoundaryLogicalPorts();
if (ret.IsNull) return TypedResults.InternalServerError("Get Null");
return TypedResults.Ok(ret.Value);
}
}

View File

@@ -0,0 +1,108 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// [TODO:description]
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class DDSController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("SetWaveNum")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetWaveNum(string address, int port, int channelNum, int waveNum)
{
var dds = new Peripherals.DDSClient.DDS(address, port);
var ret = await dds.SetWaveNum(channelNum, waveNum);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} set output wave num successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <param name="step">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("SetFreq")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetFreq(string address, int port, int channelNum, int waveNum, UInt32 step)
{
var dds = new Peripherals.DDSClient.DDS(address, port);
var ret = await dds.SetFreq(channelNum, waveNum, step);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} set output freqency successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <param name="phase">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("SetPhase")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetPhase(string address, int port, int channelNum, int waveNum, int phase)
{
var dds = new Peripherals.DDSClient.DDS(address, port);
var ret = await dds.SetPhase(channelNum, waveNum, phase);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} set output phase successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
}

View File

@@ -0,0 +1,69 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// 数据控制器
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class DataController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
/// <summary>
/// 创建数据库表
/// </summary>
/// <returns>插入的记录数</returns>
[EnableCors("Development")]
[HttpPost("CreateTable")]
public IResult CreateTables()
{
using var db = new Database.AppDataConnection();
db.CreateAllTables();
return TypedResults.Ok();
}
/// <summary>
/// 删除数据库表
/// </summary>
/// <returns>插入的记录数</returns>
[EnableCors("Development")]
[HttpDelete("DropTables")]
public IResult DropTables()
{
using var db = new Database.AppDataConnection();
db.DropAllTables();
return TypedResults.Ok();
}
/// <summary>
/// 获取所有用户
/// </summary>
/// <returns>用户列表</returns>
[HttpGet("AllUsers")]
public IResult AllUsers()
{
using var db = new Database.AppDataConnection();
var ret = db.User.ToList();
return TypedResults.Ok(ret);
}
/// <summary>
/// 注册新用户
/// </summary>
/// <param name="name">用户名</param>
/// <returns>操作结果</returns>
[HttpPost("SignUpUser")]
public IResult SignUpUser(string name)
{
if (name.Length > 255)
return TypedResults.BadRequest("Name Couln't over 255 characters");
using var db = new Database.AppDataConnection();
var ret = db.AddUser(name);
return TypedResults.Ok(ret);
}
}

View File

@@ -0,0 +1,278 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// Jtag API
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class JtagController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private const string BITSTREAM_PATH = "bitstream/Jtag";
/// <summary>
/// 页面
/// </summary>
[HttpGet]
public string Index()
{
return "This is Jtag Controller";
}
/// <summary>
/// 获取Jtag ID Code
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="port"> 设备端口 </param>
[HttpGet("GetDeviceIDCode")]
[EnableCors("Users")]
[ProducesResponseType(typeof(uint), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> GetDeviceIDCode(string address, int port)
{
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.ReadIDCode();
if (ret.IsSuccessful)
{
logger.Info($"Get device {address} ID code: 0x{ret.Value:X4}");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// 获取状态寄存器
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="port"> 设备端口 </param>
[HttpGet("ReadStatusReg")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> ReadStatusReg(string address, int port)
{
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.ReadStatusReg();
if (ret.IsSuccessful)
{
var binaryValue = Common.String.Reverse(Convert.ToString(ret.Value, 2).PadLeft(32, '0'));
var decodeValue = new JtagClient.JtagStatusReg(ret.Value);
logger.Info($"Read device {address} Status Register: \n\t 0b{binaryValue} \n\t {decodeValue}");
return TypedResults.Ok(new
{
original = ret.Value,
binaryValue,
decodeValue,
});
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// 上传比特流文件
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="file">比特流文件</param>
[HttpPost("UploadBitstream")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
public async ValueTask<IResult> UploadBitstream(string address, IFormFile file)
{
if (file == null || file.Length == 0)
return TypedResults.BadRequest("未选择文件");
// 生成安全的文件名(避免路径遍历攻击)
var fileName = Path.GetRandomFileName();
var uploadsFolder = Path.Combine(Environment.CurrentDirectory, $"{BITSTREAM_PATH}/{address}");
// 如果存在文件,则删除原文件再上传
if (Directory.Exists(uploadsFolder))
{
Directory.Delete(uploadsFolder, true);
}
Directory.CreateDirectory(uploadsFolder);
var filePath = Path.Combine(uploadsFolder, fileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
await file.CopyToAsync(stream);
}
logger.Info($"Device {address} Upload Bitstream Successfully");
return TypedResults.Ok(true);
}
/// <summary>
/// 通过Jtag下载比特流文件
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="port"> 设备端口 </param>
[HttpPost("DownloadBitstream")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> DownloadBitstream(string address, int port)
{
// 检查文件
var fileDir = Path.Combine(Environment.CurrentDirectory, $"{BITSTREAM_PATH}/{address}");
if (!Directory.Exists(fileDir))
return TypedResults.BadRequest("Empty bitstream, Please upload it first");
try
{
// 读取文件
var filePath = Directory.GetFiles(fileDir)[0];
using (var fileStream = System.IO.File.Open(filePath, System.IO.FileMode.Open))
{
if (fileStream is null || fileStream.Length <= 0)
return TypedResults.BadRequest("Wrong bitstream, Please upload it again");
// 定义缓冲区大小: 32KB
byte[] buffer = new byte[32 * 1024];
byte[] revBuffer = new byte[32 * 1024];
long totalBytesRead = 0;
// 使用异步流读取文件
using (var memoryStream = new MemoryStream())
{
int bytesRead;
while ((bytesRead = await fileStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
// 反转 32bits
var retBuffer = Common.Number.ReverseBytes(buffer, 4);
if (!retBuffer.IsSuccessful)
return TypedResults.InternalServerError(retBuffer.Error);
revBuffer = retBuffer.Value;
for (int i = 0; i < revBuffer.Length; i++)
{
revBuffer[i] = Common.Number.ReverseBits(revBuffer[i]);
}
await memoryStream.WriteAsync(revBuffer, 0, bytesRead);
totalBytesRead += bytesRead;
}
// 将所有数据转换为字节数组(注意:如果文件非常大,可能不适合完全加载到内存)
var fileBytes = memoryStream.ToArray();
// 下载比特流
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.DownloadBitstream(fileBytes);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} dowload bitstream successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
}
}
catch (Exception error)
{
return TypedResults.InternalServerError(error);
}
finally
{
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("BoundaryScanAllPorts")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(string), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> BoundaryScanAllPorts(string address, int port)
{
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.BoundaryScan();
if (!ret.IsSuccessful)
{
if (ret.Error is ArgumentException)
return TypedResults.BadRequest(ret.Error);
else return TypedResults.InternalServerError(ret.Error);
}
return TypedResults.Ok(ret.Value);
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("BoundaryScanLogicalPorts")]
[EnableCors("Users")]
[ProducesResponseType(typeof(Dictionary<string, bool>), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> BoundaryScanLogicalPorts(string address, int port)
{
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.BoundaryScanLogicalPorts();
if (!ret.IsSuccessful)
{
if (ret.Error is ArgumentException)
return TypedResults.BadRequest(ret.Error);
else return TypedResults.InternalServerError(ret.Error);
}
return TypedResults.Ok(ret.Value);
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="speed">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("SetSpeed")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetSpeed(string address, int port, UInt32 speed)
{
var jtagCtrl = new JtagClient.Jtag(address, port);
var ret = await jtagCtrl.SetSpeed(speed);
if (!ret.IsSuccessful)
{
if (ret.Error is ArgumentException)
return TypedResults.BadRequest(ret.Error);
else return TypedResults.InternalServerError(ret.Error);
}
return TypedResults.Ok(ret.Value);
}
}

View File

@@ -0,0 +1,101 @@
using System.Collections;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// 矩阵键控制器,用于管理矩阵键的启用、禁用和状态设置
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class MatrixKeyController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
/// <summary>
/// 启用矩阵键控制。
/// </summary>
/// <param name="address">设备的IP地址</param>
/// <param name="port">设备的端口号</param>
/// <returns>返回操作结果的状态码</returns>
[HttpPost("EnabelMatrixKey")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> EnabelMatrixKey(string address, int port)
{
var matrixKeyCtrl = new Peripherals.MatrixKeyClient.MatrixKey(address, port);
var ret = await matrixKeyCtrl.EnableControl();
if (ret.IsSuccessful)
{
logger.Info($"Enable device {address}:{port.ToString()} matrix key finished: {ret.Value}.");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// 禁用矩阵键控制。
/// </summary>
/// <param name="address">设备的IP地址</param>
/// <param name="port">设备的端口号</param>
/// <returns>返回操作结果的状态码</returns>
[HttpPost("DisableMatrixKey")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> DisableMatrixKey(string address, int port)
{
var matrixKeyCtrl = new Peripherals.MatrixKeyClient.MatrixKey(address, port);
var ret = await matrixKeyCtrl.DisableControl();
if (ret.IsSuccessful)
{
logger.Info($"Disable device {address}:{port.ToString()} matrix key finished: {ret.Value}.");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// 设置矩阵键的状态。
/// </summary>
/// <param name="address">设备的IP地址</param>
/// <param name="port">设备的端口号</param>
/// <param name="keyStates">矩阵键的状态数组长度应为16</param>
/// <returns>返回操作结果的状态码</returns>
[HttpPost("SetMatrixKeyStatus")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetMatrixKeyStatus(string address, int port, [FromBody] bool[] keyStates)
{
if (keyStates.Length != 16)
return TypedResults.BadRequest($"The length of key states should be 16 instead of {keyStates.Length}");
var matrixKeyCtrl = new Peripherals.MatrixKeyClient.MatrixKey(address, port);
var ret = await matrixKeyCtrl.ControlKey(new BitArray(keyStates));
if (ret.IsSuccessful)
{
logger.Info($"Set device {address}:{port.ToString()} matrix key finished: {ret.Value}.");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
}

View File

@@ -0,0 +1,46 @@
using System.Collections;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// 矩阵键控制器,用于管理矩阵键的启用、禁用和状态设置
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class PowerController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="enable">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("SetPowerOnOff")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SetPowerOnOff(string address, int port, bool enable)
{
var powerCtrl = new Peripherals.PowerClient.Power(address, port);
var ret = await powerCtrl.SetPowerOnOff(enable);
if (ret.IsSuccessful)
{
var powerStatus = enable ? "ON" : "OFF";
logger.Info($"Set device {address}:{port.ToString()} power {powerStatus} finished: {ret.Value}.");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
}

View File

@@ -0,0 +1,292 @@
using DotNext;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
namespace server.Controllers;
/// <summary>
/// 远程更新
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class RemoteUpdateController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private const string BITSTREAM_PATH = "bitstream/RemoteUpdate";
/// <summary>
/// 上传远程更新比特流文件
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="goldenBitream">黄金比特流文件</param>
/// <param name="bitstream1">比特流文件1</param>
/// <param name="bitstream2">比特流文件2</param>
/// <param name="bitstream3">比特流文件3</param>
/// <returns>上传结果</returns>
[HttpPost("UploadBitstream")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
public async ValueTask<IResult> UploadBitstreams(
string address,
IFormFile? goldenBitream,
IFormFile? bitstream1,
IFormFile? bitstream2,
IFormFile? bitstream3)
{
if ((goldenBitream is null || goldenBitream.Length == 0) &&
(bitstream1 is null || bitstream1.Length == 0) &&
(bitstream2 is null || bitstream2.Length == 0) &&
(bitstream3 is null || bitstream3.Length == 0))
return TypedResults.BadRequest("未选择文件");
// 生成安全的文件名(避免路径遍历攻击)
var fileName = Path.GetRandomFileName();
var uploadsFolder = Path.Combine(Environment.CurrentDirectory, $"{BITSTREAM_PATH}/{address}");
// 如果存在文件,则删除原文件再上传
if (Directory.Exists(uploadsFolder))
{
Directory.Delete(uploadsFolder, true);
}
Directory.CreateDirectory(uploadsFolder);
for (int bitstreamNum = 0; bitstreamNum < 4; bitstreamNum++)
{
IFormFile file;
if (bitstreamNum == 0 && goldenBitream is not null)
file = goldenBitream;
else if (bitstreamNum == 1 && bitstream1 is not null)
file = bitstream1;
else if (bitstreamNum == 2 && bitstream2 is not null)
file = bitstream2;
else if (bitstreamNum == 3 && bitstream3 is not null)
file = bitstream3;
else continue;
var fileFolder = Path.Combine(uploadsFolder, bitstreamNum.ToString());
Directory.CreateDirectory(fileFolder);
var filePath = Path.Combine(fileFolder, fileName);
using (var stream = new FileStream(filePath, FileMode.Create))
{
await file.CopyToAsync(stream);
}
}
logger.Info($"Device {address} Upload Bitstream Successfully");
return TypedResults.Ok(true);
}
private async ValueTask<Result<byte[]>> ProcessBitstream(string filePath)
{
using (var fileStream = System.IO.File.Open(filePath, System.IO.FileMode.Open))
{
if (fileStream is null || fileStream.Length <= 0)
return new(new ArgumentException("Wrong bitstream path"));
// 定义缓冲区大小: 32KB
byte[] buffer = new byte[32 * 1024];
byte[] revBuffer = new byte[32 * 1024];
long totalBytesRead = 0;
// 使用异步流读取文件
using (var memoryStream = new MemoryStream())
{
int bytesRead;
while ((bytesRead = await fileStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
// 反转 32bits
var retBuffer = Common.Number.ReverseBytes(buffer, 4);
if (!retBuffer.IsSuccessful)
return new(retBuffer.Error);
revBuffer = retBuffer.Value;
await memoryStream.WriteAsync(revBuffer, 0, bytesRead);
totalBytesRead += bytesRead;
}
// 将所有数据转换为字节数组(注意:如果文件非常大,可能不适合完全加载到内存)
var restStreamLen = memoryStream.Length % (4 * 1024);
if (restStreamLen != 0)
{
var appendLen = ((int)(4 * 1024 - restStreamLen));
var bytesAppend = new byte[appendLen];
Array.Fill<byte>(bytesAppend, 0xFF);
await memoryStream.WriteAsync(bytesAppend, 0, appendLen);
}
return new(memoryStream.ToArray());
}
}
}
/// <summary>
/// 远程更新单个比特流文件
/// </summary>
/// <param name="address"> 设备地址 </param>
/// <param name="port"> 设备端口 </param>
/// <param name="bitstreamNum"> 比特流位号 </param>
[HttpPost("DownloadBitstream")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> UpdateBitstream(string address, int port, int bitstreamNum)
{
// 检查文件
var fileDir = Path.Combine(Environment.CurrentDirectory, $"{BITSTREAM_PATH}/{address}/{bitstreamNum}");
if (!Directory.Exists(fileDir))
return TypedResults.BadRequest("Empty bitstream, Please upload it first");
try
{
// 读取文件
var filePath = Directory.GetFiles(fileDir)[0];
var fileBytes = await ProcessBitstream(filePath);
if (!fileBytes.IsSuccessful) return TypedResults.InternalServerError(fileBytes.Error);
// 下载比特流
var remoteUpdater = new RemoteUpdateClient.RemoteUpdater(address, port);
var ret = await remoteUpdater.UpdateBitstream(bitstreamNum, fileBytes.Value);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} Update bitstream successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
catch (Exception error)
{
return TypedResults.InternalServerError(error);
}
}
/// <summary>
/// 下载多个比特流文件
/// </summary>
/// <param name="address">设备地址</param>
/// <param name="port">设备端口</param>
/// <param name="bitstreamNum">比特流编号</param>
/// <returns>总共上传比特流的数量</returns>
[HttpPost("DownloadMultiBitstreams")]
[EnableCors("Users")]
[ProducesResponseType(typeof(int), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> DownloadMultiBitstreams(string address, int port, int? bitstreamNum)
{
// 检查文件
var bitstreamsFolder = Path.Combine(Environment.CurrentDirectory, $"{BITSTREAM_PATH}/{address}");
if (!Directory.Exists(bitstreamsFolder))
return TypedResults.BadRequest("Empty bitstream, Please upload it first");
try
{
var bitstreams = new List<byte[]?>() { null, null, null, null };
int cnt = 0; // 上传比特流数量
for (int i = 0; i < 4; i++)
{
var bitstreamDir = Path.Combine(bitstreamsFolder, i.ToString());
if (!Directory.Exists(bitstreamDir))
continue;
cnt++;
// 读取文件
var filePath = Directory.GetFiles(bitstreamDir)[0];
var fileBytes = await ProcessBitstream(filePath);
if (!fileBytes.IsSuccessful) return TypedResults.InternalServerError(fileBytes.Error);
bitstreams[i] = fileBytes.Value;
}
// 下载比特流
var remoteUpdater = new RemoteUpdateClient.RemoteUpdater(address, port);
{
var ret = await remoteUpdater.UploadBitstreams(bitstreams[0], bitstreams[1], bitstreams[2], bitstreams[3]);
if (!ret.IsSuccessful) return TypedResults.InternalServerError(ret.Error);
if (!ret.Value) return TypedResults.InternalServerError("Upload MultiBitstreams failed");
}
if (bitstreamNum is not null)
{
var ret = await remoteUpdater.HotResetBitstream(bitstreamNum ?? 0);
if (!ret.IsSuccessful) return TypedResults.InternalServerError(ret.Error);
if (!ret.Value) return TypedResults.InternalServerError("Hot reset failed");
}
return TypedResults.Ok(cnt);
}
catch (Exception error)
{
return TypedResults.InternalServerError(error);
}
}
/// <summary>
/// 热复位比特流文件
/// </summary>
/// <param name="address">设备地址</param>
/// <param name="port">设备端口</param>
/// <param name="bitstreamNum">比特流编号</param>
/// <returns>操作结果</returns>
[HttpPost("HotResetBitstream")]
[EnableCors("Users")]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> HotResetBitstream(string address, int port, int bitstreamNum)
{
var remoteUpdater = new RemoteUpdateClient.RemoteUpdater(address, port);
var ret = await remoteUpdater.HotResetBitstream(bitstreamNum);
if (ret.IsSuccessful)
{
logger.Info($"Device {address} Update bitstream successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
[HttpPost("GetFirmwareVersion")]
[EnableCors("Users")]
[ProducesResponseType(typeof(UInt32), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ArgumentException), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(Exception), StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> GetFirmwareVersion(string address, int port)
{
var remoteUpdater = new RemoteUpdateClient.RemoteUpdater(address, port);
var ret = await remoteUpdater.GetVersion();
if (ret.IsSuccessful)
{
logger.Info($"Device {address} get firmware version successfully");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Error(ret.Error);
return TypedResults.InternalServerError(ret.Error);
}
}
}

View File

@@ -0,0 +1,133 @@
using System.Net;
using Common;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using WebProtocol;
namespace server.Controllers;
/// <summary>
/// UDP API
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class UDPController : ControllerBase
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private const string LOCALHOST = "127.0.0.1";
/// <summary>
/// 页面
/// </summary>
[HttpGet]
public string Index()
{
return "This is UDP Controller";
}
/// <summary>
/// 发送字符串
/// </summary>
/// <param name="address">IPV4 或者 IPV6 地址</param>
/// <param name="port">设备端口号</param>
/// <param name="text">发送的文本</param>
/// <response code="200">发送成功</response>
/// <response code="500">发送失败</response>
[HttpPost("SendString")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SendString(string address = LOCALHOST, int port = 1234, string text = "Hello Server!")
{
var endPoint = new IPEndPoint(IPAddress.Parse(address), port);
var ret = await UDPClientPool.SendStringAsync(endPoint, [text]);
if (ret) { return TypedResults.Ok(); }
else { return TypedResults.InternalServerError(); }
}
/// <summary>
/// 发送二进制数据
/// </summary>
/// <param name="address" example="127.0.0.1">IPV4 或者 IPV6 地址</param>
/// <param name="port" example="1234">设备端口号</param>
/// <param name="bytes" example="FFFFAAAA">16进制文本</param>
[HttpPost("SendBytes")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SendBytes(string address, int port, string bytes)
{
var endPoint = new IPEndPoint(IPAddress.Parse(address), port);
var ret = await UDPClientPool.SendBytesAsync(endPoint, Number.StringToBytes(bytes));
if (ret) { return TypedResults.Ok(); }
else { return TypedResults.InternalServerError(); }
}
/// <summary>
/// 发送地址包
/// </summary>
/// <param name="address">IP地址</param>
/// <param name="port">UDP 端口号</param>
/// <param name="opts">地址包选项</param>
[HttpPost("SendAddrPackage")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SendAddrPackage(
string address,
int port,
[FromBody] SendAddrPackOptions opts)
{
var endPoint = new IPEndPoint(IPAddress.Parse(address), port);
var ret = await UDPClientPool.SendAddrPackAsync(endPoint, new WebProtocol.SendAddrPackage(opts));
if (ret) { return TypedResults.Ok(); }
else { return TypedResults.InternalServerError(); }
}
/// <summary>
/// 发送数据包
/// </summary>
/// <param name="address">IP地址</param>
/// <param name="port">UDP 端口号</param>
/// <param name="data">16进制数据</param>
[HttpPost("SendDataPackage")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> SendDataPackage(string address, int port, string data)
{
var endPoint = new IPEndPoint(IPAddress.Parse(address), port);
var ret = await UDPClientPool.SendDataPackAsync(endPoint,
new WebProtocol.SendDataPackage(Number.StringToBytes(data)));
if (ret) { return TypedResults.Ok(); }
else { return TypedResults.InternalServerError(); }
}
/// <summary>
/// 获取指定IP地址接受的数据列表
/// </summary>
/// <param name="address">IP地址</param>
[HttpGet("GetRecvDataArray")]
[ProducesResponseType(typeof(List<UDPData>), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async ValueTask<IResult> GetRecvDataArray(string address)
{
var ret = await MsgBus.UDPServer.GetDataArrayAsync(address);
if (ret.HasValue)
{
var dataJson = JsonConvert.SerializeObject(ret.Value);
logger.Debug($"Get Receive Successfully: {dataJson}");
return TypedResults.Ok(ret.Value);
}
else
{
logger.Debug("Get Receive Failed");
return TypedResults.InternalServerError();
}
}
}

113
server/src/Database.cs Normal file
View File

@@ -0,0 +1,113 @@
using LinqToDB;
using LinqToDB.Data;
using LinqToDB.Mapping;
namespace Database;
/// <summary>
/// 用户类,表示用户信息
/// </summary>
public class User
{
/// <summary>
/// 用户的唯一标识符
/// </summary>
[PrimaryKey]
public Guid ID { get; set; } = Guid.NewGuid();
/// <summary>
/// 用户的名称
/// </summary>
[NotNull]
public required string Name { get; set; }
}
/// <summary>
/// FPGA 板子类,表示板子信息
/// </summary>
public class Board
{
/// <summary>
/// FPGA 板子的唯一标识符
/// </summary>
[PrimaryKey]
public Guid Id { get; set; } = Guid.NewGuid();
/// <summary>
/// FPGA 板子的名称
/// </summary>
[NotNull]
public required string BoardName { get; set; }
}
/// <summary>
/// 应用程序数据连接类,用于与数据库交互
/// </summary>
public class AppDataConnection : DataConnection
{
static readonly LinqToDB.DataOptions options =
new LinqToDB.DataOptions()
.UseSQLite($"Data Source={Environment.CurrentDirectory}/Database.sqlite");
/// <summary>
/// 初始化应用程序数据连接
/// </summary>
public AppDataConnection() : base(options) { }
/// <summary>
/// 创建所有数据库表
/// </summary>
public void CreateAllTables()
{
this.CreateTable<User>();
this.CreateTable<Board>();
}
/// <summary>
/// 删除所有数据库表
/// </summary>
public void DropAllTables()
{
this.DropTable<User>();
this.DropTable<Board>();
}
/// <summary>
/// 添加一个新的用户到数据库
/// </summary>
/// <param name="name">用户的名称</param>
/// <returns>插入的记录数</returns>
public int AddUser(string name)
{
var user = new User()
{
Name = name
};
return this.Insert(user);
}
/// <summary>
/// 添加一块新的 FPGA 板子到数据库
/// </summary>
/// <param name="name">FPGA 板子的名称</param>
/// <returns>插入的记录数</returns>
public int AddBoard(string name)
{
var board = new Board()
{
BoardName = name
};
return this.Insert(board);
}
/// <summary>
/// 用户表
/// </summary>
public ITable<User> User => this.GetTable<User>();
/// <summary>
/// FPGA 板子表
/// </summary>
public ITable<Board> Board => this.GetTable<Board>();
}

867
server/src/JtagClient.cs Normal file
View File

@@ -0,0 +1,867 @@
using System.Collections;
using System.Net;
using BsdlParser;
using DotNext;
using Newtonsoft.Json;
using WebProtocol;
namespace JtagClient;
/// <summary>
/// Global Constant Jtag Address
/// </summary>
public static class JtagAddr
{
/// <summary>
/// Jtag State Reg
/// </summary>
public const UInt32 STATE = 0x10_00_00_00;
/// <summary>
/// Jtag Read Reg
/// </summary>
public const UInt32 READ_DATA = 0x10_00_00_01;
/// <summary>
/// Jtag Write Reg
/// </summary>
public const UInt32 WRITE_DATA = 0x10_00_00_02;
/// <summary>
/// Jtag Write Command
/// </summary>
public const UInt32 WRITE_CMD = 0x10_00_00_03;
/// <summary>
/// Jtag Speed Control
/// </summary>
public const UInt32 SPEED_CTRL = 0x10_00_00_04;
}
/// <summary>
/// Jtag 状态寄存器的掩码及其确认函数
/// </summary>
public static class JtagState
{
/*
[0] 移位数据读fifo清空1为有效清空后自动置0
[1] 移位数据fifo读入口-空标识只读对JTAG_STATE_REG的写不改变其值
[2] 移位数据fifo读入口-满标识只读对JTAG_STATE_REG的写不改变其值
[7:3] 保留
[8] 移位数据写fifo清空1为有效清空后自动置0
[9] 移位数据fifo写入口-空标识只读对JTAG_STATE_REG的写不改变其值
[10] 移位数据fifo写入口-满标识只读对JTAG_STATE_REG的写不改变其值
[15:11]保留
[16] 移位命令写fifo清空1为有效清空后自动置0
[17] 移位命令fifo写入口-空标识只读对JTAG_STATE_REG的写不改变其值
[18] 移位命令fifo写入口-满标识只读对JTAG_STATE_REG的写不改变其值
[23:19]保留
[24] CMD执行完毕标识只读对JTAG_STATE_REG的写不改变其值
*/
/// <summary>
/// 移位数据读fifo清空1为有效清空后自动置0实际一直为零
/// </summary>
public const UInt32 READ_DATA_FIFO_CLEAR = 0b0001 << 0;
/// <summary>
/// 移位数据fifo读入口-空标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 READ_DATA_FIFO_EMPTY = 0b0010 << 0;
/// <summary>
/// 移位数据fifo读入口-满标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 READ_DATA_FIFO_AFULL = 0b0100 << 0;
/// <summary>
/// 移位数据读fifo
/// </summary>
public const UInt32 READ_DATA_FIFO = 0b0111 << 0;
/// <summary>
/// 移位数据写fifo清空1为有效清空后自动置0
/// </summary>
public const UInt32 WRITE_DATA_FIFO_CLEAR = 0b0001 << 8;
/// <summary>
/// 移位数据fifo写入口-空标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 WRITE_DATA_FIFO_EMPTY = 0b0010 << 8;
/// <summary>
/// 移位数据fifo写入口-满标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 WRITE_DATA_FIFO_AFULL = 0b0100 << 8;
/// <summary>
/// 移位数据写fifo
/// </summary>
public const UInt32 WRITE_DATA_FIFO = 0b0111 << 8;
/// <summary>
/// 移位命令写fifo清空1为有效清空后自动置0
/// </summary>
public const UInt32 WRITE_CMD_FIFO_CLEAR = 0b0001 << 16;
/// <summary>
/// 移位命令fifo写入口-空标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 WRITE_CMD_FIFO_EMPTY = 0b0010 << 16;
/// <summary>
/// 移位命令fifo写入口-满标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 WRITE_CMD_FIFO_AFULL = 0b0100 << 16;
/// <summary>
/// 移位命令写fifo
/// </summary>
public const UInt32 WRITE_CMD_FIFO = 0b0111 << 16;
/// <summary>
/// CMD执行完毕标识只读对JTAG_STATE_REG的写不改变其值
/// </summary>
public const UInt32 CMD_EXEC_FINISH = 0b0001 << 24;
/// <summary>
/// 全部FIFO
/// </summary>
public const UInt32 ALL_FIFO = READ_DATA_FIFO | WRITE_DATA_FIFO | WRITE_CMD_FIFO;
/// <summary>
/// 全部寄存器
/// </summary>
public const UInt32 ALL_REG = READ_DATA_FIFO | WRITE_DATA_FIFO | WRITE_CMD_FIFO | CMD_EXEC_FINISH;
}
/// <summary>
/// The Command bits of Jtag
/// </summary>
public static class JtagCmd
{
/// <summary>
/// The length of JTAG_DR_XXXX
/// </summary>
public const UInt32 LEN_JTAG_DR = 10;
/// <summary>
/// 旁路指令
/// </summary>
public const UInt32 JTAG_DR_BYPASS = 0b1111111111;
/// <summary>
/// 采样指令
/// </summary>
public const UInt32 JTAG_DR_SAMPLE = 0b1010000000;
/// <summary>
/// 预装指令
/// </summary>
public const UInt32 JTAG_DR_PRELOAD = 0b1010000000;
/// <summary>
/// 外测试指令
/// </summary>
public const UInt32 JTAG_DR_EXTEST = 0b1010000001;
/// <summary>
/// 内测试指令
/// </summary>
public const UInt32 JTAG_DR_INTEST = 0b1010000010;
/// <summary>
/// 标识指令
/// </summary>
public const UInt32 JTAG_DR_IDCODE = 0b1010000011;
/// <summary>
/// 高阻指令
/// </summary>
public const UInt32 JTAG_DR_HIGHZ = 0b1010000101;
/// <summary>
/// 复位指令
/// </summary>
public const UInt32 JTAG_DR_JRST = 0b1010001010;
/// <summary>
/// 配置指令
/// </summary>
public const UInt32 JTAG_DR_CFGI = 0b1010001011;
/// <summary>
/// 回读指令
/// </summary>
public const UInt32 JTAG_DR_CFGO = 0b1010001100;
/// <summary>
/// 唤醒指令
/// </summary>
public const UInt32 JTAG_DR_JWAKEUP = 0b1010001101;
/// <summary>
/// 读UID指令
/// </summary>
public const UInt32 JTAG_DR_READ_UID = 0b0101001100;
/// <summary>
/// 读状态寄存器指令
/// </summary>
public const UInt32 JTAG_DR_RDSR = 0b0101011001;
/// <summary>
/// The length of CMD_JTAG_XXXX_XXXX
/// </summary>
public const UInt32 LEN_CMD_JTAG = 4;
/// <summary>
/// 设定JTAG默认状态为TEST_LOGIC_RESET态 JTAG复位
/// </summary>
public const UInt32 CMD_JTAG_CLOSE_TEST = 0b0000;
/// <summary>
/// 设定JTAG默认状态为RUN_TEST_IDLE态 JTAG空闲
/// </summary>
public const UInt32 CMD_JTAG_RUN_TEST = 0b0001;
/// <summary>
/// JTAG进入SHIFTIR循环cycle_num次后回到设定的默认状态
/// </summary>
public const UInt32 CMD_JTAG_LOAD_IR = 0b0010;
/// <summary>
/// JTAG进入SHIFTDR循环cycle_num次后回到设定的默认状态同时输入shift_in
/// </summary>
public const UInt32 CMD_JTAG_LOAD_DR_CAREI = 0b0011;
/// <summary>
/// JTAG进入SHIFTDR循环cycle_num次后回到设定的默认状态同时输出shift_out
/// </summary>
public const UInt32 CMD_JTAG_LOAD_DR_CAREO = 0b0100;
/// <summary>
/// JTAG进入RUN_TEST_IDLE态循环cycle_num次
/// </summary>
public const UInt32 CMD_JTAG_IDLE_DELAY = 0b0101;
}
/// <summary>
/// JTAG 状态寄存器
/// </summary>
public class JtagStatusReg
{
/// <summary>
/// ID 错误标志
/// </summary>
public bool id_err { get; set; }
/// <summary>
/// CRC 错误标志
/// </summary>
public bool crc_err { get; set; }
/// <summary>
/// 自动测试错误标志
/// </summary>
public bool aut_err { get; set; }
/// <summary>
/// 回读 CRC 错误标志
/// </summary>
public bool rbcrc_err { get; set; }
/// <summary>
/// 超时标志
/// </summary>
public bool timeout { get; set; }
/// <summary>
/// 唤醒完成标志
/// </summary>
public bool wakeup_over { get; set; }
/// <summary>
/// 休眠完成标志
/// </summary>
public bool wakedown_over { get; set; }
/// <summary>
/// 模式位
/// </summary>
public string m { get; set; }
/// <summary>
/// 初始化完成标志
/// </summary>
public bool init_complete { get; set; }
/// <summary>
/// 初始化状态(低电平有效)
/// </summary>
public bool init_n { get; set; }
/// <summary>
/// 完成标志
/// </summary>
public bool done { get; set; }
/// <summary>
/// 内部完成标志
/// </summary>
public bool done_i { get; set; }
/// <summary>
/// 全局逻辑使能标志
/// </summary>
public bool glogen { get; set; }
/// <summary>
/// 全局逻辑反馈标志
/// </summary>
public bool glogen_fb { get; set; }
/// <summary>
/// 全局输出使能标志
/// </summary>
public bool gouten { get; set; }
/// <summary>
/// 全局复位标志
/// </summary>
public bool grsn { get; set; }
/// <summary>
/// 全局写使能标志
/// </summary>
public bool gwen { get; set; }
/// <summary>
/// PLL 锁定标志
/// </summary>
public bool pll_lock { get; set; }
/// <summary>
/// 回退标志
/// </summary>
public bool fallback { get; set; }
/// <summary>
/// IPAL 模式位
/// </summary>
public string ipal_m { get; set; }
/// <summary>
/// 8 位标志
/// </summary>
public bool flg_x8 { get; set; }
/// <summary>
/// 16 位标志
/// </summary>
public bool flg_x16 { get; set; }
/// <summary>
/// 32 位标志
/// </summary>
public bool flg_x32 { get; set; }
/// <summary>
/// 过温标志
/// </summary>
public bool over_temp { get; set; }
/// <summary>
/// 配置错误标志
/// </summary>
public bool prcfg_err { get; set; }
/// <summary>
/// 配置完成标志
/// </summary>
public bool prcfg_over { get; set; }
/// <summary>
/// 构造函数,从 32 位代码解析 JTAG 状态寄存器
/// </summary>
/// <param name="code">32 位状态寄存器值</param>
public JtagStatusReg(UInt32 code)
{
this.id_err = Common.Number.ToBit(code, 0).Value;
this.crc_err = Common.Number.ToBit(code, 1).Value;
this.aut_err = Common.Number.ToBit(code, 2).Value;
this.rbcrc_err = Common.Number.ToBit(code, 3).Value;
this.timeout = Common.Number.ToBit(code, 4).Value;
this.wakeup_over = Common.Number.ToBit(code, 5).Value;
this.wakedown_over = Common.Number.ToBit(code, 6).Value;
this.m = Convert.ToString(((code >> 7) & 0b111), 2);
this.init_complete = Common.Number.ToBit(code, 10).Value;
this.init_n = Common.Number.ToBit(code, 11).Value;
this.done = Common.Number.ToBit(code, 12).Value;
this.done_i = Common.Number.ToBit(code, 13).Value;
this.glogen = Common.Number.ToBit(code, 14).Value;
this.glogen_fb = Common.Number.ToBit(code, 15).Value;
this.gouten = Common.Number.ToBit(code, 16).Value;
this.grsn = Common.Number.ToBit(code, 17).Value;
this.gwen = Common.Number.ToBit(code, 18).Value;
this.pll_lock = Common.Number.ToBit(code, 19).Value;
this.fallback = Common.Number.ToBit(code, 21).Value;
this.ipal_m = Convert.ToString(((code >> 22) & 0b11), 2);
this.flg_x8 = Common.Number.ToBit(code, 24).Value;
this.flg_x16 = Common.Number.ToBit(code, 25).Value;
this.flg_x32 = Common.Number.ToBit(code, 26).Value;
this.over_temp = Common.Number.ToBit(code, 27).Value;
this.prcfg_err = Common.Number.ToBit(code, 28).Value;
this.prcfg_over = Common.Number.ToBit(code, 29).Value;
}
/// <summary>
/// 转换为Json字符串
/// </summary>
/// <returns>Json字符串</returns>
public override string ToString()
{
return JsonConvert.SerializeObject(this);
}
}
/// <summary>
/// Jtag控制器
/// </summary>
public class Jtag
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
private const int CLOCK_FREQ = 50; // MHz
readonly int timeout;
readonly int port;
readonly string address;
private IPEndPoint ep;
/// <summary>
/// Jtag 构造函数
/// </summary>
/// <param name="address">目标 IP 地址</param>
/// <param name="port">目标 UDP 端口</param>
/// <param name="timeout">超时时间(毫秒)</param>
public Jtag(string address, int port, int timeout = 2000)
{
this.address = address;
this.port = port;
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
this.timeout = timeout;
}
async ValueTask<Result<uint>> ReadFIFO(uint devAddr)
{
var ret = false;
var opts = new SendAddrPackOptions();
opts.BurstType = BurstType.FixedBurst;
opts.BurstLength = 0;
opts.CommandID = 0;
opts.Address = devAddr;
// Read Jtag State Register
opts.IsWrite = false;
ret = await UDPClientPool.SendAddrPackAsync(ep, new SendAddrPackage(opts));
if (!ret) return new(new Exception("Send Address Package Failed!"));
// Wait for Read Ack
if (!MsgBus.IsRunning)
return new(new Exception("Message Bus not Working!"));
var retPack = await MsgBus.UDPServer.WaitForDataAsync(address, port);
if (!retPack.IsSuccessful || !retPack.Value.IsSuccessful)
return new(new Exception("Send address package failed"));
var retPackOpts = retPack.Value.Options;
if (retPackOpts.Data is null)
return new(new Exception($"Data is Null, package: {retPackOpts.ToString()}"));
var retPackLen = retPackOpts.Data.Length;
if (retPackLen != 4)
return new(new Exception($"RecvDataPackage BodyData Length not Equal to 4: Total {retPackLen} bytes"));
return Convert.ToUInt32(Common.Number.BytesToUInt64(retPackOpts.Data).Value);
}
async ValueTask<Result<bool>> WriteFIFO
(UInt32 devAddr, UInt32 data, UInt32 result, UInt32 resultMask = 0xFF_FF_FF_FF, UInt32 delayMilliseconds = 0)
{
{
var ret = await UDPClientPool.WriteAddr(this.ep, devAddr, data, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write FIFO failed"));
}
// Delay some time before read register
await Task.Delay(TimeSpan.FromMilliseconds(delayMilliseconds));
{
var ret = await UDPClientPool.ReadAddrWithWait(this.ep, JtagAddr.STATE, result, resultMask, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
async ValueTask<Result<bool>> WriteFIFO
(UInt32 devAddr, byte[] data, UInt32 result, UInt32 resultMask = 0xFF_FF_FF_FF, UInt32 delayMilliseconds = 0)
{
{
var ret = await UDPClientPool.WriteAddr(this.ep, devAddr, data, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write FIFO failed"));
}
// Delay some time before read register
await Task.Delay(TimeSpan.FromMilliseconds(delayMilliseconds));
{
var ret = await UDPClientPool.ReadAddrWithWait(this.ep, JtagAddr.STATE, result, resultMask, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
/// <summary>
/// 清除所有 JTAG 寄存器
/// </summary>
/// <returns>指示清除是否成功的异步结果</returns>
async ValueTask<Result<bool>> ClearAllRegisters()
{
return await WriteFIFO(JtagAddr.STATE, 0xFF_FF_FF_FF, 0x01_02_02_02, JtagState.ALL_REG);
}
/// <summary>
/// 清除 JTAG 写数据寄存器
/// </summary>
/// <returns>指示清除是否成功的异步结果</returns>
async ValueTask<Result<bool>> ClearWriteDataReg()
{
return await WriteFIFO(JtagAddr.STATE, 0x00_00_11_00, 0x01_00_02_00, JtagState.WRITE_DATA_FIFO | JtagState.CMD_EXEC_FINISH);
}
/// <summary>
/// 关闭 JTAG 测试模式
/// </summary>
/// <returns>指示操作是否成功的异步结果</returns>
async ValueTask<Result<bool>> CloseTest()
{
return await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_CLOSE_TEST, JtagCmd.LEN_CMD_JTAG, 0, 28).Value,
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
}
/// <summary>
/// 启动 JTAG 测试模式
/// </summary>
/// <returns>指示操作是否成功的异步结果</returns>
async ValueTask<Result<bool>> RunTest()
{
return await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_RUN_TEST, JtagCmd.LEN_CMD_JTAG, 0, 28).Value,
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
}
/// <summary>
/// 设置 JTAG 空闲延迟时间
/// </summary>
/// <param name="milliseconds">延迟时间(毫秒)</param>
/// <returns>指示操作是否成功的异步结果</returns>
async ValueTask<Result<bool>> IdleDelay(UInt32 milliseconds)
{
if (milliseconds > Math.Pow(2, 28)) return new(new Exception("Timespan is over 2^28 milliseconds"));
return await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_IDLE_DELAY, JtagCmd.LEN_CMD_JTAG, milliseconds, 28).Value,
0x01_00_00_00, JtagState.CMD_EXEC_FINISH, (milliseconds / CLOCK_FREQ) + 100);
}
async ValueTask<Result<bool>> ExecRDCmd(uint command)
{
{
var ret = await WriteFIFO(
JtagAddr.WRITE_DATA,
Common.Number.MultiBitsToNumber(0, 22, command, JtagCmd.LEN_JTAG_DR).Value, 0, 0);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Write JTAG_DR_IDCODE Failed"));
}
{
var ret = await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_IR, JtagCmd.LEN_CMD_JTAG, 10, 28).Value,
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Write CMD_JTAG_LOAD_IR Failed"));
}
return await ClearWriteDataReg();
}
async ValueTask<Result<bool>> LoadDRCareInput(byte[] bytesArray, UInt32 timeout = 10_000, UInt32 cycle = 500)
{
var bytesLen = ((uint)(bytesArray.Length * 8));
if (bytesLen > Math.Pow(2, 28)) return new(new Exception("Length is over 2^(28 - 3)"));
{
var ret = await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREI, JtagCmd.LEN_CMD_JTAG, bytesLen, 28).Value,
0, 0);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Write CMD_JTAG_LOAD_DR_CAREI Failed"));
}
{
var ret = await WriteFIFO(
JtagAddr.WRITE_DATA,
bytesArray, 0x01_00_00_00,
JtagState.CMD_EXEC_FINISH);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
async ValueTask<Result<UInt32>> LoadDRCareOutput(UInt32 UInt32Num)
{
if (UInt32Num > Math.Pow(2, 23)) return new(new Exception("Length is over 2^(28 - 5)"));
var ret = await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREO, JtagCmd.LEN_CMD_JTAG, 32 * UInt32Num, 28).Value,
0x01_00_00_00, JtagState.CMD_EXEC_FINISH);
if (ret.Value)
return await ReadFIFO(JtagAddr.READ_DATA);
else
return new(new Exception("LoadDRCareo Failed!"));
}
async ValueTask<Result<UInt32[]>> LoadDRCareOutputArray(UInt32 UInt32Num)
{
if (UInt32Num > Math.Pow(2, 23)) return new(new Exception("Length is over 2^(28 - 5)"));
var ret = await WriteFIFO(
JtagAddr.WRITE_CMD,
Common.Number.MultiBitsToNumber(JtagCmd.CMD_JTAG_LOAD_DR_CAREO, JtagCmd.LEN_CMD_JTAG, 32 * UInt32Num, 28).Value,
JtagState.CMD_EXEC_FINISH, JtagState.CMD_EXEC_FINISH);
if (ret.Value)
{
var array = new UInt32[UInt32Num];
for (int i = 0; i < UInt32Num; i++)
{
var retData = await ReadFIFO(JtagAddr.READ_DATA);
if (!retData.IsSuccessful)
return new(new Exception("Read FIFO failed when Load DR"));
array[i] = retData.Value;
}
return array;
}
else
return new(new Exception("LoadDRCareo Failed!"));
}
/// <summary>
/// 读取 JTAG 设备的 ID 代码
/// </summary>
/// <returns>包含 ID 代码的异步结果</returns>
public async ValueTask<Result<uint>> ReadIDCode()
{
// Clear Data
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace($"Clear up udp server {this.address} receive data");
Result<bool> ret;
ret = await ClearAllRegisters();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Clear All Registers Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
ret = await ExecRDCmd(JtagCmd.JTAG_DR_IDCODE);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_IDCODE Failed"));
ret = await ClearWriteDataReg();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
var retData = await LoadDRCareOutput(1);
if (!retData.IsSuccessful)
{
return new(new Exception("Get ID Code Failed"));
}
return retData.Value;
}
/// <summary>
/// 读取 JTAG 设备的状态寄存器
/// </summary>
/// <returns>包含状态寄存器值的异步结果</returns>
public async ValueTask<Result<uint>> ReadStatusReg()
{
// Clear Data
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace($"Clear up udp server {this.address} receive data");
Result<bool> ret;
ret = await ClearAllRegisters();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Clear All Registers Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
ret = await ExecRDCmd(JtagCmd.JTAG_DR_RDSR);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_RDSR Failed"));
ret = await ClearWriteDataReg();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Clear Write Registers Failed"));
var retData = await LoadDRCareOutput(1);
if (!retData.IsSuccessful)
return new(new Exception("Read Status Reg Failed"));
return retData.Value;
}
/// <summary>
/// 下载比特流到 JTAG 设备
/// </summary>
/// <param name="bitstream">比特流数据</param>
/// <returns>指示下载是否成功的异步结果</returns>
public async ValueTask<Result<bool>> DownloadBitstream(byte[] bitstream)
{
// Clear Data
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace($"Clear up udp server {this.address} receive data");
Result<bool> ret;
ret = await CloseTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
logger.Trace("Jtag initialize");
ret = await ExecRDCmd(JtagCmd.JTAG_DR_JRST);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_JRST Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
ret = await ExecRDCmd(JtagCmd.JTAG_DR_CFGI);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_CFGI Failed"));
logger.Trace("Jtag ready to write bitstream");
ret = await IdleDelay(100000);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag IDLE Delay Failed"));
ret = await LoadDRCareInput(bitstream);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Load Data Failed"));
logger.Trace("Jtag write bitstream");
ret = await CloseTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
ret = await ExecRDCmd(JtagCmd.JTAG_DR_JWAKEUP);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_JWAKEUP Failed"));
logger.Trace("Jtag reset device");
ret = await IdleDelay(10000);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag IDLE Delay Failed"));
var retCode = await ReadStatusReg();
if (!retCode.IsSuccessful) return new(retCode.Error);
var jtagStatus = new JtagStatusReg(retCode.Value);
if (!(jtagStatus.done && jtagStatus.wakeup_over && jtagStatus.init_complete))
return new(new Exception("Jtag download bitstream failed"));
ret = await CloseTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
logger.Trace("Jtag download bitstream successfully");
return true;
}
/// <summary>
/// 边界扫描
/// </summary>
/// <returns>返回所有引脚边界扫描结果</returns>
public async ValueTask<Result<BitArray>> BoundaryScan()
{
var paser = new BsdlParser.Parser();
var portNum = paser.GetBoundaryRegsNum().Value;
logger.Debug($"Get boundar scan registers number: {portNum}");
// Clear Data
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace($"Clear up udp server {this.address} receive data");
Result<bool> ret;
ret = await CloseTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
ret = await RunTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Run Test Failed"));
logger.Trace("Jtag initialize");
ret = await ExecRDCmd(JtagCmd.JTAG_DR_SAMPLE);
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Execute Command JTAG_DR_SAMPLE Failed"));
var retData = await LoadDRCareOutputArray(((uint)(portNum % 32 == 0 ? portNum / 32 : portNum / 32 + 1)));
if (!retData.IsSuccessful) return new(retData.Error);
ret = await CloseTest();
if (!ret.IsSuccessful) return new(ret.Error);
else if (!ret.Value) return new(new Exception("Jtag Close Test Failed"));
var byteArray = Common.Number.UInt32ArrayToBytes(retData.Value);
if (!byteArray.IsSuccessful) return new(byteArray.Error);
var bitArray = new BitArray(byteArray.Value);
if (bitArray is null)
return new(new Exception($"Convert to BitArray failed"));
bitArray.Length = portNum;
return bitArray;
}
/// <summary>
/// 执行边界扫描并返回逻辑端口的状态
/// </summary>
/// <returns>包含逻辑端口状态的字典键为端口ID值为布尔状态</returns>
public async ValueTask<Result<Dictionary<string, bool>>> BoundaryScanLogicalPorts()
{
var bitArray = await BoundaryScan();
if (!bitArray.IsSuccessful) return new(bitArray.Error);
var paser = new BsdlParser.Parser();
var cellList = paser.GetBoundaryLogicalPorts();
if (cellList.IsNull) return new(new Exception("Get boundary logical ports failed"));
var portStatus = new Dictionary<string, bool>();
foreach (var cell in cellList.Value)
{
portStatus.Add(cell.PortID ?? "UnknownPortID", bitArray.Value[cell.CellNumber]);
}
return portStatus;
}
/// <summary>
/// 设置JTAG的运行速度。
/// </summary>
/// <param name="speed">运行速度值。</param>
/// <returns>指示操作是否成功的异步结果。</returns>
public async ValueTask<Result<bool>> SetSpeed(UInt32 speed)
{
// Clear Data
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace($"Clear up udp server {this.address} receive data");
var ret = await WriteFIFO(
JtagAddr.SPEED_CTRL, (speed << 16) | speed,
JtagState.CMD_EXEC_FINISH, JtagState.CMD_EXEC_FINISH);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}

37
server/src/MsgBus.cs Normal file
View File

@@ -0,0 +1,37 @@
/// <summary>
/// 多线程通信总线
/// </summary>
public static class MsgBus
{
private static readonly UDPServer udpServer = new UDPServer(1234);
/// <summary>
/// 获取UDP服务器
/// </summary>
public static UDPServer UDPServer { get { return udpServer; } }
private static bool isRunning = false;
/// <summary>
/// 获取通信总线运行状态
/// </summary>
public static bool IsRunning { get { return isRunning; } }
/// <summary>
/// 通信总线初始化
/// </summary>
/// <returns>无</returns>
public static void Init()
{
udpServer.Start();
isRunning = true;
}
/// <summary>
/// 关闭通信总线
/// </summary>
/// <returns>无</returns>
public static void Exit()
{
udpServer.Stop();
isRunning = false;
}
}

View File

@@ -0,0 +1,170 @@
using System.Net;
using DotNext;
namespace Peripherals.DDSClient;
static class DDSAddr
{
/*地址定义以2路输出4波形存储为例
00 R/W CHANNEL0 wave_sel
01 R/W CHANNEL0 STORE0 freq_ctrl
02 R/W CHANNEL0 STORE1 freq_ctrl
03 R/W CHANNEL0 STORE2 freq_ctrl
04 R/W CHANNEL0 STORE3 freq_ctrl
05 R/W CHANNEL0 STORE0 phase_ctrl
06 R/W CHANNEL0 STORE1 phase_ctrl
07 R/W CHANNEL0 STORE2 phase_ctrl
08 R/W CHANNEL0 STORE3 phase_ctrl
09 R/W CHANNEL0 dds_wr_enable
0A WO CHANNEL0 data
10 R/W CHANNEL1 wave_sel
11 R/W CHANNEL1 STORE0 freq_ctrl
12 R/W CHANNEL1 STORE1 freq_ctrl
13 R/W CHANNEL1 STORE2 freq_ctrl
14 R/W CHANNEL1 STORE3 freq_ctrl
15 R/W CHANNEL1 STORE0 phase_ctrl
16 R/W CHANNEL1 STORE1 phase_ctrl
17 R/W CHANNEL1 STORE2 phase_ctrl
18 R/W CHANNEL1 STORE3 phase_ctrl
19 R/W CHANNEL1 dds_wr_enable
1A WO CHANNEL1 data
*/
public const UInt32 Base = 0x4000_0000;
public static readonly ChannelAddr[] Channel = { new ChannelAddr(0x00), new ChannelAddr(0x10) };
public class ChannelAddr
{
private readonly UInt32 Offset;
public readonly UInt32 WaveSelect;
public readonly UInt32[] FreqCtrl;
public readonly UInt32[] PhaseCtrl;
public readonly UInt32 WriteEnable;
public readonly UInt32 WriteData;
public ChannelAddr(UInt32 offset)
{
this.Offset = offset;
this.WaveSelect = Base + Offset + 0x00;
this.FreqCtrl = new UInt32[]
{
Base + offset + 0x01,
Base + offset + 0x02,
Base + offset + 0x03,
Base + offset + 0x04
};
this.PhaseCtrl = new UInt32[] {
Base + Offset + 0x05,
Base + Offset + 0x06,
Base + Offset + 0x07,
Base + Offset + 0x08
};
this.WriteEnable = Base + Offset + 0x09;
this.WriteData = Base + Offset + 0x0A;
}
}
}
/// <summary>
/// [TODO:description]
/// </summary>
public class DDS
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
readonly int timeout = 2000;
readonly int port;
readonly string address;
private IPEndPoint ep;
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="timeout">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public DDS(string address, int port, int timeout = 2000)
{
if (timeout < 0)
throw new ArgumentException("Timeout couldn't be negative", nameof(timeout));
this.address = address;
this.port = port;
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
this.timeout = timeout;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> SetWaveNum(int channelNum, int waveNum)
{
if (channelNum < 0 || channelNum > 1) return new(new ArgumentException(
$"Channel number should be 0 ~ 1 instead of {channelNum}", nameof(channelNum)));
if (waveNum < 0 || waveNum > 3) return new(new ArgumentException(
$"Wave number should be 0 ~ 3 instead of {waveNum}", nameof(waveNum)));
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
var ret = await UDPClientPool.WriteAddr(
this.ep, DDSAddr.Channel[channelNum].WaveSelect, (UInt32)waveNum, this.timeout);
if (!ret.IsSuccessful)
return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <param name="step">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> SetFreq(int channelNum, int waveNum, UInt32 step)
{
if (channelNum < 0 || channelNum > 1) return new(new ArgumentException(
$"Channel number should be 0 ~ 1 instead of {channelNum}", nameof(channelNum)));
if (waveNum < 0 || waveNum > 3) return new(new ArgumentException(
$"Wave number should be 0 ~ 3 instead of {waveNum}", nameof(waveNum)));
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
var ret = await UDPClientPool.WriteAddr(
this.ep, DDSAddr.Channel[channelNum].FreqCtrl[waveNum], step, this.timeout);
if (!ret.IsSuccessful)
return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="channelNum">[TODO:parameter]</param>
/// <param name="waveNum">[TODO:parameter]</param>
/// <param name="phase">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> SetPhase(int channelNum, int waveNum, int phase)
{
if (channelNum < 0 || channelNum > 1) return new(new ArgumentException(
$"Channel number should be 0 ~ 1 instead of {channelNum}", nameof(channelNum)));
if (waveNum < 0 || waveNum > 3) return new(new ArgumentException(
$"Wave number should be 0 ~ 3 instead of {waveNum}", nameof(waveNum)));
if (phase < 0 || phase > 4096) return new(new ArgumentException(
$"Phase should be 0 ~ 4096 instead of {phase}", nameof(phase)));
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
var ret = await UDPClientPool.WriteAddr(
this.ep, DDSAddr.Channel[channelNum].PhaseCtrl[waveNum], (UInt32)phase, this.timeout);
if (!ret.IsSuccessful)
return new(ret.Error);
return ret.Value;
}
}

View File

@@ -0,0 +1,89 @@
using System.Collections;
using System.Net;
using DotNext;
namespace Peripherals.MatrixKeyClient;
class MatrixKeyAddr
{
public const UInt32 BASE = 0x10_00_00_00;
public const UInt32 KEY_ENABLE = BASE + 5;
public const UInt32 KEY_CTRL = BASE + 6;
}
/// <summary>
/// 矩阵键盘外设类,用于控制和管理矩阵键盘的功能。
/// </summary>
public class MatrixKey
{
readonly int timeout;
readonly int port;
readonly string address;
private IPEndPoint ep;
/// <summary>
/// 构造函数,用于初始化矩阵键盘外设实例。
/// </summary>
/// <param name="address">设备的IP地址</param>
/// <param name="port">设备的端口号</param>
/// <param name="timeout">操作的超时时间毫秒默认为1000</param>
/// <returns>无返回值。</returns>
public MatrixKey(string address, int port, int timeout = 1000)
{
this.address = address;
this.port = port;
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
this.timeout = timeout;
}
/// <summary>
/// 启用矩阵键盘的控制功能。
/// </summary>
/// <returns>返回一个包含操作结果的异步任务</returns>
public async ValueTask<Result<bool>> EnableControl()
{
if (MsgBus.IsRunning)
await MsgBus.UDPServer.ClearUDPData(this.address);
else return new(new Exception("Message Bus not work!"));
var ret = await UDPClientPool.WriteAddr(this.ep, MatrixKeyAddr.KEY_ENABLE, 1, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// 禁用矩阵键盘的控制功能。
/// </summary>
/// <returns>返回一个包含操作结果的异步任务</returns>
public async ValueTask<Result<bool>> DisableControl()
{
if (MsgBus.IsRunning)
await MsgBus.UDPServer.ClearUDPData(this.address);
else return new(new Exception("Message Bus not work!"));
var ret = await UDPClientPool.WriteAddr(this.ep, MatrixKeyAddr.KEY_ENABLE, 0, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// 控制矩阵键盘的按键状态。
/// </summary>
/// <param name="keyStates">表示按键状态的位数组长度必须为16</param>
/// <returns>返回一个包含操作结果的异步任务</returns>
public async ValueTask<Result<bool>> ControlKey(BitArray keyStates)
{
if (MsgBus.IsRunning)
await MsgBus.UDPServer.ClearUDPData(this.address);
else return new(new Exception("Message Bus not work!"));
if (keyStates.Length != 16) return new(new ArgumentException(
$"The number of key should be 16 instead of {keyStates.Length}", nameof(keyStates)));
var ret = await UDPClientPool.WriteAddr(
this.ep, MatrixKeyAddr.KEY_CTRL, Common.Number.BitsToNumber(keyStates).Value, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}

View File

@@ -0,0 +1,56 @@
using System.Net;
using DotNext;
namespace Peripherals.PowerClient;
class PowerAddr
{
public const UInt32 Base = 0x10_00_00_00;
public const UInt32 PowerCtrl = Base + 7;
}
/// <summary>
/// [TODO:description]
/// </summary>
public class Power
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
readonly int timeout;
readonly int port;
readonly string address;
private IPEndPoint ep;
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="timeout">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public Power(string address, int port, int timeout = 1000)
{
this.address = address;
this.port = port;
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
this.timeout = timeout;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="enable">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> SetPowerOnOff(bool enable)
{
if (MsgBus.IsRunning)
await MsgBus.UDPServer.ClearUDPData(this.address);
else return new(new Exception("Message Bus not work!"));
var ret = await UDPClientPool.WriteAddr(this.ep, PowerAddr.PowerCtrl, Convert.ToUInt32(enable), this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}

View File

@@ -0,0 +1,554 @@
using System.Net;
using DotNext;
namespace RemoteUpdateClient;
static class RemoteUpdaterAddr
{
public const UInt32 Base = 0x20_00_00_00;
/// <summary>
/// ADDR: 0X00: 写Flash-读写地址——控制位 <br/>
/// [31:16]: wr_sector_num <br/>
/// [15: 0]: {flash_wr_en,-,-,-, start_wr_sector} <br/>
/// </summary>
public const UInt32 WriteCtrl = Base + 0x00;
/// <summary>
/// ADDR: 0X01: 写Flash-只写地址——FIFO入口 <br/>
/// [31:0]: 写比特流数据入口 <br/>
/// </summary>
public const UInt32 WriteFIFO = Base + 0x01;
/// <summary>
/// ADDR: 0X02: 写Flash-只读地址——标志位 <br/>
/// [31:24]: {-, -, -, -, -, -, -, wr_fifo_full} <br/>
/// [23:16]: {-, -, -, -, -, -, -, wr_fifo_empty} <br/>
/// [15: 8]: {-, -, -, -, -, -, -, flash_wr_done} <br/>
/// [ 7: 0]: {-, -, -, -, -, -, -, flash_clear_done} <br/>
/// </summary>
public const UInt32 WriteSign = Base + 0x02;
/// <summary>
/// ADDR: 0X03: 读Flash-读写地址——控制位1 <br/>
/// [31:16]: rd_sector_num <br/>
/// [15: 0]: {flash_rd_en,-,-,-, start_rd_sub_sector} <br/>
/// </summary>
public const UInt32 ReadCtrl1 = Base + 0x03;
/// <summary>
/// ADDR: 0X04: 读Flash-读写地址——控制位2 <br/>
/// [31:24]: { } <br/>
/// [23:16]: {-, -, -, -, -, -,{ bs_crc32_ok }} <br/>
/// [15: 8]: {-, -, -, -, -, -, -, crc_check_en} <br/>
/// [ 7: 0]: {-, -, -, -, -, -, -, bitstream_up2cpu_en} <br/>
/// </summary>
public const UInt32 ReadCtrl2 = Base + 0x04;
/// <summary>
/// ADDR: 0X05: 读Flash-只读地址——FIFO出口 <br/>
/// [31:0]: 读比特流数据出口 <br/>
/// </summary>
public const UInt32 ReadFIFO = Base + 0x05;
/// <summary>
/// ADDR: 0X06: 读Flash-只读地址——CRC校验值 <br/>
/// [31:0]: CRC校验值 bs_readback_crc <br/>
/// </summary>
public const UInt32 ReadCRC = Base + 0x06;
/// <summary>
/// ADDR: 0X07: 读Flash-只读地址——标志位 <br/>
/// [31:24]: {-, -, -, -, -, -, -, rd_fifo_afull} <br/>
/// [23:16]: {-, -, -, -, -, -, -, rd_fifo_empty} <br/>
/// [15: 8]: {-, -, -, -, -, -, -, flash_rd_done} <br/>
/// [ 7: 0]: {-, -, -, -, -, -, -, bs_readback_crc_valid} <br/>
/// </summary>
public const UInt32 ReadSign = Base + 0x07;
/// <summary>
/// ADDR: 0X08: 热启动开关-读写地址——控制位 <br/>
/// [31: 8]: hotreset_addr <br/>
/// [ 7: 0]: {-, -, -, -, -, -, -, hotreset_en} <br/>
/// </summary>
public const UInt32 HotResetCtrl = Base + 0x08;
/// <summary>
/// ADDR: 0X09: 只读地址 版本号 <br/>
/// [31: 0]: FPGA_VERSION[31:0] <br/>
/// </summary>
public const UInt32 Version = Base + 0x09;
}
static class FlashAddr
{
public static readonly UInt32[] Switch = { 0xFFFF, 0x0000, 0x2000, 0x4000 };
public static readonly UInt32[] Jump = { 0xFFFF, 0x1000, 0x3000, 0x5000 };
public static readonly UInt32[] Bitstream = { 0x006000, 0x406000, 0x806000, 0xC06000 };
}
/// <summary>
/// [TODO:description]
/// </summary>
public class RemoteUpdater
{
private static readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
const int FLASH_SECTOR_LENGTH = 4 * 1024;
readonly int timeout = 2000;
readonly int timeoutForWait = 60 * 1000;
readonly int port;
readonly string address;
private IPEndPoint ep;
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="address">[TODO:parameter]</param>
/// <param name="port">[TODO:parameter]</param>
/// <param name="timeout">[TODO:parameter]</param>
/// <param name="timeoutForWait">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public RemoteUpdater(string address, int port, int timeout = 2000, int timeoutForWait = 60 * 1000)
{
if (timeout < 0)
throw new ArgumentException("Timeout couldn't be negative", nameof(timeout));
this.address = address;
this.port = port;
this.ep = new IPEndPoint(IPAddress.Parse(address), port);
this.timeout = timeout;
this.timeoutForWait = timeoutForWait;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="flashAddr">[TODO:parameter]</param>
/// <param name="writeSectorNum">[TODO:parameter]</param>
/// <param name="bytesData">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> WriteFlash(UInt32 flashAddr, int writeSectorNum, byte[] bytesData)
{
// Assert
if (writeSectorNum <= 0 || writeSectorNum >= FLASH_SECTOR_LENGTH)
return new(new ArgumentException(
$"Write sector num should be 1 ~ 4096, but given {writeSectorNum}", nameof(writeSectorNum)));
if (bytesData.Length % (4 * 1024) != 0)
return new(new ArgumentException(
$"The length of data should be divided by 4096, bug given {bytesData.Length}", nameof(bytesData)));
{
var ret = await UDPClientPool.WriteAddr(
this.ep, RemoteUpdaterAddr.WriteCtrl,
Convert.ToUInt32((writeSectorNum << 16) | (1 << 15) | Convert.ToInt32(flashAddr / 4096)), this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Enable write flash failed"));
}
{
var ret = await UDPClientPool.ReadAddrWithWait(
this.ep, RemoteUpdaterAddr.WriteSign,
0x00_00_00_01, 0x00_00_00_01, this.timeoutForWait);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception(
$"Flash clear failed after {this.timeoutForWait} milliseconds"));
}
{
var ret = await UDPClientPool.WriteAddr(this.ep, RemoteUpdaterAddr.WriteFIFO, bytesData, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Send data to flash failed"));
}
{
var ret = await UDPClientPool.ReadAddrWithWait(
this.ep, RemoteUpdaterAddr.WriteSign,
0x00_00_01_00, 0x00_00_01_00, this.timeoutForWait);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> EnableBitstream(int bitstreamNum)
{
// Assert
if (bitstreamNum <= 0 || bitstreamNum > 3)
return new(new ArgumentException(
$"Bitsteam num should be 1 ~ 3 for EnableBitstream, but given {bitstreamNum}", nameof(bitstreamNum)));
var bytesData = new byte[FLASH_SECTOR_LENGTH];
Array.Fill<byte>(bytesData, 0xFF);
bytesData[FLASH_SECTOR_LENGTH - 1] = 0x01;
bytesData[FLASH_SECTOR_LENGTH - 2] = 0x33;
bytesData[FLASH_SECTOR_LENGTH - 3] = 0x2D;
bytesData[FLASH_SECTOR_LENGTH - 4] = 0x94;
var ret = await WriteFlash(FlashAddr.Switch[bitstreamNum], 1, bytesData);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> DisableBitstream(int bitstreamNum)
{
// Assert
if (bitstreamNum <= 0 || bitstreamNum > 3)
return new(new ArgumentException(
$"Bitsteam num should be 1 ~ 3 for DisableBitstream, but given {bitstreamNum}", nameof(bitstreamNum)));
var bytesData = new byte[FLASH_SECTOR_LENGTH];
Array.Fill<byte>(bytesData, 0xFF);
var ret = await WriteFlash(FlashAddr.Switch[bitstreamNum], 1, bytesData);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> WriteJumpCmd(int bitstreamNum)
{
// Assert
if (bitstreamNum <= 0 || bitstreamNum > 3)
return new(new ArgumentException(
$"Bitsteam num should be 1 ~ 3 for WriteJumpCmd, but given {bitstreamNum}", nameof(bitstreamNum)));
// Init data
var bytesData = new byte[FLASH_SECTOR_LENGTH];
for (int i = 3; i < FLASH_SECTOR_LENGTH; i += 4)
bytesData[i] = (byte)0xA0;
{
var bytesSrc = new byte[] { 0x01, 0x00, 0x00, 0xAB };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x04, 4);
}
{
var bytesSrc = new byte[] { 0x0B, 0x00, 0x00, 0x00 };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x08, 4);
}
{
var bytesSrc = new byte[] { 0x01, 0x00, 0xC0, 0xAB };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x34, 4);
}
{
var bytesSrc = new byte[] { 0x00, 0x00, 0x00, 0x00 };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x38, 4);
}
{
var bytesSrc = new byte[] { 0x01, 0x00, 0x00, 0xAC };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x3C, 4);
}
{
var bytesSrc = Common.Number.NumberToBytes(FlashAddr.Bitstream[bitstreamNum], 4).Value;
Buffer.BlockCopy(Common.Number.ReverseBytes(bytesSrc, 4).Value, 0, bytesData, 0x40, 4);
}
{
var bytesSrc = new byte[] { 0x01, 0x00, 0x80, 0xA8 };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x44, 4);
}
{
var bytesSrc = new byte[] { 0x0F, 0x00, 0x00, 0x00 };
Buffer.BlockCopy(bytesSrc, 0, bytesData, 0x48, 4);
}
var ret = await WriteFlash(FlashAddr.Jump[bitstreamNum], 1, bytesData);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> InitRemoteUpdate(int bitstreamNum)
{
// Assert
if (bitstreamNum < 0 || bitstreamNum > 3)
return new(new ArgumentException(
$"Bitsteam num should be 0 ~ 3 for InitRemoteUpdate, but given {bitstreamNum}", nameof(bitstreamNum)));
for (int i = 1; i <= 3; i++)
{
{
var ret = (i == bitstreamNum) ? await EnableBitstream(i) : await DisableBitstream(i);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception($"Write switch {i} failed"));
}
{
var ret = await WriteJumpCmd(i);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception($"Write jump {i} failed"));
}
}
return true;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <param name="bitstreamLen">[TODO:parameter]</param>
/// <param name="checkSum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> CheckBitstreamCRC(int bitstreamNum, int bitstreamLen, UInt32 checkSum)
{
{
var ret = await UDPClientPool.WriteAddr(this.ep, RemoteUpdaterAddr.ReadCtrl2, 0x00_00_00_00, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write read control 2 failed"));
}
{
var ret = await UDPClientPool.WriteAddr(
this.ep, RemoteUpdaterAddr.ReadCtrl1,
Convert.ToUInt32((bitstreamLen << 16) | (1 << 15) | Convert.ToInt32(FlashAddr.Bitstream[bitstreamNum] / 4096)),
this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write read control 1 failed"));
}
{
var ret = await UDPClientPool.ReadAddrWithWait(
this.ep, RemoteUpdaterAddr.ReadSign,
0x00_00_01_00, 0x00_00_01_00, this.timeoutForWait);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception(
$"Read bitstream failed after {this.timeoutForWait} milliseconds"));
}
{
var ret = await UDPClientPool.ReadAddr(this.ep, RemoteUpdaterAddr.ReadCRC, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
var bytes = ret.Value.Options.Data;
if (bytes is null)
return new(new Exception("CRC is null"));
var remoteCRC = Common.Number.BytesToUInt32(bytes);
if (!remoteCRC.IsSuccessful) return new(remoteCRC.Error);
logger.Debug($"Bitstream {bitstreamNum} Expected CRC: \t 0x{Convert.ToString(checkSum, 16)}");
logger.Debug($"Bitstream {bitstreamNum} Received CRC: \t 0x{Convert.ToString(remoteCRC.Value, 16)}");
return remoteCRC.Value == checkSum;
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
private async ValueTask<Result<bool>> HotReset(int bitstreamNum)
{
// Assert
if (bitstreamNum < 0 || bitstreamNum > 3)
return new(new ArgumentException(
$"Bitsteam num should be 0 ~ 3 for HotRest, but given {bitstreamNum}", nameof(bitstreamNum)));
var ret = await UDPClientPool.WriteAddr(
this.ep, RemoteUpdaterAddr.HotResetCtrl,
((FlashAddr.Bitstream[bitstreamNum] << 8) | 1), this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> HotResetBitstream(int bitstreamNum)
{
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
{
var ret = await InitRemoteUpdate(bitstreamNum);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Init remote update failed"));
}
{
var ret = await HotReset(bitstreamNum);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="goldenBitream">[TODO:parameter]</param>
/// <param name="bitstream1">[TODO:parameter]</param>
/// <param name="bitstream2">[TODO:parameter]</param>
/// <param name="bitstream3">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> UploadBitstreams(
byte[]? goldenBitream,
byte[]? bitstream1,
byte[]? bitstream2,
byte[]? bitstream3)
{
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
for (int bitstreamNum = 0; bitstreamNum < 4; bitstreamNum++)
{
byte[] bytesData;
if (bitstreamNum == 0 && goldenBitream is not null)
bytesData = goldenBitream;
else if (bitstreamNum == 1 && bitstream1 is not null)
bytesData = bitstream1;
else if (bitstreamNum == 2 && bitstream2 is not null)
bytesData = bitstream2;
else if (bitstreamNum == 3 && bitstream3 is not null)
bytesData = bitstream3;
else continue;
var bitstreamBlockNum = bytesData.Length / (4 * 1024);
{
var ret = await WriteFlash(FlashAddr.Bitstream[bitstreamNum], bitstreamBlockNum, bytesData);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write bitstream failed"));
}
{
var crc = Honoo.IO.Hashing.Crc.Create(Honoo.IO.Hashing.CrcName.CRC32_MPEG_2);
var checkSum = crc.ComputeFinal(bytesData);
var ret = await CheckBitstreamCRC(bitstreamNum, bitstreamBlockNum, checkSum.ToUInt32());
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) logger.Warn($"Bitstream {bitstreamNum} CRC32 not correct!");
else logger.Info($"Bitstream {bitstreamNum} CRC32 calibration passed");
}
}
return true;
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="bitstreamNum">[TODO:parameter]</param>
/// <param name="bytesData">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> UpdateBitstream(int bitstreamNum, byte[] bytesData)
{
if (bytesData.Length % (4 * 1024) != 0)
return new(new ArgumentException(
$"The length of data should be divided by 4096, bug given {bytesData.Length}", nameof(bytesData)));
var bitstreamBlockNum = bytesData.Length / (4 * 1024);
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
{
var ret = await InitRemoteUpdate(bitstreamNum);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Init remote update failed"));
}
{
var ret = await WriteFlash(FlashAddr.Bitstream[bitstreamNum], bitstreamBlockNum, bytesData);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return new(new Exception("Write bitstream failed"));
}
{
var crc = Honoo.IO.Hashing.Crc.Create(Honoo.IO.Hashing.CrcName.CRC32_MPEG_2);
var checkSum = crc.ComputeFinal(bytesData);
var ret = await CheckBitstreamCRC(bitstreamNum, bitstreamBlockNum, checkSum.ToUInt32());
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) logger.Warn("CRC32 not correct!");
else logger.Info("CRC32 calibration passed");
}
{
var ret = await HotReset(bitstreamNum);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <param name="enableBitstreamNum">[TODO:parameter]</param>
/// <param name="goldenBitream">[TODO:parameter]</param>
/// <param name="bitstream1">[TODO:parameter]</param>
/// <param name="bitstream2">[TODO:parameter]</param>
/// <param name="bitstream3">[TODO:parameter]</param>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<bool>> UpdateBitstreams(
int enableBitstreamNum,
byte[]? goldenBitream,
byte[]? bitstream1,
byte[]? bitstream2,
byte[]? bitstream3)
{
// Assert
if (goldenBitream is null && bitstream1 is null && bitstream2 is null && bitstream3 is null)
return new(new ArgumentException(
$"At least one bitstream should not be empty"));
if ((enableBitstreamNum == 0 && goldenBitream is null) ||
(enableBitstreamNum == 1 && bitstream1 is null) ||
(enableBitstreamNum == 2 && bitstream2 is null) ||
(enableBitstreamNum == 3 && bitstream3 is null))
return new(new ArgumentException($"Bitstream {enableBitstreamNum} shouldn't be empty"));
{
var ret = await UploadBitstreams(goldenBitream, bitstream1, bitstream2, bitstream3);
if (!ret.IsSuccessful) return new(ret.Error);
if (!ret.Value) return false;
}
{
var ret = await HotResetBitstream(enableBitstreamNum);
if (!ret.IsSuccessful) return new(ret.Error);
return ret.Value;
}
}
/// <summary>
/// [TODO:description]
/// </summary>
/// <returns>[TODO:return]</returns>
public async ValueTask<Result<UInt32>> GetVersion()
{
await MsgBus.UDPServer.ClearUDPData(this.address);
logger.Trace("Clear udp data finished");
{
var ret = await UDPClientPool.ReadAddr(this.ep, RemoteUpdaterAddr.Version, this.timeout);
if (!ret.IsSuccessful) return new(ret.Error);
var retData = ret.Value.Options.Data;
if (retData is null || retData.Length != 4) return new(new Exception("Failed to read remote update firmware version"));
var version = Common.Number.BytesToUInt32(retData);
return version;
}
}
}

Some files were not shown because too many files have changed in this diff Show More