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 +31 -30
- package/README.md +55 -56
- package/_selftest.mjs +1 -1
- package/package.json +2 -2
- package/skills/digital-logic-lectern/SKILL.md +24 -56
- package/skills/digital-logic-lectern/references/m1_number_code.md +1 -1
- package/skills/digital-logic-lectern/references/m2_boolean_algebra.md +1 -1
- package/skills/digital-logic-lectern/references/m3_combinational.md +1 -1
- package/skills/digital-logic-lectern/references/m4_sequential.md +1 -1
- package/skills/digital-logic-lectern/references/m5_memory.md +1 -1
- package/skills/digital-logic-lectern/references/m6_pld_fpga.md +1 -1
- package/skills/digital-logic-lectern/references/m7_controller.md +1 -1
- package/skills/digital-logic-lectern/references/m8_verilog.md +1 -1
- package/skills/digital-logic-lectern/references/textbook_map.md +1 -1
- package/skills/digital-logic-lectern/scripts/dlquiz.js +451 -5
- package/skills/digital-logic-lectern/ui/book.js +1 -1
- package/skills/digital-logic-lectern/ui/index.html +1 -1
- package/skills/digital-logic-lectern/ui/questions.js +1025 -305
- package/skills/digital-logic-lectern/examples/demo_draft.md +0 -41
- package/skills/digital-logic-lectern/examples/demo_draft_bad.md +0 -24
- package/skills/digital-logic-lectern/examples/evidence.txt +0 -13
- package/skills/digital-logic-lectern/scripts/dlcheck.js +0 -145
package/README.en.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 数字逻辑辅助学习插件
|
|
2
|
+
|
|
3
|
+
npm package: `dsh-digital-logic-lectern`
|
|
2
4
|
|
|
3
5
|
Author: Liu Baiming(刘柏铭)|[中文](README.md)
|
|
4
6
|
|
|
5
|
-
A
|
|
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
|
|
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
|
-
|
|
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
|
|
19
|
+
Or enter the package name `dsh-digital-logic-lectern` in the Harness add-plugin dialog. A Git URL also works:
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
|
|
21
|
+
```
|
|
22
|
+
https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
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.
|
|
28
|
+
dsh plugin --profile <profile> add file:/absolute/path/dsh-digital-logic-lectern-0.6.4.tgz
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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 #
|
|
50
|
-
node scripts/dlquiz.js --build # generate
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
│
|
|
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/
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
7
|
+
面向《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020 年)的学习与练习插件,用于 DeepSeek Harness。插件提供一套课程知识库、一份 80 题的题库和一个网页界面;知识库按该教材目录自编,不是教材原文。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
插件包含一个技能和一个网页。技能负责解释概念、分步推导、核对计算结果、按教材范围出练习;网页负责看讲义、做章节自测、人机对战、收错题。网页可以在 DSH 应用内直接打开。
|
|
10
10
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
用 npm 安装:
|
|
13
|
+
从 npm 安装:
|
|
16
14
|
|
|
17
15
|
```bash
|
|
18
16
|
npm install dsh-digital-logic-lectern
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
或在 DSH 的添加插件对话框中填包名 `dsh-digital-logic-lectern`。也可以填 Git 地址:
|
|
22
20
|
|
|
23
|
-
```
|
|
24
|
-
|
|
21
|
+
```
|
|
22
|
+
https://github.com/MoroboshiAo/dsh-digital-logic-lectern.git
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
Git 方式会克隆仓库再安装,需要本机有 git 与网络。仓库已公开,不需要凭据。三种写法等价:npm 包名、Git 地址、本地目录或 tgz。
|
|
28
26
|
|
|
29
27
|
```bash
|
|
30
|
-
dsh plugin --profile
|
|
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`
|
|
31
|
+
也可以把 `skills/digital-logic-lectern` 复制到 `~/.dsh/skills/`。几种方式只选一种,重复安装会让同名技能互相遮蔽。安装后重启客户端。
|
|
34
32
|
|
|
35
|
-
##
|
|
33
|
+
## 打开页面
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
应用内三个入口:
|
|
38
36
|
|
|
39
|
-
-
|
|
40
|
-
-
|
|
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
|
-
|
|
54
|
+
仓库里已带生成好的 `ui/book.js` 与 `ui/questions.js`。改过 `references/` 后重跑这两条命令。`dlquiz --build` 会用 `dltool` 逐题复核计算题,答案不一致就拒绝写入;`--seed <数字>` 可换一批题,`--count <数字>` 可改题量。
|
|
57
55
|
|
|
58
|
-
##
|
|
56
|
+
## 页面
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
右上角方形按钮循环切换跟随系统、浅色、深色,选择保存在本地。
|
|
61
59
|
|
|
62
|
-
|
|
60
|
+
**学习。** 第一章到第七章,加 Verilog 附录与术语表。左侧目录可展开到小节(例如 1.1 → 1.1.1),搜索框同时搜标题与正文,术语表每一行都能跳到对应小节。页脚注明教材全名、主编、出版社、版次与版本号。
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
**自测。** 选章节、模式与题数后开始。人机对战有三档难度:
|
|
65
63
|
|
|
66
|
-
| 难度 |
|
|
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
|
-
|
|
70
|
+
题目越难,AI 正确率越低、延迟越短。鼠标点选或按 1–4 作答,回车进入下一题。
|
|
73
71
|
|
|
74
|
-
|
|
72
|
+
**错题本。** 答错自动收录,可重做、单条移除、整体清空。数据存在浏览器本地。
|
|
75
73
|
|
|
76
74
|
## 命令行工具
|
|
77
75
|
|
|
78
76
|
| 命令 | 用途 |
|
|
79
77
|
| --- | --- |
|
|
80
|
-
| `node scripts/dltool.js` |
|
|
81
|
-
| `node scripts/dlquiz.js` |
|
|
82
|
-
| `node scripts/dlbook.js` | 把 `references/`
|
|
83
|
-
| `node scripts/dlverify.js` |
|
|
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
|
|
95
|
-
│ └── appendix_verilog.md
|
|
89
|
+
├── SKILL.md 技能定义:学习卡结构、工具规则、模块索引、红线
|
|
90
|
+
├── references/ 八个模块卡、七章讲义、术语表、教材对照表
|
|
91
|
+
│ ├── textbook/ ch1 到 ch7,按教材章节与小节编排
|
|
92
|
+
│ └── appendix_verilog.md Verilog 附录,教材外补充
|
|
96
93
|
├── scripts/
|
|
97
94
|
│ ├── dltool.js 进制、编码、真值表、卡诺图、海明码
|
|
98
|
-
│ ├── dlquiz.js
|
|
99
|
-
│ ├── dlbook.js
|
|
100
|
-
│
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
lib/
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
-
|
|
113
|
-
-
|
|
114
|
-
- Verilog
|
|
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
|
|
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("
|
|
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.
|
|
4
|
-
"description": "数字逻辑辅助学习插件:按《数字逻辑》(第七版,白中英、朱正东主编,科学出版社,2020
|
|
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:
|
|
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
|
|
27
|
-
| 2
|
|
28
|
-
| 3
|
|
29
|
-
| 4
|
|
30
|
-
| 5
|
|
31
|
-
| 6 收口提问 | 30 秒能答的问题 + 标准答案 + 两个错答 | 问题只能有一个正确答案 |
|
|
26
|
+
| 1 结论 | 先给判断,再给理由 | 不超过 40 字 |
|
|
27
|
+
| 2 推导 | 分步说明为什么成立,每步一到两句 | 不重复结论原话 |
|
|
28
|
+
| 3 例题 | 一道具体题,带完整计算或判断过程 | 数字必须来自工具输出 |
|
|
29
|
+
| 4 易错点 | 一条错误直觉 + 一个推翻它的具体例子 | 具体到数值或波形 |
|
|
30
|
+
| 5 自测 | 一道能独立作答的题 + 答案 + 两个错答 | 只有一个正确答案 |
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
示例(讲「补码为什么能把减法变加法」时的骨架,不是成品讲稿):
|
|
32
|
+
示例(「补码为什么能把减法变加法」):
|
|
36
33
|
|
|
37
34
|
```
|
|
38
35
|
结论:补码把「减一个数」变成「加它的模补数」,进位自然丢弃。
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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`
|
|
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 #
|
|
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
|
-
##
|
|
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
|
+
- 用户没问的章节不要主动展开,一次只讲一个问题。
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
## 三点说明
|
|
22
22
|
|
|
23
|
-
1. 教材 5.5 节用 VHDL
|
|
23
|
+
1. 教材 5.5 节用 VHDL。回答涉及这一节时要说清“教材这里是 VHDL”,再给等价的 Verilog 写法,不能反过来说教材讲 Verilog。
|
|
24
24
|
2. 附录 Verilog 不属于教材目录,来源标注单独写“课程补充”,不与教材章节混排。
|
|
25
25
|
3. 讲义正文是按目录重写的知识要点,没有摘抄教材或课件的段落,也没有标注页码。
|
|
26
26
|
|