[{"content":"OpenClaw 是一个个人 AI 助手框架，能把你的聊天统一接入 WhatsApp、Telegram、Discord、Web 等平台。除了 Web 控制台，它的真正能力藏在终端里。\n本文覆盖日常高频使用的 CLI 命令。\n1. 启动与健康检查 先用这几条确认 Gateway 是否正常运行：\n# 查看服务状态 openclaw gateway status # 快速健康探测 openclaw health # 自动诊断并修复问题 openclaw doctor # 查看日志 openclaw logs 如果 Gateway 还没跑起来：\nopenclaw gateway start # 以守护进程启动 openclaw gateway run # 前台运行（调试用） openclaw gateway restart # 重启 openclaw gateway stop # 停止 2. 打开会话 TUI 交互式终端 # 基本用法 —— 连到 Gateway，使用默认 \u0026#34;main\u0026#34; 会话 openclaw chat # 本地嵌入式模式（不需要 Gateway，需在环境变量中设置 API Key） openclaw chat --local # 指定自定义 session key openclaw chat --session mychat # 打开时设置推理深度 openclaw chat --thinking high # 启动时自动发送一条消息 openclaw chat --message \u0026#34;帮我分析一下这个项目\u0026#34; 单次 Agent 调用（不走 TUI） # 发一条消息，在终端获取回复 openclaw agent --message \u0026#34;帮我总结最近日志\u0026#34; # 指定某个 agent openclaw agent --agent ops --message \u0026#34;检查系统状态\u0026#34; # 发到手机号（会创建新会话） openclaw agent --to +15555550123 --message \u0026#34;你好\u0026#34; # 回复投递回聊天渠道 openclaw agent --deliver --message \u0026#34;报告已生成\u0026#34; 3. 选择 / 切换模型 查看当前默认模型 openclaw config get agents.defaults.model # 输出: { \u0026#34;primary\u0026#34;: \u0026#34;deepseek/deepseek-v4-pro\u0026#34; } 设置新默认模型 openclaw config set agents.defaults.model \u0026#34;anthropic/claude-sonnet-4-20250514\u0026#34; 单次运行指定模型 openclaw agent --model openai/gpt-4o --message \u0026#34;...\u0026#34; openclaw agent --model deepseek/deepseek-v4-pro --thinking high --message \u0026#34;...\u0026#34; 交互式配置 openclaw configure --section model 4. 查看会话历史 # 列出所有会话 openclaw sessions # 最近 50 条 openclaw sessions --limit 50 # 只看最近 2 小时活跃的 openclaw sessions --active 120 # 按 agent 过滤 openclaw sessions --agent work # 汇总所有 agent 的会话 openclaw sessions --all-agents # JSON 输出（方便脚本处理） openclaw sessions --json 5. 管理设备 当你用新设备（手机、平板、另一台电脑）登录时，会产生一个配对请求。需要在已授权的设备上批准：\n# 查看待处理和已配对的设备 openclaw devices list # 批准配对请求（用 request ID） openclaw devices approve \u0026lt;request-id\u0026gt; # 拒绝配对请求 openclaw devices reject \u0026lt;request-id\u0026gt; # 撤销设备授权 openclaw devices revoke \u0026lt;device-id\u0026gt; 6. 管理 Agent Agent 是独立的 AI 身份，有自己的工作区、模型和路由规则。\n# 列出所有 agent openclaw agents list # 新建 agent openclaw agents add # 查看路由绑定 openclaw agents bindings # 删除 agent openclaw agents delete \u0026lt;agent-id\u0026gt; 7. 管理消息渠道 openclaw channels 支持 Telegram、WhatsApp、Discord、Signal、Slack、iMessage、Matrix、LINE、飞书、企业微信（QQ Bot）、Microsoft Teams 等众多平台。\n8. 配置速查 # 读取配置项 openclaw config get gateway.port # 设置配置项 openclaw config set gateway.port 19001 # 删除配置项 openclaw config unset some.key # 校验配置合法性 openclaw config validate # 打印配置文件路径 openclaw config file # 交互式引导配置 openclaw configure 9. 定时任务（Cron） 安排定期或一次性的 Agent 任务：\nopenclaw cron list # 列出已调度任务 openclaw cron add # 创建新任务 openclaw cron run \u0026lt;id\u0026gt; # 立即触发任务 openclaw cron remove \u0026lt;id\u0026gt; # 删除任务 10. 备份 openclaw backup 创建 OpenClaw 状态的本地备份归档。\n实战流程示例 一个典型的运维排查流程：\n# 1. 看看系统是否健康 openclaw health # 2. 查看最近活跃的会话 openclaw sessions --active 60 # 3. 批准手机登录 openclaw devices list openclaw devices approve \u0026lt;id\u0026gt; # 4. 用指定模型开个聊天 openclaw chat --model deepseek/deepseek-v4-pro --thinking high # 5. 出问题后翻日志 openclaw logs 以上就是 OpenClaw 命令行的核心操作面。深入某个命令可以跑 openclaw \u0026lt;command\u0026gt; --help，或者查阅官方文档。\n","permalink":"https://chenshuaiming.com/zh/posts/openclaw-cli-guide/","summary":"\u003cp\u003eOpenClaw 是一个个人 AI 助手框架，能把你的聊天统一接入 WhatsApp、Telegram、Discord、Web 等平台。除了 Web 控制台，它的真正能力藏在终端里。\u003c/p\u003e\n\u003cp\u003e本文覆盖日常高频使用的 CLI 命令。\u003c/p\u003e","title":"OpenClaw 终端命令速查手册"},{"content":"在数字IC验证中，数组无处不在。寄存器模型、TLM端口列表、Scoreboard 中的 expected data queue、覆盖率 bin 定义……几乎每一个验证组件都离不开数组。\nSystemVerilog 提供了比 Verilog 丰富得多的数组类型和操作方法，用好了效率翻倍，用不好性能拉胯。\n本文从头梳理所有 SystemVerilog 数组类型，并给出实战建议。\n一、数组类型全景图 SystemVerilog 中有四大数组类型：\n类型 声明关键字 大小 适用场景 定长数组 [n] 编译时确定 固定位宽的信号、寄存器组 动态数组 [] + new[n] 运行时可变 不确定数量的 transaction、配置表 关联数组 [*] 或 [type] 通过 key 索引 稀疏存储、地址映射表 队列 [$] 按需增减 Scoreboard、FIFO、有序数据流 二、Packed vs Unpacked — 第一个分岔口 理解数组之前,先搞清楚一个核心概念：packed（压缩） 和 unpacked（非压缩）。\nPacked Array（压缩数组） // 位宽在名字左边 → packed，物理上连续存放 bit [7:0] byte_vec; // 单维度 packed，就是 8-bit 向量 bit [3:0][7:0] word_vec; // 二维 packed，4 个 byte，总共 32-bit 本质：一段连续的比特位，始终被视为一个整体 操作：可以整体参与算术/逻辑运算，也可以按位切片 存储：在内存中连续存储，没有额外开销 Unpacked Array（非压缩数组） // 位宽在名字右边 → unpacked，每个元素在内存中独立 bit byte_mem [0:7]; // 8 个 bit 的 unpacked 数组 int data_buf [256]; // 256 个 int 的 unpacked 数组 本质：一组独立元素的集合 操作：只能逐个元素操作，不能整体运算 存储：每个元素在内存中可能不连续 ⚠️ 常见坑 bit [7:0] a; // packed：一个 8-bit 变量 bit b [7:0]; // unpacked：8 个 1-bit 变量 a = 8\u0026#39;hFF; // ✅ 合法 b = 8\u0026#39;hFF; // ❌ 编译错误！不能整体赋值 unpacked 数组 bit [7:0] c [0:3]; // 混合：4 个 unpacked 元素，每个元素是 8-bit packed 经验法则：能 packed 尽量 packed，仿真效率高。但超过 64-bit 的综合效果可能变差。\n三、定长数组（Fixed-Size Array） 最基本的数组类型，所有维度在编译时确定。\n声明方式 // 一维定长 int arr1 [0:7]; // 8 个元素，下标 0~7 int arr2 [8]; // 等价于 [0:7] int arr3 [6:1]; // 6 个元素，下标 6,5,4,3,2,1 // 多维定长 int matrix [0:3][0:7]; // 4x8 二维 int cube [0:1][0:3][0:7]; // 2x4x8 三维 初始化 int arr [0:3] = \u0026#39;{0, 1, 2, 3}; // 列表初始化 int arr2[0:3] = \u0026#39;{default: -1}; // 全部初始化为 -1 int arr3[0:3] = \u0026#39;{0:10, 1:20, default: 0}; // 指定部分，其余默认 int matrix[0:2][0:1] = \u0026#39;{ \u0026#39;{0,1}, \u0026#39;{2,3}, \u0026#39;{4,5} }; // 多维初始化 遍历 // C-style for（不推荐） for (int i = 0; i \u0026lt; $size(arr); i++) $display(\u0026#34;arr[%0d] = %0d\u0026#34;, i, arr[i]); // foreach（推荐 ✅） foreach (arr[i]) $display(\u0026#34;arr[%0d] = %0d\u0026#34;, i, arr[i]); // 多维 foreach foreach (matrix[i, j]) $display(\u0026#34;matrix[%0d][%0d] = %0d\u0026#34;, i, j, matrix[i][j]); 为什么推荐 foreach？ 不需要自己算边界，不受声明维度顺序影响，代码更干净。\n系统函数速查 函数 含义 示例 $size(arr) 第一维度大小 $size(arr) → 8 $size(arr, 2) 指定维度大小 $size(matrix, 2) → 8 $dimensions(arr) 维度数 2 $left(arr) / $right(arr) 左/右边界 $left(arr[6:1]) → 6 $low(arr) / $high(arr) 最小/最大下标 $low(arr[6:1]) → 1 四、动态数组（Dynamic Array） 大小在运行时确定，通过构造函数 new[] 分配空间。\n核心操作 int dyn[]; // 声明：空，大小为 0 dyn = new[10]; // 分配 10 个元素（默认值为 0） dyn = new[20](dyn); // 扩容到 20，保留原数据 ✅ dyn = new[5]; // 缩小到 5，原数据丢失 ⚠️ dyn = \u0026#39;{1, 2, 3, 4, 5}; // 直接赋值（自动重新分配） dyn.delete(); // 清空，size 归 0 $display(\u0026#34;size = %0d\u0026#34;, dyn.size()); // 获取当前大小 实用技巧：array → queue → array int dyn[]; dyn = new[5]; foreach (dyn[i]) dyn[i] = i * 10; // 动态数组 → 队列 int q[$] = dyn; // 直接赋值 ✅ // 队列 → 动态数组 dyn = new[q.size()]; dyn = {\u0026gt;\u0026gt;{q}}; // streaming operator ⚠️ 常见陷阱 // ❌ 错误：未分配就访问 int dyn[]; dyn[0] = 5; // 运行时 fatal error！ // ❌ 错误：resize 不保留数据 int dyn[] = \u0026#39;{1,2,3,4,5}; dyn = new[10]; // 前5个数据丢失！新元素全是0 // ✅ 正确：扩容并保留 dyn = new[10](dyn); 黄金法则：永远在访问动态数组前检查 dyn.size()，或者确保已经 new[] 过。\n五、队列（Queue） 队列是 SystemVerilog 最灵活的数据结构，类似 C++ 的 std::deque。\n声明与初始化 int q1[$]; // 空队列（无界） int q2[$:255]; // 有界队列，最多 256 个元素 string names[$] = \u0026#39;{\u0026#34;alice\u0026#34;, \u0026#34;bob\u0026#34;, \u0026#34;charlie\u0026#34;}; 插入与删除 int q[$] = \u0026#39;{10, 20, 30}; // 尾部操作 q.push_back(40); // {10,20,30,40} q.push_back(50); // {10,20,30,40,50} q.pop_back(); // {10,20,30,40} // 头部操作 q.push_front(0); // {0,10,20,30,40} q.pop_front(); // {10,20,30,40} // 任意位置插入/删除 q.insert(2, 25); // {10,20,25,30,40} 在下标2处插入 q.delete(1); // {10,25,30,40} 删除下标1 q.delete(); // 清空整个队列 队列在验证中的经典用法 // Scoreboard：先进先出检查 class scoreboard; transaction exp_q[$]; // 期望队列 function void add_expected(transaction tr); exp_q.push_back(tr); endfunction function void check_actual(transaction tr); if (exp_q.size() == 0) begin `uvm_error(\u0026#34;SB\u0026#34;, \u0026#34;unexpected transaction!\u0026#34;) end else begin transaction exp = exp_q.pop_front(); if (!exp.compare(tr)) `uvm_error(\u0026#34;SB\u0026#34;, \u0026#34;mismatch!\u0026#34;) end endfunction endclass // 滑动窗口：保留最近 N 个采样 int sample_window[$:15]; // 最多 16 个 function void add_sample(int val); if (sample_window.size() == 16) sample_window.pop_front(); sample_window.push_back(val); endfunction 六、关联数组（Associative Array） 用 key（而非连续下标）来索引的数组，适合稀疏数据场景。\n声明 int aa_wild [*]; // 通配符索引（key 类型任意 integral） int aa_int [int]; // int 类型作 key int aa_str [string]; // string 类型作 key int aa_cls [some_class]; // class handle 作 key（少见） bit [63:0] aa_addr [bit [63:0]]; // 大位宽 key：地址映射 基本操作 int aa [string]; aa[\u0026#34;foo\u0026#34;] = 10; aa[\u0026#34;bar\u0026#34;] = 20; aa[\u0026#34;baz\u0026#34;] = 30; $display(\u0026#34;aa[bar] = %0d\u0026#34;, aa[\u0026#34;bar\u0026#34;]); // 20 // 检查 key 是否存在 if (aa.exists(\u0026#34;foo\u0026#34;)) $display(\u0026#34;foo exists\u0026#34;); // 删除 aa.delete(\u0026#34;bar\u0026#34;); // 删除单个 aa.delete(); // 删除全部 // 遍历 if (aa.first(key)) begin do $display(\u0026#34;aa[%s] = %0d\u0026#34;, key, aa[key]); while (aa.next(key)); end // 大小 $display(\u0026#34;size = %0d\u0026#34;, aa.num()); 典型场景：寄存器地址映射 class reg_model; uvm_reg reg_map [bit [31:0]]; // 32-bit 地址为 key function void build(); // 芯片只有 200 个寄存器，但地址空间是 4GB // 用关联数组只存实际存在的 reg_map[32\u0026#39;h4000_1000] = reg_ctrl; reg_map[32\u0026#39;h4000_1004] = reg_status; reg_map[32\u0026#39;h4000_2000] = reg_data; endfunction function uvm_reg get_reg(bit [31:0] addr); if (reg_map.exists(addr)) return reg_map[addr]; else begin `uvm_error(\u0026#34;REG\u0026#34;, $sformatf(\u0026#34;No register at addr 0x%h\u0026#34;, addr)) return null; end endfunction endclass ⚠️ 注意事项 exists() 读不存在的 key 不会创建 entry 直接读不存在的 key 会创建一个默认值 entry [*] 类型索引的 key 只能是 integral（非 class） 关联数组不支持 foreach，只能用 first()/next() 遍历 七、数组方法大全 SystemVerilog 为 unpacked 数组（定长、动态、队列）提供了一组强大的方法。\n7.1 缩减方法（Array Reduction） 对数组所有元素执行累积操作，返回单个值。\nint arr[] = \u0026#39;{1, 2, 3, 4, 5}; arr.sum(); // 15 求和 arr.product(); // 120 累乘 arr.and(); // 按位与 arr.or(); // 按位或 arr.xor(); // 按位异或 7.2 定位方法（Array Locator）— find 全家桶 int arr[] = \u0026#39;{1, 3, 5, 7, 2, 4, 6, 8}; // find → 返回所有匹配元素的队列 // find_first → 返回第一个匹配元素的队列（单元素） // find_last → 返回最后一个匹配元素的队列 // find_index → 返回匹配元素的下标队列 // find_first_index→ 第一个匹配元素的下标 // find_last_index → 最后一个匹配元素的下标 int q[$]; q = arr.find(x) with (x \u0026gt; 4); // {5, 7, 6, 8} q = arr.find_first(x) with (x \u0026gt; 4); // {5} q = arr.find_index(x) with (x \u0026gt; 4); // {2, 3, 5, 7} q = arr.find_first_index(x) with (x \u0026gt; 4);// {2} 7.3 with 子句高级用法 // item 是默认迭代变量，可以自定义名字 q = arr.find(item) with (item \u0026gt; 5 \u0026amp;\u0026amp; item \u0026lt; 8); // {7, 6} // 多维条件 class packet; int addr; bit is_write; endclass packet pkt_q[$]; // 找到所有 write transaction 的地址 int addr_q[$]; addr_q = pkt_q.find(p) with (p.is_write).addr; // ⚠️ 注意：.addr 不可链式 // ✅ 正确做法： addr_q = pkt_q.find(p) with (p.is_write); foreach (addr_q[i]) addr_q[i] = addr_q[i].addr; 7.4 排序方法 int arr[] = \u0026#39;{5, 2, 8, 1, 3}; arr.reverse(); // {3, 1, 8, 2, 5} 原地反转 arr.sort(); // {1, 2, 3, 5, 8} 升序 arr.rsort(); // {8, 5, 3, 2, 1} 降序 arr.shuffle(); // 随机打乱 // 自定义排序（with 子句） class packet; int id; int priority; endclass packet pkt_q[$]; // 按优先级降序排列 pkt_q.sort(p) with (p.priority); pkt_q.rsort(p) with (p.priority); // 降序 7.5 其他常用方法 int arr[] = \u0026#39;{1, 2, 3, 4, 5}; arr.min(); // 1 最小值 arr.max(); // 5 最大值 arr.unique(); // 去重，返回去重后的队列 arr.unique_index(); // 返回唯一元素的下标队列 int idx = arr.min(item) with (item % 2); // 偶数最小值：2 八、foreach 循环进阶 多维遍历 int arr[3][4]; // 3行4列 // ✅ 推荐：foreach foreach (arr[i, j]) arr[i][j] = i * 4 + j; // ❌ 不推荐：双重 for for (int i = 0; i \u0026lt; 3; i++) for (int j = 0; j \u0026lt; 4; j++) arr[i][j] = i * 4 + j; foreach 与队列/动态数组 int dyn[] = \u0026#39;{10, 20, 30, 40}; int q[$] = dyn; // 三种写法都合法 foreach (dyn[i]) $display(dyn[i]); foreach (q[i]) $display(q[i]); // ⚠️ 注意：遍历期间不要改变数组大小！会导致行为不确定 // ❌ foreach (q[i]) q.push_back(i); // 别这么干 九、综合 vs 仿真 — 关键差异 作为验证工程师，你写的大部分代码在仿真侧。但如果代码需要综合，下面几点很关键：\n特性 仿真 综合 定长 packed array ✅ ✅ 定长 unpacked array ✅ ✅ 有限支持 动态数组 ✅ ❌ 不可综合 关联数组 ✅ ❌ 不可综合 队列 ✅ ❌ 不可综合 foreach ✅ ✅ (SV 2017+) find/sort 等方法 ✅ ❌ 不可综合 $size / $dimensions ✅ ✅ 仿真建议：大胆用动态数组和队列，性能足够，表达力强。\n综合建议：只用定长 packed/unpacked 数组，慎用二维以上。\n十、刷题时间 — 常见面试/笔试陷阱 陷阱 1：new[] 不带参数 int arr[] = \u0026#39;{1, 2, 3, 4, 5}; arr = new[10]; // arr 变成 {0,0,0,0,0,0,0,0,0,0}，原数据丢失！ arr = new[10](arr); // ✅ 扩容且保留 陷阱 2：关联数组读不存在的 key int aa[string]; $display(\u0026#34;aa[key] = %0d\u0026#34;, aa[\u0026#34;nonexistent\u0026#34;]); // 输出 0，且创建了该 entry！ // aa.num() 现在是 1，不是 0！ 陷阱 3：find 返回的是队列 int arr[] = \u0026#39;{1, 2, 3, 4, 5}; int result = arr.find_first(x) with (x \u0026gt; 3); // ❌ 类型不匹配！find 返回队列！ int result_q[$] = arr.find_first(x) with (x \u0026gt; 3); // ✅ 用队列接收 int result = result_q[0]; // ✅ 再取第一个 陷阱 4：packed array 维度顺序 bit [3:0][7:0] a; // 4 个 byte，每个 byte 8 bit // a[3] = 高字节（MSB），a[0] = 低字节（LSB） a = 32\u0026#39;hDEAD_BEEF; $display(\u0026#34;a[3] = %h\u0026#34;, a[3]); // DE $display(\u0026#34;a[0] = %h\u0026#34;, a[0]); // EF $display(\u0026#34;a[3][7] = %b\u0026#34;, a[3][7]); // 1 (DE 的最高位) 十一、总结 需求 选型 固定数量信号/DUT 端口 定长 unpacked 拼接成总线整体传输 定长 packed 运行时才知道大小 动态数组 先入先出 / Scoreboard 队列 [$] 稀疏地址映射 关联数组 统计/搜索/排序 数组方法 (find, sort) 遍历数组 foreach（永远的首选） SystemVerilog 数组体系设计完善，掌握每个类型的适用场景和坑点，能让验证代码简洁数倍。别在不需要模拟的地方模拟 C 语言的双重 for 循环——SV 给了更好的工具，用起来。\n如果你觉得这篇文章对你有帮助，欢迎在 B站 关注我，我会持续分享数字IC验证技术内容。\n","permalink":"https://chenshuaiming.com/zh/posts/systemverilog-array-guide/","summary":"\u003cp\u003e在数字IC验证中，数组无处不在。寄存器模型、TLM端口列表、Scoreboard 中的 expected data queue、覆盖率 bin 定义……几乎每一个验证组件都离不开数组。\u003c/p\u003e\n\u003cp\u003eSystemVerilog 提供了比 Verilog 丰富得多的数组类型和操作方法，用好了效率翻倍，用不好性能拉胯。\u003c/p\u003e\n\u003cp\u003e本文从头梳理所有 SystemVerilog 数组类型，并给出实战建议。\u003c/p\u003e","title":"SystemVerilog 数组语法完全指南"},{"content":"Claude Code 是 Anthropic 推出的终端 AI 编程助手。它能理解你的整个代码库，编辑文件、执行 git 操作、调试、写文档——全部通过自然语言完成。\n本文覆盖 Ubuntu 下的所有安装方式，从零基础到进阶用户都适用。\n1. 环境要求 开始之前，确认你的系统满足以下条件：\n要求 最低配置 Ubuntu 20.04 及以上 内存 4 GB+ 处理器 x64 或 ARM64 网络 需要互联网连接 终端 Bash 或 Zsh Node.js 18.0+（仅 npm 安装方式需要） 同时需要你在 Anthropic 支持的国家/地区内。\n2. 安装方式 方式一：原生安装（推荐） 官方提供的一键安装脚本，安装后会自动在后台更新，始终保持在最新版本。\ncurl -fsSL https://claude.ai/install.sh | bash 脚本运行完毕后即安装完成。启动 Claude Code：\nclaude 提示： 想先看看脚本内容？可以先 pipe 到 less 预览：\ncurl -fsSL https://claude.ai/install.sh | less\n方式二：npm（通用方案） 如果你已经有 Node.js 环境，npm 是最灵活的方式，同样适用于 macOS 和 WSL。\n# 如果还没有 Node.js 18+，先安装 # curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - # sudo apt install -y nodejs # 全局安装 Claude Code npm install -g @anthropic-ai/claude-code # 验证安装 claude --version 后续升级：\nnpm install -g @anthropic-ai/claude-code@latest ⚠️ 不要用 npm update -g——它会遵循原始安装时的 semver 范围，可能不会拉到最新版本。\n方式三：APT（Debian/Ubuntu 包管理器） 如果你偏好系统级包管理，可以添加 Anthropic 的官方 APT 源：\n# 添加 Anthropic 的 GPG 密钥和仓库 curl -fsSL https://apt.anthropic.com/apt.anthropic.com.gpg.key | \\ sudo gpg --dearmor -o /usr/share/keyrings/anthropic.gpg echo \u0026#34;deb [signed-by=/usr/share/keyrings/anthropic.gpg] https://apt.anthropic.com stable main\u0026#34; | \\ sudo tee /etc/apt/sources.list.d/anthropic.list # 安装 sudo apt update sudo apt install claude-code 方式四：Homebrew 如果你在 Linux 上使用 Homebrew：\nbrew install --cask claude-code Homebrew 提供两个版本通道：\nclaude-code —— 稳定通道（比最新版慢约一周，跳过重大回退版本） claude-code@latest —— 最新通道，发布即更新 3. 认证登录 首次运行时，Claude Code 会要求认证。有两种方式：\nOAuth 登录（推荐） claude 终端会输出一次性验证码并自动打开浏览器，按提示关联你的 Anthropic 账户。完成后，后续启动无需再登录。\nAPI Key 如果你有 API Key，设置环境变量即可：\nexport ANTHROPIC_API_KEY=\u0026#34;sk-ant-...\u0026#34; # 或者写入 shell 配置文件持久化 echo \u0026#39;export ANTHROPIC_API_KEY=\u0026#34;sk-ant-...\u0026#34;\u0026#39; \u0026gt;\u0026gt; ~/.bashrc 然后启动：\nclaude --dangerously-skip-permissions 4. 初次使用 进入你的项目目录后启动：\ncd ~/my-project claude Claude Code 会自动扫描代码库，然后你就可以开始对话了。试试这些例子：\n\u0026gt; \u0026gt; \u0026gt; 总 给 找 结 出 这 s 并 个 r 修 项 c 复 目 / 所 的 u 有 结 t 未 构 i 处 l 理 s 的 . j P s r o 添 m 加 i s J e S D r o e c j e 注 c 释 t i o n 5. 升级更新 安装方式 升级命令 原生安装 自动（后台静默更新） npm npm install -g @anthropic-ai/claude-code@latest APT sudo apt update \u0026amp;\u0026amp; sudo apt upgrade Homebrew brew upgrade claude-code 6. 卸载 安装方式 卸载命令 原生安装 sudo rm -f /usr/local/bin/claude ~/.local/bin/claude npm npm uninstall -g @anthropic-ai/claude-code APT sudo apt remove claude-code Homebrew brew uninstall claude-code 7. 常见问题 \u0026ldquo;claude: command not found\u0026rdquo; 原生安装： 检查 ~/.local/bin 是否在 PATH 中：echo $PATH。如果没有，将 export PATH=\u0026quot;$HOME/.local/bin:$PATH\u0026quot; 添加到 ~/.bashrc 中。 npm： 运行 npm list -g --depth=0 确认全局包已安装。 认证失败 确认你所在的地区在 Anthropic 支持列表内。 尝试 claude logout 后重新运行 claude 来重新认证。 搜索功能异常 Claude Code 内置了 ripgrep，但如果搜索失败，手动安装：sudo apt install ripgrep。 通用诊断 claude doctor 运行后会输出安装状态、认证、网络连通性、工具可用性等诊断信息。\n总结 安装方式 适合人群 自动更新 原生安装 大多数用户，简单快捷 ✅ npm Node.js 开发者，灵活可控 ❌ APT 偏好系统包管理的用户 ❌ Homebrew Homebrew 用户 ❌ 对于大多数 Ubuntu 用户，原生安装是最佳选择——一条命令搞定，无需管理依赖，始终最新。选一个适合你工作流的方式，开始写代码吧。\n","permalink":"https://chenshuaiming.com/zh/posts/install-claude-code-ubuntu/","summary":"\u003cp\u003eClaude Code 是 Anthropic 推出的终端 AI 编程助手。它能理解你的整个代码库，编辑文件、执行 git 操作、调试、写文档——全部通过自然语言完成。\u003c/p\u003e\n\u003cp\u003e本文覆盖 Ubuntu 下的所有安装方式，从零基础到进阶用户都适用。\u003c/p\u003e","title":"Ubuntu 安装 Claude Code 完整指南"},{"content":"前言📖 什么是可编程(Programmable)? MCU经历了一下几个阶段：\n纯硬件连线逻辑时代（Hardware Logic） 工程师们使用继电器、晶体管，或者使用逻辑门（与或非门）搭建电路。电路是固化在电路板上的，如果想改变逻辑，就得拿起络铁重新焊电路。 特点：没有CPU，没有内存 掩膜ROM时代（Mask ROM）\u0026ndash; “芯片印好就不能改” 这是真正意思上的第一批MCU（TI的TMS1000）的工作方式，这时候已经有了CPU的雏形，但可编程是非常昂贵且麻烦的事情。可以理解为芯片在制作的时候程序代码就已经“刻”进去了。 挑战：如果芯片里有Bug，相当于这堆芯片全是废铁。 UV-EPROM时代 写代码节奏是：程序员写一个小时代码-\u0026gt; 烧录-\u0026gt; 错了一个点 -\u0026gt; 晒20分钟紫外线 -\u0026gt; 重来 OTP（One-Time Programmable）时代 节约成本，只写一次，写错了就扔掉 现代可编程技术\n由于Flash技术的发展 什么是软硬件协同仿真? 简单的从字面意思来理解，软硬件协同意味着在仿真中，既要软件参与，也要硬件参与，分工不同。 在一颗集成了ARM Cortex-M/R/A系列的处理器(CPU)的MCU芯片中，\narm-gcc交叉编译工具链 cmsis srec_cat Input/Output step1: 开始前的准备 step2：构建项目 step3：TODO list ","permalink":"https://chenshuaiming.com/zh/posts/general_arm_gcc_platform_in_verification/","summary":"\u003ch2 id=\"前言\"\u003e前言📖\u003c/h2\u003e\n\u003cblockquote\u003e\n\u003cp\u003e什么是可编程(Programmable)?\nMCU经历了一下几个阶段：\u003c/p\u003e\u003c/blockquote\u003e\n\u003col\u003e\n\u003cli\u003e纯硬件连线逻辑时代（Hardware Logic）\n工程师们使用继电器、晶体管，或者使用逻辑门（与或非门）搭建电路。电路是固化在电路板上的，如果想改变逻辑，就得拿起络铁重新焊电路。\n\u003cstrong\u003e特点\u003c/strong\u003e：没有CPU，没有内存\u003c/li\u003e\n\u003cli\u003e掩膜ROM时代（Mask ROM）\u0026ndash; “芯片印好就不能改”\n这是真正意思上的第一批MCU（TI的TMS1000）的工作方式，这时候已经有了CPU的雏形，但可编程是非常昂贵且麻烦的事情。可以理解为芯片在制作的时候程序代码就已经“刻”进去了。\n\u003cstrong\u003e挑战\u003c/strong\u003e：如果芯片里有Bug，相当于这堆芯片全是废铁。\u003c/li\u003e\n\u003cli\u003eUV-EPROM时代\n写代码节奏是：程序员写一个小时代码-\u0026gt; 烧录-\u0026gt; 错了一个点 -\u0026gt; 晒20分钟紫外线 -\u0026gt; 重来\u003c/li\u003e\n\u003cli\u003eOTP（One-Time Programmable）时代\n节约成本，只写一次，写错了就扔掉\u003c/li\u003e\n\u003cli\u003e现代可编程技术\u003cbr\u003e\n由于Flash技术的发展\u003c/li\u003e\n\u003c/ol\u003e\n\u003cblockquote\u003e\n\u003cp\u003e什么是软硬件协同仿真?\n简单的从字面意思来理解，\u003cstrong\u003e软硬件协同\u003c/strong\u003e意味着在仿真中，既要软件参与，也要硬件参与，分工不同。\n在一颗集成了ARM Cortex-M/R/A系列的处理器(CPU)的MCU芯片中，\u003c/p\u003e\u003c/blockquote\u003e\n\u003cul\u003e\n\u003cli\u003earm-gcc交叉编译工具链\u003c/li\u003e\n\u003cli\u003ecmsis\u003c/li\u003e\n\u003cli\u003esrec_cat\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch2 id=\"inputoutput\"\u003eInput/Output\u003c/h2\u003e\n\u003ch2 id=\"step1-开始前的准备\"\u003estep1: 开始前的准备\u003c/h2\u003e\n\u003ch2 id=\"step2构建项目\"\u003estep2：构建项目\u003c/h2\u003e\n\u003ch2 id=\"step3todo-list\"\u003estep3：TODO list\u003c/h2\u003e","title":"通用ARM-GCC编译平台在MCU芯片验证中的应用"},{"content":"This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.\nHeadings The following HTML \u0026lt;h1\u0026gt;—\u0026lt;h6\u0026gt; elements represent six levels of section headings. \u0026lt;h1\u0026gt; is the highest section level while \u0026lt;h6\u0026gt; is the lowest.\nH1 H2 H3 H4 H5 H6 Paragraph Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.\nItatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.\nBlockquotes The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.\nBlockquote without attribution Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.\nBlockquote with attribution Don\u0026rsquo;t communicate by sharing memory, share memory by communicating.\n— Rob Pike1\nTables Tables aren\u0026rsquo;t part of the core Markdown spec, but Hugo supports them out-of-the-box.\nName Age Bob 27 Alice 23 Inline Markdown within tables Italics Bold Code italics bold code List Types Ordered List First item Second item Third item Unordered List List item Another item And another item Nested Unordered list Fruit Apple Orange Banana Dairy Milk Cheese Nested Ordered list Fruit Apple Orange Banana Dairy Milk Cheese Third item Sub One Sub Two Other Elements — abbr, sub, sup, kbd, mark GIF is a bitmap image format.\nH2O\nXn + Yn = Zn\nPress CTRL+ALT+Delete to end the session.\nMost salamanders are nocturnal, and hunt for insects, worms, and other small creatures.\nThe above quote is excerpted from Rob Pike\u0026rsquo;s talk during Gopherfest, November 18, 2015.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://chenshuaiming.com/zh/posts/systemverilog-syntax/","summary":"\u003cp\u003eThis article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.\u003c/p\u003e","title":"SystemVerilog语法指导"},{"content":"如果您觉得内容有帮助。欢迎请我喝杯咖啡☕🥪\n","permalink":"https://chenshuaiming.com/zh/support/","summary":"\u003cp\u003e如果您觉得内容有帮助。欢迎请我喝杯咖啡☕🥪\u003c/p\u003e\n\u003cdiv style=\"text-align: center;\"\u003e\n  \u003cimg src=\"../../IMG_8414.jpeg\" alt=\"alipay_qrcode\" width=\"250\" /\u003e  \n\u003c/div\u003e","title":"Support Me"},{"content":"PaperMod is a fast, clean, and responsive Hugo theme designed for bloggers and content creators. It offers a modern design with a focus on readability and performance, making it an excellent choice for personal blogs, portfolios, and documentation sites.\n社交媒体 📲 中国,西安\nchensm1023@gmail.com\nGithub\nLinkedIn\nBilibili\nFeatures 💥 ☄️ Fast | ☁️ Fluent | 🌙 Smooth | 📱 Responsive\nAsset pipeline \u0026ndash; Hugo\u0026rsquo;s built-in asset generator with fingerprinting, bundling, and minification. Three layout modes \u0026ndash; Regular, Home-Info, and Profile. Light and dark themes \u0026ndash; Automatic switching based on browser preference, plus a manual toggle. Multilingual support \u0026ndash; Includes a built-in language selector. Search \u0026ndash; Client-side search powered by Fuse.js. SEO optimized \u0026ndash; Open Graph, Twitter Cards, and Schema.org structured data out of the box. Cover images \u0026ndash; Per-post cover images with responsive image support. Table of contents \u0026ndash; Auto-generated from heading structure. Multiple authors \u0026ndash; Native support for multi-author sites. Social icons and share buttons \u0026ndash; Configurable social links and per-post sharing. Breadcrumb navigation Post archives and taxonomies Code block copy buttons \u0026ndash; One-click copying with Chroma syntax highlighting. Related post suggestions Zero JS build dependencies \u0026ndash; No webpack, Node.js, or other tooling required. Topic Description Installation guide Detailed installation and update instructions Features wiki page In-depth explanations of all features FAQ wiki Common questions and configuration walkthroughs Icons wiki Documentation for social icons and share icons Variables wiki List of all available template variables Overiding templates Guide to customizing templates without forking Releases Detailed history of releases Performance ☄️ PaperMod consistently scores near-perfect results on Pagespeed Insights.\nSupport 🫶 Star this repository to show your support. Share PaperMod with others who might find it useful. Sponsor the project on GitHub Sponsors or Ko-Fi. Special Thanks 🌟 Highlight.js Fuse.js Feather Icons Simple Icons All contributors and supporters Stargazers 📈 ","permalink":"https://chenshuaiming.com/zh/about/","summary":"\u003cp\u003ePaperMod is a fast, clean, and responsive Hugo theme designed for bloggers and content creators. It offers a modern design with a focus on readability and performance, making it an excellent choice for personal blogs, portfolios, and documentation sites.\u003c/p\u003e\n\u003c!-- \u003e Based on [hugo-paper](https://github.com/nanxiaobei/hugo-paper/tree/4330c8b12aa48bfdecbcad6ad66145f679a430b3), with additional features and customization options.--\u003e\n\u003c!--\n\u003ctable\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003ePaperMod at Hugo Themes\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://themes.gohugo.io/themes/hugo-papermod/\"\u003ePaperMod@themes.gohugo.io\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003eMinimum Hugo Version\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/gohugoio/hugo/releases/tag/v0.146.0\"\u003eHugo v0.146.0+\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003eDiscord Community\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://discord.gg/ahpmTvhVmp\"\u003eJoin Discord to chat with the community\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n        \u003ctr\u003e\n\t\t\t\u003ctd\u003eGithub Discussion\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/adityatelange/hugo-PaperMod/discussions\"\u003eJoin Discussions on Github\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003eLive Demo\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://adityatelange.github.io/hugo-PaperMod/\"\u003eadityatelange.github.io/hugo-PaperMod\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003eDocumentation\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/adityatelange/hugo-PaperMod/wiki\"\u003eGithub Wiki\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003eExample Site Source\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://github.com/adityatelange/hugo-PaperMod/tree/exampleSite\"\u003eexampleSite branch\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://www.star-history.com/adityatelange/hugo-papermod\"\u003e\u003cimg src=\"https://api.star-history.com/badge?repo=adityatelange/hugo-PaperMod\u0026amp;theme=dark\" alt=\"Star History Rank\" /\u003e\u003c/a\u003e\u003c/td\u003e\n\t\t\t\u003ctd\u003e\u003ca href=\"https://ko-fi.com/H2H229ZWH\"\u003e\u003cimg src=\"https://ko-fi.com/img/githubbutton_sm.svg\" alt=\"ko-fi\" /\u003e\u003c/a\u003e\u003c/td\u003e\n\t\t\u003c/tr\u003e\n\t\u003c/tbody\u003e\n\u003c/table\u003e\n--\u003e\n\u003chr\u003e\n\u003ch2 id=\"社交媒体-\"\u003e社交媒体 📲\u003c/h2\u003e\n\u003cp\u003e\u003ci class=\"fa-solid fa-location-dot\"\u003e\u003c/i\u003e 中国,\u003ca href=\"https://gaode.com/regeo?lng=108.953232\u0026amp;lat=34.269152/\"\u003e西安\u003c/a\u003e\u003cbr\u003e\n\u003ci class=\"fa-solid fa-envelope\"\u003e\u003c/i\u003e \u003ca href=\"mailto:chensm1023@gmail.com\"\u003echensm1023@gmail.com\u003c/a\u003e\u003cbr\u003e\n\u003ci class=\"fa-brands fa-github\"\u003e\u003c/i\u003e \u003ca href=\"https://github.com/shuaiming1023/\"\u003eGithub\u003c/a\u003e\u003cbr\u003e\n\u003ci class=\"fa-brands fa-linkedin\"\u003e\u003c/i\u003e \u003ca href=\"https://www.linkedin.com/in/andrew-chen-s/\"\u003eLinkedIn\u003c/a\u003e\u003cbr\u003e\n\u003ci class=\"fa-brands fa-bilibili\"\u003e\u003c/i\u003e \u003ca href=\"https://space.bilibili.com/310061768?spm_id_from=333.1007.0.0/\"\u003eBilibili\u003c/a\u003e\u003c/p\u003e","title":"关于我"},{"content":"","permalink":"https://chenshuaiming.com/zh/ai/","summary":"","title":"AI 助手"}]