dsh-digital-logic-lectern 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -1,63 +1,63 @@
1
- # dsh-digital-logic-lectern
1
+ # 数字逻辑辅助学习插件
2
+
3
+ npm package: `dsh-digital-logic-lectern`
2
4
 
3
5
  Author: Liu Baiming(刘柏铭)|[中文](README.md)
4
6
 
5
- A lecture and practice plugin for a Digital Logic course, built for DeepSeek Harness. It follows the table of contents of *Digital Logic* (7th edition), edited by Bai Zhongying and Zhu Zhengdong, Science Press, 2020. The web pages are written against that outline; they are not a copy of the textbook.
7
+ A study and practice plugin for the Digital Logic course, built for DeepSeek Harness. It follows the table of contents of *Digital Logic* (7th edition), edited by Bai Zhongying and Zhu Zhengdong, Science Press, 2020. The notes are written against that outline; they are not a copy of the textbook.
6
8
 
7
- The plugin adds one skill and one web page. The skill writes a lecture: name a topic and it returns six parts — conclusion, board notes, derivation, counterexample, simulation, questions. The page is for practice: study a chapter, take a quiz on it, and wrong answers land in a review list. The page can open inside the DSH app.
9
+ The plugin ships one skill and one web page. The skill explains concepts, walks through derivations, checks numeric results with a command-line tool, and draws practice questions from the course bank. The page holds the notes, chapter quizzes, human-vs-AI matches, and a wrong-answer list. The page can open inside the DSH app.
8
10
 
9
11
  ## Install
10
12
 
11
- The course textbook is *Digital Logic* (7th edition), Bai Zhongying and Zhu Zhengdong (eds.), Science Press, 2020.
12
-
13
- Install from npm:
13
+ From npm:
14
14
 
15
15
  ```bash
16
16
  npm install dsh-digital-logic-lectern
17
17
  ```
18
18
 
19
- Or clone from GitHub and install the local directory:
19
+ Or enter the package name `dsh-digital-logic-lectern` in the Harness add-plugin dialog. A Git URL also works:
20
20
 
21
- ```bash
22
- git clone https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
21
+ ```
22
+ https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
23
23
  ```
24
24
 
25
- Install as a plugin by pointing the Harness add-plugin dialog at this directory, or at the packed tgz:
25
+ The Git route clones the repository before installing, so git and network access are required. The repository is public. The three routes are equivalent: npm name, Git URL, local directory or tgz.
26
26
 
27
27
  ```bash
28
- dsh plugin --profile <profile> add file:/absolute/path/dsh-digital-logic-lectern-0.6.3.tgz
28
+ dsh plugin --profile <profile> add file:/absolute/path/dsh-digital-logic-lectern-0.6.4.tgz
29
29
  ```
30
30
 
31
- You can also copy `skills/digital-logic-lectern` into `~/.dsh/skills/`. Pick one route; installing both makes the two copies of the same skill shadow each other. Restart the client afterwards.
31
+ Copying `skills/digital-logic-lectern` into `~/.dsh/skills/` works too. Pick one route; installing twice makes the two copies of the same skill shadow each other. Restart the client afterwards.
32
32
 
33
33
  ## Open the page
34
34
 
35
- There are three entry points inside the app:
35
+ Three entry points inside the app:
36
36
 
37
37
  - The 「数字逻辑」 icon at the bottom of the sidebar opens the page full screen.
38
38
  - Send `/logic-lectern` from the input box.
39
39
  - Find the plugin row on the Plugins page and press 「在应用内打开」.
40
40
 
41
- The plugin row also has two options: a default difficulty (easy / normal / hard) and a sidebar-entry switch. Both are stored locally. If you turn the sidebar icon off, the command and the plugin row still open the page. The default difficulty only decides which level is preselected when a quiz starts; you can still change it there.
41
+ The plugin row also has a default difficulty (easy / normal / hard) and a sidebar-entry switch, both stored locally. If the sidebar icon is off, the command and the plugin row still open the page. The default difficulty only preselects a level when a quiz starts.
42
42
 
43
- The client panel requires DSH 0.2.1-rc.2 or newer. Older hosts register the skill only. The page still works when opened directly in a browser.
43
+ The client panel requires DSH 0.2.1-rc.2 or newer. Older hosts register the skill only; the page still works when opened directly in a browser.
44
44
 
45
45
  To open it in a browser, generate the page data first:
46
46
 
47
47
  ```bash
48
48
  cd skills/digital-logic-lectern
49
- node scripts/dlbook.js --build # lectures -> page data
50
- node scripts/dlquiz.js --build # generate 40 questions and verify answers
49
+ node scripts/dlbook.js --build # notes -> page data
50
+ node scripts/dlquiz.js --build # generate 80 questions and verify answers
51
51
  start ui/index.html
