函数[Function] func functionName(arg1: Type1) -> Type2 { ... ... } 闭包[Closure] 跟随闭包[Trailing Closure] If you need to pass a closure expression to a function as the function’s final argument and the closure expression is long, it can be useful to write it as a trailing closure instead. You write a trailing closure after the function... Read more 17 Jul 2023 - 2 minute read
CS193P Intro Swift的 “foundation” Package 该package包含了基本的数据类型(String, Array etc.)以及构建app所需的基本结构体。 import foundation Xcode如何快速查看文档 在Xcode中按住Option然后点击对应的关键字或builtin types,便能快速跳转到对应的文档下。 Read more 16 Jul 2023 - less than 1 minute read
Become Embedded Software Engineer From Scratch Assembly language ” If you understand assembly language you’ll have a fundamental understanding of how a microcontroller works. You might be able to get by in embedded systems without understanding assembly, but you won’t be great without it.” Peripherals GPIO Interrupt Read more 02 Jul 2023 - less than 1 minute read
GPU内存的种类以及每个线程对它的读写权限 Register Shared Memory: 每个block共享 Local Memory: 线程私有 Global Memory: 每个设备共享 每个设备可以完成 Constant Memory Texture Memory 课件截图 内存管理API // CPU malloc() memset() free() //GPU cudaMalloc() cudaMallocManaged() //申请统一内存 cudaMemset() cudaFree() cudaHostAlloc() // for allocating Pinned(Page-locked) memory. 设备间的数据传... Read more 07 Feb 2023 - 8 minute read
CPU 架构 cpu中较多的晶体管用于数据缓存和流程控制, 只拥有几个少数的高速计算核心. Fetch/Decode: 取指令、译码单元 ALU(Arithmetic Logic Unit): 算术逻辑单元 Execution Context: 执行上下文池 Data cache: 数据缓存 流水线优化单元: 如乱序执行、分支断定预测、memory预存取等。 课件截图 单核(少核)处理器发展的物理约束 \[P = C * V ^{2} * f\] P 为功耗, V是电压,C是和制程有关的一个常数项,f是时钟频率。 制程极限:量子隧穿。 时钟频率墙:处理器的时钟频率无法保持线性的增长。 存储墙:虽然提高晶体管集成度可以增加处理数据的速... Read more 05 Feb 2023 - 10 minute read