2.1.3 如何用Go模拟CPU如何用Go模拟CPU 蒙卓 华为 – 2012实验室 工程师 成为盘古? 让这个世界里面的人(程序)无法察觉 这个世界是创造出来的 目录 • 计算机的演化历史 – 硬件计算到冯诺伊曼架构 • 构建虚拟世界 – MOS 6502 • 控制单元(control unit) • 运算逻辑单元(arithmetic logic unit) • 6502汇编器与链接器 • 未来目标 1970年程序员 1970年程序员 CPU 80KHz 单核 内存 64KB 手编磁芯 老娘把你送上月球 2021年程序员 CPU 2,400,000KHz 4核 内存 8,000,000KB DDR3 呜呜 App内存不足 外卖下不了单 计算机的演化历史 • 一部偷懒的历史 • 硬件“计算机”时代 • 不擅长计算和记忆的人使用工具帮助计算:算盘,计算尺,手摇计算器 • 硬件计算机改进支持的算法,需要变更或重新发明整个硬件,比如让算 硬件过于复杂 • 软件基于操作系统等复杂概念 • 真的快且便宜 Go模拟CPU • 如何用Go实现冯诺伊曼架构CPU? • 简单:一个循环+一个大数组 读取当前指令 执行指令 下一条指令 模拟目标 – MOS 6502 • 诞生于1975年 • MOS 6502应用范围广 • 资料多且易获得 • 简单、容易实现的现代CPU MOS 6502简介 • 8位,变长ISA(CISC) • 中断(NMI,IRQ)0 码力 | 42 页 | 7.10 MB | 1 年前3
Golang Manual By AstaXie-20120522One way to think about this model is to consider a typical single-threaded program running on one CPU. It has no need for synchronization primitives. Now run another such instance; it too needs no synchronization Parallelization Another application of these ideas is to parallelize a calculation across multiple CPU cores. If the calculation can be broken into separate pieces that can execute independently, it can one per CPU. They can complete in any order but it doesn't matter; we just count the completion signals by draining the channel after launching all the goroutines. const NCPU = 4 // number of CPU cores0 码力 | 6205 页 | 12.83 MB | 1 年前3
The Way To Go - 2012the execution of native code in web applications in the Chrome OS. Go also runs on Intel as well as ARM processors (see chapter 2), so it runs under the Android OS, for example on Nexus smartphones. Go available in source and binary form on these platforms: FreeBSD 7+: amd64, 386 Linux 2.6+: amd64, 386, arm OS X (Snow Leopard + Lion): amd64, 386 Windows (2000 + later): amd64, 386 The portability of Go-code 32 bit implementation 386 (also named x86 or x86-32) 8g 8l 32 bit RISC implementation arm (ARM) 5g 5l The naming system is a bit strange at first sight (the names come from the Plan 9-project):0 码力 | 629 页 | 4.85 MB | 1 年前3
Go 入门指南(The way to Go)语言的编译器用于本地客户端(NaCl),这很可能会被用于在 Go入门指南 - 10 - 本文档使用 看云 构建 Chrome OS 中执行 Go 语言开发的应用程序。 Go 语言可以在 Intel 或 ARM 处理器上运行,因此它也可以在安卓系统下运行,例如 Nexus 系列的产 品。 在 Google App Engine 中使用 Go 语言:2011 年 5 月 5 日,官方发布了用于开发运行在 从而在 Windows 平台下使用 gcc 编译器。这两个编译器都是以单通道的形式工作。 你可以获取以下平台上的 Go 1.4 源码和二进制文件: Linux 2.6+:amd64、386 和 arm 架构 Mac OS X(Snow Leopard + Lion):amd64 和 386 架构 Windows 2000+:amd64 和 386 架构 对于非常底层的纯 Go 语言代码或者 $GOROOT 表示 Go 在你的电脑上的安装位置,它的值一般都是 $HOME/go ,当然,你也可以安装 在别的地方。 $GOARCH 表示目标机器的处理器架构,它的值可以是 386、amd64 或 arm。 $GOOS 表示目标机器的操作系统,它的值可以是 darwin、freebsd、linux 或 windows。 $GOBIN 表示编译器和链接器的安装位置,默认是 $GOROOT/bin ,如果你使用的是0 码力 | 380 页 | 2.97 MB | 1 年前3
Go 入门指南(The way to Go)在 Chrome 浏览器中内置了一款 Go 语言的编译器用于本地客户端(NaCl),这很可能会被用于在 Chrome OS 中执行 Go 语言开发的应用程序。 Go 语言可以在 Intel 或 ARM 处理器上运行,因此它也可以在安卓系统下运行,例如 Nexus 系列的产品。 在 Google App Engine 中使用 Go 语言:2011 年 5 月 5 日,官方发布了用于开发运行在 Google 而在 Windows 平台下使用 gcc 编译器。这两个编译器都是以单通道的形式工作。 你可以获取以下平台上的 Go 1.4 源码和二进制文件: Linux 2.6+:amd64、386 和 arm 架构 Mac OS X(Snow Leopard + Lion):amd64 和 386 架构 Windows 2000+:amd64 和 386 架构 对于非常底层的纯 Go 语言代码或者 $GOROOT 表示 Go 在你的电脑上的安装位置,它的值一般都是 $HOME/go ,当然,你也可以安装在别的地 方。 $GOARCH 表示目标机器的处理器架构,它的值可以是 386、amd64 或 arm。 $GOOS 表示目标机器的操作系统,它的值可以是 darwin、freebsd、linux 或 windows。 $GOBIN 表示编译器和链接器的安装位置,默认是 $GOROOT/bin0 码力 | 466 页 | 4.44 MB | 1 年前3
Writing Web Apps in GoLaunched in November, 2009. • Goals: – fun to work in. – efficient - performance approaching C for CPU-intensive tasks, – designed for modern hardware (multicore, networks), – aimed at software such as (an interpreter with JIT compilation). – Ergo (a new compiler for Windows; under development). • ARM port (5g) is solid, • GCC4.6 release includes gccgo, • SWIG, • and more.... 8 GDB has Go support0 码力 | 66 页 | 712.40 KB | 1 年前3
Go 101 (Golang 101) v1.21.0from hardware devices to complete tasks. For modern computers, elemental operations are low-level CPU and GPU instructions. Common hardware devices include memory, disk, network card, graphics card, monitor import names shall also be identifiers. High-level programming code will be translated to low-level CPU instructions by compilers to get executed. To help compilers parse high-level programming code, many will be introduced in future articles. Goroutines Modern CPUs often have multiple cores, and some CPU cores support hyper- threading. In other words, modern CPUs can process multiple instruction pipelines0 码力 | 610 页 | 945.17 KB | 1 年前3
Go 101 (Golang 101) v1.21.0from hardware devices to complete tasks. For modern computers, elemental operations are low-level CPU and GPU instructions. Common hardware devices include memory, disk, network card, graphics card, monitor import names shall also be identifiers. High-level programming code will be translated to low-level CPU instructions by compilers to get executed. To help compilers parse high-level programming code, many will be introduced in future articles. Goroutines Modern CPUs often have multiple cores, and some CPU cores support hyper- threading. In other words, modern CPUs can process multiple instruction pipelines0 码力 | 880 页 | 833.34 KB | 1 年前3
Go 101 (Golang 101) v1.21.0from hardware devices to complete tasks. For modern computers, elemental operations are low-level CPU and GPU instructions. Common hardware devices include memory, disk, network card, graphics card, monitor import names shall also be identifiers. High-level programming code will be translated to low-level CPU instructions by compilers to get executed. To help compilers parse high-level programming code, many will be introduced in future articles. Goroutines Modern CPUs often have multiple cores, and some CPU cores support hyper-threading. In other words, modern CPUs can process multiple instruction pipelines0 码力 | 630 页 | 3.77 MB | 1 年前3
SMALL IS GOING BIG: GOON MICROCONTROLLERS
CIRCUIT PLAYGROUND EXPRESS + LED + BUTTON ADAFRUIT CIRCUIT PLAYGROUND EXPRESS MICROCHIP ATSAMD21G18 ARM CORTEX M0 32-BIT PROCESSOR 48 MHZ 256K FLASH package main import ( "machine" "time" MQTT SENSOR STATION ARDUINO NANO33 IOT + LED + BUTTON ARDUINO NANO33 IOT MICROCHIP ATSAMD21G18 ARM CORTEX M0 32-BIT PROCESSOR 48 MHZ 256K FLASH UNIVERSAL ASYNCRONOUS RECEIVER/TRANSMITER (UART)0 码力 | 100 页 | 1.40 MB | 1 年前3
共 60 条
- 1
- 2
- 3
- 4
- 5
- 6