52
52
  ```
53
53
 
54
- The repository already contains generated `ui/book.js` and `ui/questions.js`. Re-run the two commands after editing `references/`. `dlquiz --build` checks every calculation question with `dltool` and refuses to write if an answer disagrees. Add `--seed <number>` for another batch.
54
+ The repository already contains generated `ui/book.js` and `ui/questions.js`. Re-run both commands after editing `references/`. `dlquiz --build` checks every calculation question with `dltool` and refuses to write if an answer disagrees. Use `--seed <number>` for another batch or `--count <number>` for a different size.
55
55
 
56
56
  ## The page
57
57
 
58
- The square button at the top right cycles light, dark, and follow-system; the choice is stored locally.
58
+ The square button at the top right cycles follow-system, light, and dark; the choice is stored locally.
59
59
 
60
- **Study.** Chapters 1 to 7, plus a Verilog appendix and a glossary. The contents tree goes down to subsection level; the search box filters by keyword; every glossary row links to its subsection.
60
+ **Study.** Chapters 1 to 7, plus a Verilog appendix and a glossary. The contents tree goes down to subsection level, the search box covers headings and body text, and every glossary row links to its subsection. The footer carries the textbook title, editors, publisher, edition, and the plugin version.
61
61
 
62
62
  **Quiz.** Pick a chapter, a mode, and a question count. Human-vs-AI mode adds a difficulty level:
63
63
 
@@ -79,15 +79,14 @@ Harder questions lower the AI's accuracy and shorten its delay a little further.
79
79
  | `node scripts/dlquiz.js` | Generate questions and verify calculation answers with `dltool` |
80
80
  | `node scripts/dlbook.js` | Turn `references/` into page data |
81
81
  | `node scripts/dlverify.js` | Run simulations through iverilog |
82
- | `node scripts/dlcheck.js` | Check lecture structure, length, and numeric sourcing |
83
82
 
84
- Bit patterns in a lecture come from these outputs, not from mental arithmetic.
83
+ Bit patterns and numeric results come from these outputs, not from mental arithmetic.
85
84
 
86
85
  ## Layout
87
86
 
88
87
  ```
89
88
  skills/digital-logic-lectern/
90
- ├── SKILL.md skill body: six-part template, tool rules, demo scripts, limits
89
+ ├── SKILL.md skill: study-card structure, tool rules, module index, limits
91
90
  ├── references/ eight module cards, seven chapters, glossary, textbook map
92
91
  │ ├── textbook/ ch1 to ch7, following textbook sections and subsections
93
92
  │ └── appendix_verilog.md Verilog appendix, not in the textbook
@@ -95,24 +94,26 @@ skills/digital-logic-lectern/
95
94
  │ ├── dltool.js bases, codes, truth tables, Karnaugh maps, Hamming codes
96
95
  │ ├── dlquiz.js generate questions and verify them
97
96
  │ ├── dlbook.js build page data from references
98
- │ ├── dlverify.js run iverilog simulations
99
- │ └── dlcheck.js check lecture structure, length, sourcing
97
+ │ └── dlverify.js run iverilog simulations
100
98
  ├── ui/ three-tab page: index.html, book.js, questions.js, bupt-logo.png
101
- └── examples/ a counter and two sample lectures
99
+ └── examples/ counter example source
102
100
  lib/index.js plugin entry: register the skill, serve ui/ over static routes
103
101
  lib/client.js client entry: sidebar icon, main panel, plugin-row options, slash command
104
102
  locale/ Chinese and English title and summary for the plugin list
105
103
  cordis.patch.yml patch file required by the plugin manifest
106
104
  ```
107
105
 
106
+ ## Question bank
107
+
108
+ 80 questions across the eight modules. Calculation questions are generated by `dlquiz.js` and every answer is checked against `dltool`; concept questions are written from the topics covered by the textbook exercises and the companion answer set, and have not been reviewed question by question by an instructor. Exercise answers in this course rely heavily on figures and formulas, so the repository keeps the numeric and text questions that can be verified in a terminal rather than reproducing the original figures.
109
+
108
110
  ## Limits
109
111
 
110
- - The lectures follow the outline of *Digital Logic* (7th edition, Bai Zhongying and Zhu Zhengdong, Science Press, 2020). They are not the publisher's text. Section numbers were checked against the slide deck that ships with that edition; the mapping is in `references/textbook_map.md`. Section 5.5 of the textbook covers VHDL, while this course uses Verilog; lectures point out the difference.
112
+ - The notes follow the outline of *Digital Logic* (7th edition, Bai Zhongying and Zhu Zhengdong, Science Press, 2020). They are not the publisher's text. Section numbers were checked against the slide deck that ships with that edition; the mapping is in `references/textbook_map.md`. Section 5.5 of the textbook covers VHDL, while this course uses Verilog; the notes point out the difference.
111
113
  - The in-app page is an iframe over the same static page, so the review list and options live in the host page's local storage. Clearing site data or switching browsers loses them.
112
- - Simulation requires iverilog. Without it the tool fails loudly and lectures mark results as unverified.
113
- - The bank has 40 questions. Calculation questions are generated and verified by script; concept questions are hand-written and have not been reviewed by the instructor.
114
+ - Simulation requires iverilog. Without it `dlverify.js` fails loudly and prints install instructions; simulation results then have to be marked unverified.
114
115
  - Coverage is limited to the eight course modules. Analog circuits and lab-bench procedures are out of scope.
115
116
 
116
117
  ## License
117
118
 
118
- MIT, by Liu Baiming(刘柏铭). The textbook *Digital Logic* (7th edition, Bai Zhongying and Zhu Zhengdong, Science Press, 2020) remains under its publisher's copyright; this repository only maps terminology and teaching structure. The BUPT emblem in the page header belongs to the university and is used as a course mark only.
119
+ MIT, by Liu Baiming(刘柏铭). The textbook *Digital Logic* (7th edition, Bai Zhongying and Zhu Zhengdong, Science Press, 2020) remains under its publisher's copyright; this repository only maps terminology and chapter structure. The BUPT emblem in the page header belongs to the university and is used as a course mark only.
package/README.md CHANGED
@@ -4,117 +4,116 @@ npm 包名:`dsh-digital-logic-lectern`
4
4
 
5
5
  作者:刘柏铭(Liu Baiming)|[English](README.en.md)
6
6
 
7
- 数字逻辑课的讲解与练习插件,给 DeepSeek Harness 用。教材口径是《数字逻辑》(第七版),白中英、朱正东主编,科学出版社,2020 年;网页里的讲义按这本书的目录自编,不复制教材正文。
7
+ 面向《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)的学习与练习插件,用于 DeepSeek Harness。插件提供一套课程知识库、一份 80 题的题库和一个网页界面;知识库按该教材目录自编,不是教材原文。
8
8
 
9
- 装上之后多一个技能和一个网页。技能负责讲:说一个知识点,按「结论—板书—推导—反例—仿真—提问」六段出讲稿。网页负责练:先学一章,再测这一章,答错的自动进错题本。网页可以在 DSH 应用内打开。
9
+ 插件包含一个技能和一个网页。技能负责解释概念、分步推导、核对计算结果、按教材范围出练习;网页负责看讲义、做章节自测、人机对战、收错题。网页可以在 DSH 应用内直接打开。
10
10
 
11
11
  ## 安装
12
12
 
13
- 配套教材为《数字逻辑》(第七版),白中英、朱正东主编,科学出版社,2020 年。
14
-
15
- 用 npm 安装:
13
+ 从 npm 安装:
16
14
 
17
15
  ```bash
18
16
  npm install dsh-digital-logic-lectern
19
17
  ```
20
18
 
21
- 也可以从 GitHub 克隆后按本地目录安装:
19
+ 或在 DSH 的添加插件对话框中填包名 `dsh-digital-logic-lectern`。也可以填 Git 地址:
22
20
 
23
- ```bash
24
- git clone https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
21
+ ```
22
+ https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
25
23
  ```
26
24
 
27
- 插件方式,在 DeepSeek Harness 的添加插件窗口里填本目录的路径,或填打好的 tgz:
25
+ Git 方式会克隆仓库再安装,需要本机有 git 与网络。仓库已公开,不需要凭据。三种写法等价:npm 包名、Git 地址、本地目录或 tgz。
28
26
 
29
27
  ```bash
30
- dsh plugin --profile <配置名> add file:/绝对路径/dsh-digital-logic-lectern-0.6.3.tgz
28
+ dsh plugin --profile <profile> add file:/absolute/path/dsh-digital-logic-lectern-0.6.4.tgz
31
29
  ```
32
30
 
33
- 也可以把 `skills/digital-logic-lectern` 整个拷进 `~/.dsh/skills/`。两种方式选一种,别同时放,同名技能会互相盖住。装完重启客户端。
31
+ 也可以把 `skills/digital-logic-lectern` 复制到 `~/.dsh/skills/`。几种方式只选一种,重复安装会让同名技能互相遮蔽。安装后重启客户端。
34
32
 
35
- ## 打开插件页面
33
+ ## 打开页面
36
34
 
37
- 应用内打开有三个入口:
35
+ 应用内三个入口:
38
36
 
39
- - 侧栏底部的「数字逻辑」图标,点开是整页界面。
40
- - 输入框里发送 `/logic-lectern`。
41
- - 插件页找到本插件那一行,点「在应用内打开」。
37
+ - 侧栏底部的「数字逻辑」图标,整页打开。
38
+ - 输入框发 `/logic-lectern`。
39
+ - 插件页的插件行,按「在应用内打开」。
42
40
 
43
- 插件行里还有两个选项:默认难度(简单 / 普通 / 困难)与侧栏入口开关。选择存在本机;关掉侧栏图标后,命令和插件行仍然能打开页面。默认难度只影响自测页开局时选中哪一档,开始后还能改。
41
+ 插件行还有两个选项:默认难度(简单 / 普通 / 困难)与侧栏入口开关,保存在本地。关掉侧栏图标后,命令和插件行仍可打开页面。默认难度只决定开始自测时预选哪一档,进入后仍可改。
44
42
 
45
- 客户端面板需要 DSH 0.2.1-rc.2 或更高。更低的版本只注册技能,不出现图标和命令,网页仍可用浏览器单独打开。
43
+ 客户端面板需要 DSH 0.2.1-rc.2 或更新版本;旧版本只注册技能,网页在浏览器里打开同样可用。
46
44
 
47
- 浏览器单独打开时,先生成页面数据:
45
+ 浏览器打开前先生成页面数据:
48
46
 
49
47
  ```bash
50
48
  cd skills/digital-logic-lectern
51
- node scripts/dlbook.js --build # 讲义转成页面数据
52
- node scripts/dlquiz.js --build # 生成四十道题并复核答案
49
+ node scripts/dlbook.js --build # 讲义 → 页面数据
50
+ node scripts/dlquiz.js --build # 生成 80 题并复核计算题
53
51
  start ui/index.html
54
52
  ```
55
53
 
56
- 仓库里已经带了生成好的 `ui/book.js` 与 `ui/questions.js`。改过 `references/` 再重跑这两条命令。`dlquiz --build` 会拿 `dltool` 把每道计算题的答案对一遍,对不上就报错,不写文件;想换一批题,加 `--seed 随便一个数字`。
54
+ 仓库里已带生成好的 `ui/book.js` 与 `ui/questions.js`。改过 `references/` 后重跑这两条命令。`dlquiz --build` 会用 `dltool` 逐题复核计算题,答案不一致就拒绝写入;`--seed <数字>` 可换一批题,`--count <数字>` 可改题量。
57
55
 
58
- ## 网页
56
+ ## 页面
59
57
 
60
- 右上角的方形按钮切换浅色、深色与跟随系统,选择记在本机。
58
+ 右上角方形按钮循环切换跟随系统、浅色、深色,选择保存在本地。
61
59
 
62
- **学习**:第一至第七章,加 Verilog 附录与术语表。目录展开到小节,顶部搜索框按关键词过滤,术语表每行可跳到对应小节。
60
+ **学习。** 第一章到第七章,加 Verilog 附录与术语表。左侧目录可展开到小节(例如 1.1 → 1.1.1),搜索框同时搜标题与正文,术语表每一行都能跳到对应小节。页脚注明教材全名、主编、出版社、版次与版本号。
63
61
 
64
- **自测**:选章节、玩法、题数。人机对战另选难度:
62
+ **自测。** 选章节、模式与题数后开始。人机对战有三档难度:
65
63
 
66
- | 难度 | AI 正确率基数 | 抢答延迟 | 答对得分 |
64
+ | 难度 | 基础正确率 | 答题延迟 | 每题得分 |
67
65
  | --- | --- | --- | --- |
68
66
  | 简单 | 58% | 3.3–5.5 秒 | 60 |
69
67
  | 普通 | 80% | 2.5–4.2 秒 | 100 |
70
68
  | 困难 | 93% | 1.7–2.8 秒 | 150 |
71
69
 
72
- 题目本身越难,AI 的延迟和正确率会再往下走一点。作答可以点选项,也可以按键盘 1 到 4,回车进下一题。
70
+ 题目越难,AI 正确率越低、延迟越短。鼠标点选或按 1–4 作答,回车进入下一题。
73
71
 
74
- **错题本**:答错的题自动收进来,可以重做。数据存在浏览器本地,关掉页面还在。
72
+ **错题本。** 答错自动收录,可重做、单条移除、整体清空。数据存在浏览器本地。
75
73
 
76
74
  ## 命令行工具
77
75
 
78
76
  | 命令 | 用途 |
79
77
  | --- | --- |
80
- | `node scripts/dltool.js` | 进制换算、原码反码补码移码、格雷码、BCD、真值表、卡诺图化简、海明码 |
81
- | `node scripts/dlquiz.js` | 出题,并用 `dltool` 复核计算题答案 |
82
- | `node scripts/dlbook.js` | 把 `references/` 转成网页讲义数据 |
83
- | `node scripts/dlverify.js` | 调 iverilog 跑仿真 |
84
- | `node scripts/dlcheck.js` | 检查讲稿的结构、时长与数字溯源 |
78
+ | `node scripts/dltool.js` | 进制转换、原码/反码/补码、移码、格雷码、BCD、真值表、卡诺图、海明码 |
79
+ | `node scripts/dlquiz.js` | 生成题库并用 `dltool` 复核计算题 |
80
+ | `node scripts/dlbook.js` | 把 `references/` 转成页面数据 |
81
+ | `node scripts/dlverify.js` | 通过 iverilog 跑 Verilog 仿真 |
85
82
 
86
- 讲稿里出现的位模式都从这些输出里抄,不靠口算。
83
+ 回答里的位模式与计算结果都取自这些命令的输出,不靠口算。
87
84
 
88
85
  ## 目录
89
86
 
90
87
  ```
91
88
  skills/digital-logic-lectern/
92
- ├── SKILL.md 技能主体:六段模板、工具规则、演示脚本、红线
93
- ├── references/ 八个模块的讲解卡、七章讲义、术语表、教材对照表
94
- │ ├── textbook/ ch1 至 ch7,按教材节与小节写
95
- │ └── appendix_verilog.md 教材没有的 Verilog 附录
89
+ ├── SKILL.md 技能定义:学习卡结构、工具规则、模块索引、红线
90
+ ├── references/ 八个模块卡、七章讲义、术语表、教材对照表
91
+ │ ├── textbook/ ch1 到 ch7,按教材章节与小节编排
92
+ │ └── appendix_verilog.md Verilog 附录,教材外补充
96
93
  ├── scripts/
97
94
  │ ├── dltool.js 进制、编码、真值表、卡诺图、海明码
98
- │ ├── dlquiz.js 出题,并调用 dltool 复核
99
- │ ├── dlbook.js 把 references 转成网页讲义
100
- │ ├── dlverify.js 调 iverilog 跑仿真
101
- │ └── dlcheck.js 检查讲稿的结构、时长、数字溯源
102
- ├── ui/ 三页签网页:index.html、book.js、questions.js、bupt-logo.png
103
- └── examples/ 计数器和两份示例讲稿
104
- lib/index.js 插件入口:注册技能,挂载 ui/ 的静态路由
105
- lib/client.js 客户端入口:侧栏图标、主页面板、插件行选项、斜杠命令
106
- locale/ 插件列表里的中英文名称与简介
107
- cordis.patch.yml 插件清单要的补丁文件
95
+ │ ├── dlquiz.js 生成题库并复核
96
+ │ ├── dlbook.js 由 references 生成页面数据
97
+ │ └── dlverify.js 调用 iverilog 跑仿真
98
+ ├── ui/ 三栏页面:index.html、book.js、questions.js、bupt-logo.png
99
+ └── examples/ 计数器示例源码
100
+ lib/index.js 插件入口:注册技能,提供网页静态路由
101
+ lib/client.js 客户端入口:侧栏图标、主面板、插件行选项、斜杠命令
102
+ locale/ 插件列表中的中英文名称与简介
103
+ cordis.patch.yml 插件清单要求的补丁文件
108
104
  ```
109
105
 
110
- ## 已知限制
106
+ ## 题库
107
+
108
+ 80 题,覆盖八个模块。计算题由 `dlquiz.js` 随机生成,答案经 `dltool` 复核;概念题按教材习题范围与配套答案整理的考点手写,未逐题送教师审阅。数字逻辑的习题答案涉及大量图形与公式,本仓库不复刻原题图片,只保留可在终端复核的数值题与文字题。
109
+
110
+ ## 限制
111
111
 
112
- - 讲义按《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)的目录自编,不是出版社教材原文。章节号按该版配套课件目录核对过,对照表在 `references/textbook_map.md`。教材 5.5 讲 VHDL,本插件按课程要求写 Verilog,讲稿里会点明差异。
113
- - 应用内页面用 iframe 嵌入同一个静态页面,错题本与选项存在宿主页面的本地存储里。换浏览器或清理站点数据会丢。
114
- - Verilog 仿真要自己装 iverilog。没装时工具直接报错,讲稿只能标「未验证」。
115
- - 题库四十道,计算题由脚本生成并复核,概念题手写。概念题措辞没经过老师审,课堂使用前请自己过一遍。
116
- - 只覆盖这门课的八个模块,不含模拟电路,也不含实验箱操作步骤。
112
+ - 讲义按《数字逻辑》(第七版)目录自编,不是出版社原文。章节号已按该版配套课件核对,对照表在 `references/textbook_map.md`。教材 5.5 节用 VHDL,本课程用 Verilog,讲义会指出差异。
113
+ - 网页是宿主面板里的 iframe,错题与选项存在宿主页面的 localStorage;清除站点数据或换浏览器会丢失。
114
+ - Verilog 仿真需要本机安装 iverilog。没装时 `dlverify.js` 会直接报错并给出安装指引,不会伪造结果;此时任何仿真结论只能标「未验证」。
115
+ - 范围限于八个课程模块,模拟电路与实验台操作不在内。
117
116
 
118
117
  ## 许可
119
118
 
120
- MIT,作者刘柏铭(Liu Baiming)。教材《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)的版权归原出版社,本仓库只做术语与教学结构的对应。页面左上角的北京邮电大学校徽版权归学校所有,仅作课程标识使用。
119
+ MIT,作者刘柏铭(Liu Baiming)。《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)版权归出版社所有,本仓库只做术语与章节结构的对照。页面左上角北京邮电大学校徽归学校所有,仅作课程标识。
package/_selftest.mjs CHANGED
@@ -59,7 +59,7 @@ assert.ok(skill.description.length > 20, "description 不能为空或过短");
59
59
  assert.ok(skill.whenToUse.length > 10, "whenToUse 应存在");
60
60
  assert.equal(skill.source, "dsh-digital-logic-lectern");
61
61
  assert.ok(!skill.content.startsWith("---"), "正文不应包含 frontmatter");
62
- assert.ok(skill.content.includes("六件套"), "正文应是 SKILL.md 的主体");
62
+ assert.ok(skill.content.includes("学习卡"), "正文应是 SKILL.md 的主体");
63
63
  assert.equal(skill.resourceBase.kind, "directory");
64
64
  assert.ok(existsSync(join(skill.resourceBase.path, "scripts", "dltool.js")), "resourceBase 下应有 scripts/dltool.js");
65
65
  assert.ok(existsSync(join(skill.resourceBase.path, "references", "m1_number_code.md")), "references 应完整");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-digital-logic-lectern",
3
- "version": "0.6.3",
4
- "description": "数字逻辑辅助学习插件:按《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)目录自编的七章讲义与术语表、全文搜索、章节自测(含人机对战难度)、错题本、确定性计算工具、iverilog 仿真;插件网页可在 DSH 应用内直接打开。",
3
+ "version": "0.6.4",
4
+ "description": "数字逻辑辅助学习插件:按《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)目录自编的七章讲义与术语表、全文搜索、80 题章节自测(含人机对战难度)、错题本、确定性计算工具、iverilog 仿真;插件网页可在 DSH 应用内直接打开。",
5
5
  "author": "刘柏铭(Liu Baiming)",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: digital-logic-lectern
3
- description: 数字逻辑(数电)课程的上台讲解助手。覆盖数制与编码、逻辑代数与卡诺图、组合逻辑、时序逻辑、存储器、可编程逻辑器件、数字系统与控制器、Verilog HDL 八个模块。按「结论—板书—推导—反例—仿真—提问」六件套产出可以直接照读的课堂讲稿;所有进制、编码、卡诺图结果由 scripts/dltool.js 计算,所有 Verilog 结论由 scripts/dlverify.js 实跑。
4
- whenToUse: 用户要讲数电或数字逻辑的某个知识点、准备课堂汇报与答疑、需要板书顺序、需要卡诺图化简或进制编码的准确结果、需要课堂现场演示时。写普通程序、调界面布局、问非课程内容不要加载本技能。
3
+ description: 数字逻辑(数电)课程的学习助手。覆盖数制与编码、逻辑代数与卡诺图、组合逻辑、时序逻辑、存储器、可编程逻辑器件、数字系统与控制器、Verilog HDL 八个模块。讲解按「结论—推导—例题—易错点—自测」组织;所有进制、编码、卡诺图结果由 scripts/dltool.js 计算,所有 Verilog 结论由 scripts/dlverify.js 实跑。
4
+ whenToUse: 用户要理解数电或数字逻辑的某个知识点、做课程习题、核对卡诺图化简或进制编码结果、查术语、跑 Verilog 仿真时。写普通程序、调界面布局、问非课程内容不要加载本技能。
5
5
  ---
6
6
 
7
7
  # 数字逻辑辅助学习插件
8
8
 
9
9
  作者:刘柏铭(Liu Baiming)。
10
10
 
11
- 本技能不产出教材,只产出**能站在讲台上照着讲的东西**。
11
+ 本技能服务课程学习:把概念讲清楚,把计算结果做实,把练习对上教材范围。
12
12
 
13
13
  ## 0 用法与边界
14
14
 
@@ -17,35 +17,31 @@ whenToUse: 用户要讲数电或数字逻辑的某个知识点、准备课堂汇
17
17
  - 技能目录记为 `<SKILL_ROOT>`,即本文件所在目录。下文所有命令都在这个目录下执行。
18
18
  - 只回答本课程范围内的问题。用户问别的,说明不在范围内,不要硬套。
19
19
 
20
- ## 1 六件套:唯一允许的讲稿结构
20
+ ## 1 学习卡:讲解的统一结构
21
21
 
22
- 每一张讲解卡固定六段,顺序不许换。缺任何一段都算未完成。
22
+ 每次讲一个知识点,按下面五段组织,顺序固定。某一节确实没有内容时,写一句「本题不涉及」,不要留空。
23
23
 
24
24
  | 段 | 内容 | 硬性限制 |
25
25
  | --- | --- | --- |
26
- | 1 结论先行 | 先给判断,再给理由 | 不超过 40 字 |
27
- | 2 板书主线 | 只写「黑板上写什么」,每步一行 | 不超过 7 步 |
28
- | 3 推导口播 | 每步一到两句,讲为什么合法、学生卡在哪 | 不重复板书内容 |
29
- | 4 反例 | 一条错误直觉 + 一个推翻它的具体例子 | 必须具体到数值或波形 |
30
- | 5 仿真佐证 | 工具命令 + 真实输出 | 没跑过就标「未验证」 |
31
- | 6 收口提问 | 30 秒能答的问题 + 标准答案 + 两个错答 | 问题只能有一个正确答案 |
26
+ | 1 结论 | 先给判断,再给理由 | 不超过 40 字 |
27
+ | 2 推导 | 分步说明为什么成立,每步一到两句 | 不重复结论原话 |
28
+ | 3 例题 | 一道具体题,带完整计算或判断过程 | 数字必须来自工具输出 |
29
+ | 4 易错点 | 一条错误直觉 + 一个推翻它的具体例子 | 具体到数值或波形 |
30
+ | 5 自测 | 一道能独立作答的题 + 答案 + 两个错答 | 只有一个正确答案 |
32
31
 
33
- 时长纪律:默认一张卡 6 分钟。汇报场景按 90 秒切分。超时先砍第 3 段,第 4、5 段不许砍。
34
-
35
- 示例(讲「补码为什么能把减法变加法」时的骨架,不是成品讲稿):
32
+ 示例(「补码为什么能把减法变加法」):
36
33
 
37
34
  ```
38
35
  结论:补码把「减一个数」变成「加它的模补数」,进位自然丢弃。
39
- 板书:1) 8 位模 256 2) -5 的补码 3) 3-5 = 3+251 4) 256 进位溢出丢弃 5) 结果 -2
40
- 口播:模运算下 a-b 与 a+(256-b) 同余,硬件只保留低 8 位。
41
- 反例:以为「补码就是反码加一」所以 -128 也有反码——实际 -128 没有原码和反码。
42
- 佐证:node <SKILL_ROOT>/scripts/dltool.js code --bits 8 --value -5
43
- 提问:8 位补码里 10000000 表示几?为什么它没有相反数?
36
+ 推导:模运算下 a-b 与 a+(256-b) 同余,硬件只保留低 8 位。
37
+ 例题:3-5 = 3+251 = 254,按 8 位补码读作 -2。
38
+ 易错:以为「补码就是反码加一」所以 -128 也有反码——实际 -128 没有原码和反码。
39
+ 自测:8 位补码里 10000000 表示几?为什么它没有相反数?
44
40
  ```
45
41
 
46
42
  ## 2 工具:数值结论必须来自这里
47
43
 
48
- 禁止口算进制、编码、真值表、卡诺图。现场算错一次,整节课的可信度就没了。
44
+ 禁止口算进制、编码、真值表、卡诺图。算错一次,后面的推导都不可信。
49
45
 
50
46
  ```bash
51
47
  node <SKILL_ROOT>/scripts/dltool.js base --from 10 --to 2 --value 259
@@ -63,9 +59,9 @@ node <SKILL_ROOT>/scripts/dlbook.js --build
63
59
 
64
60
  规则:
65
61
 
66
- - 讲稿里出现的每个位模式、每个最小项,都要能在工具输出里找到。
67
- - `kmap` 输出的「回验」一行必须照抄进讲稿,它是化简正确性的证据。
68
- - 加 `--json` 得到机器可读结果。需要给 `dlcheck` 提供证据时,把工具的人类可读输出重定向到 `evidence.txt`,再用 `--evidence` 传进去。
62
+ - 回答里出现的每个位模式、每个最小项,都要能在工具输出里找到。
63
+ - `kmap` 输出的「回验」一行要原样引用,它是化简正确性的证据。
64
+ - 加 `--json` 得到机器可读结果。
69
65
 
70
66
  Verilog 部分:
71
67
 
@@ -73,7 +69,7 @@ Verilog 部分:
73
69
  node <SKILL_ROOT>/scripts/dlverify.js <设计.v> <testbench.v>
74
70
  ```
75
71
 
76
- 它调用 iverilog 编译、vvp 运行,返回编译状态、仿真输出与波形表。设计和测试台要一起传,少传会报 `Unknown module type`。本机没装 iverilog 时会明确报错并给安装指引,此时讲稿只能写「未验证」。
72
+ 它调用 iverilog 编译、vvp 运行,返回编译状态、仿真输出与波形表。设计和测试台要一起传,少传会报 `Unknown module type`。本机没装 iverilog 时会明确报错并给安装指引,此时结论只能写「未验证」。
77
73
 
78
74
  ## 3 模块索引
79
75
 
@@ -92,27 +88,7 @@ node <SKILL_ROOT>/scripts/dlverify.js <设计.v> <testbench.v>
92
88
 
93
89
  术语不确定时查 `references/glossary.md`;教材章节对照查 `references/textbook_map.md`。
94
90
 
95
- ## 4 课堂演示:五分钟脚本
96
-
97
- 用户说「演示一下」时,按这个顺序跑,边跑边讲。每一步的台词就是第 1 节六件套的浓缩版。
98
-
99
- 1. **进制与补码(60 秒)**
100
- `dltool.js base --from 10 --to 2 --value 259`,让对方看除基取余的余数序列,强调「逆序读」。
101
- 接 `dltool.js code --bits 8 --value -5`,指出反码到补码只差末位加一。
102
- 2. **卡诺图化简(120 秒)**
103
- `dltool.js kmap --vars 4 --minterms 0,1,2,5,8,9,10 --dontcares 14`。
104
- 先让对方口算,再展示工具的质蕴含项与最简式,最后指「回验:16 个输入逐一求值,全部一致」这一行——这是机器验算,不是我说它对。
105
- 3. **编码与纠错(60 秒)**
106
- `dltool.js hamming --data 1011` 得到 7 位码,故意改一位,再用 `--check` 让工具指出出错位号。
107
- 4. **Verilog 仿真(60 秒)**
108
- `dlverify.js examples/counter4.v examples/counter4_tb.v`。现场看计数器从 0 数到 15 再回绕,复位那一拍停在 0。
109
- 5. **讲稿自检(60 秒)**
110
- 先跑好稿:`dlcheck.js examples/demo_draft.md --minutes 4 --evidence examples/evidence.txt`,六项全绿。
111
- 再跑坏稿:`dlcheck.js examples/demo_draft_bad.md --minutes 4`,让它当场标红——错位模式、谎称验证通过、硬编码章节号各扣一项。这一步说明「讲稿里的数字不能手写」。
112
-
113
- 演示时的三条纪律:不念工具输出的全部内容,只念关键行;让对方先猜再揭晓;每步结束停三秒等反应。
114
-
115
- ## 5 图形界面:学、测、错题
91
+ ## 4 图形界面:学、测、错题
116
92
 
117
93
  `ui/index.html` 是纯静态页面,双击就能开,不联网、不需要服务器。分三块:
118
94
 
@@ -122,26 +98,18 @@ node <SKILL_ROOT>/scripts/dlverify.js <设计.v> <testbench.v>
122
98
 
123
99
  ```bash
124
100
  node scripts/dlbook.js --build # 讲义 → ui/book.js
125
- node scripts/dlquiz.js --build # 40 题 → ui/questions.js,生成时复核计算题
101
+ node scripts/dlquiz.js --build # 题库 → ui/questions.js,生成时复核计算题
126
102
  node scripts/dlquiz.js --check # 只复核,不写文件
127
103
  start ui/index.html # Windows 打开
128
104
  ```
129
105
 
130
- 课堂上这样用:让学生先翻开一章读两分钟,点「自测本章」做五题;错的进错题本,当场挑一道讲;最后跑一次人机对战,说明 AI 也是按同一套规则算的,不是背答案。
131
-
132
106
  出题纪律:只从 `ui/questions.js` 取题,不许临场编题;题目里的数字必须能通过 `dlquiz.js --check`。讲义只讲 `references` 里有的内容,不许拿教材原文冒充实拍。
133
107
 
134
- ## 6 门控
135
-
136
- - **讲解前**:确认场景(汇报 / 答疑 / 实验前)、时长、听众学到哪一章。信息不全就问,不要假设。
137
- - **骨架先行**:先只给「结论 + 板书 7 步」,用户点头再展开逐字稿。一次性输出全文是最常见的失败。
138
- - **交付前**:跑 `dlcheck.js`,展示结果,再让用户选形态:板书卡片 / 逐字稿 / PPT 大纲。
139
-
140
- ## 7 红线
108
+ ## 5 红线
141
109
 
142
110
  - 进制、编码、化简结果由 `dltool.js` 给出,口算结果视为错误。
143
111
  - 没跑过仿真不许写「验证通过」,只能写「未验证」。
144
112
  - 不编造教材章节号、页码、例题编号。
145
113
  - 不在正文堆定义。定义只在被追问时给,一次不超过三句。
146
- - 单卡不超过 8 分钟,超时就拆卡。
147
114
  - 不复制立体化教材配套线上资源的内容。
115
+ - 用户没问的章节不要主动展开,一次只讲一个问题。
@@ -4,7 +4,7 @@
4
4
 
5
5
  计算机只会加,不会减。减法是被补码"骗"过去的。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. 权展开:`(259)₁₀ = 2×10² + 5×10¹ + 9×10⁰`
10
10
  2. 除基取余,余数**逆序**读
@@ -4,7 +4,7 @@
4
4
 
5
5
  真值表是函数的身份证,表达式只是它的一种写法。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. 三种表示:真值表、表达式、逻辑图,三者可以互转
10
10
  2. 最小项:每个变量出现且只出现一次,函数值为 1 的那些编号
@@ -4,7 +4,7 @@
4
4
 
5
5
  组合逻辑没有记忆,输出只看当下这一拍输入。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. 分析三步:写表达式、列真值表、给功能命名
10
10
  2. 设计三步:列真值表、化简、画门电路
@@ -4,7 +4,7 @@
4
4
 
5
5
  时序逻辑的记忆不在门里,在反馈环里。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. 锁存器:电平触发,使能期间输入直通输出,叫"透明"
10
10
  2. 触发器:边沿触发,只在跳变沿采样一次
@@ -4,7 +4,7 @@
4
4
 
5
5
  存储器的容量是「字 × 位」,扩展就是这两个方向分别拼。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. 1K×4:1024 个字,每个字 4 位
10
10
  2. 位扩展:地址线全部并联,数据线拼接
@@ -4,7 +4,7 @@
4
4
 
5
5
  FPGA 的本质是一大堆可编程的真值表,再加上可编程的连线。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. PLD:与阵列可编程,或阵列固定,用与或式直接落地
10
10
  2. PAL/GAL:或阵列固定,输出极性可配置,GAL 可反复擦写
@@ -4,7 +4,7 @@
4
4
 
5
5
  控制器不做运算,它只决定下一步做什么。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. ASM 图:状态框、判断框、条件输出框,三者组合
10
10
  2. ASM 表:一行一个状态,列出次态与输出
@@ -4,7 +4,7 @@
4
4
 
5
5
  Verilog 不是编程,是在描述硬件怎么连、什么时候采样。
6
6
 
7
- ## 板书主线(不超过 7 步)
7
+ ## 讲解主线(不超过 7 步)
8
8
 
9
9
  1. `module` 声明端口,内部信号用 `wire` 与 `reg` 区分
10
10
  2. `assign` 描述组合逻辑,写出来就是一根线加一个门
@@ -20,7 +20,7 @@
20
20
 
21
21
  ## 三点说明
22
22
 
23
- 1. 教材 5.5 节用 VHDL。讲稿提到这一节时要说清“教材这里是 VHDL”,再给等价的 Verilog 写法,不能反过来说教材讲 Verilog。
23
+ 1. 教材 5.5 节用 VHDL。回答涉及这一节时要说清“教材这里是 VHDL”,再给等价的 Verilog 写法,不能反过来说教材讲 Verilog。
24
24
  2. 附录 Verilog 不属于教材目录,来源标注单独写“课程补充”,不与教材章节混排。
25
25
  3. 讲义正文是按目录重写的知识要点,没有摘抄教材或课件的段落,也没有标注页码。
26
26