nand flash控制
结构
引脚名称
引脚功能
I/$O_0$ - I/$O_7$
数据输入输出
CLE
命令锁存使能
ALE
地址锁存使能
$\overset{-}{CE}$
芯片使能
$\overset{-}{RE}$
读使能
$\overset{-}{WE}$
写使能
$\overset{-}{WP}$
写保护
$R/\bar{B}$
就绪/忙输出信号
$V_{cc}$
电源
$V_{ss}$
池
NC
不接
K9F1208U0M容量64mb,每一页的大小是512字节,并且每一页上还有额外的字节。也就是说总共有$2^{18}$个字节
读写nand的过程:
发出命令字
发出地址
读写数据
命令字及操作方法
命令
第一个周期
第二个周期
第三个周期
Read1(读)
00h/01h
-
-
Read2(读)
50h
-
-
Read ID(读芯片ID)
90h
-
-
Page Program(写页)
80h
10h
-
Block Erase(擦除块)
60h
D0h
-
Read Status(读状态 ...
makefile
本篇文章学习自
介绍一个makefile可以看成是由许多命令组成的,每个命令都遵循如下形式
target ... : prerequisites ... command ... ...
其中target是目标,prerequisites是依赖,command是执行的命令,例如
hello.o: hello.c gcc -o hello.o hello.c例2compile:main.bin main.data convert ./convert mkdir -p $(OBJDIR) mv main.elf $(OBJDIR)/. mv test.s $(OBJDIR)/. mv main.bin $(OBJDIR)/. mv main.data $(OBJDIR)/. mv *.coe $(OBJDIR)/. mv *.mif $(OBJDIR)/. cp $(OBJDIR)/inst_ram.mif $(OBJDIR)/axi_ram.mifmain.bin:main.elf ${CROSS_COMPILE}ob ...
虚拟内存
基础我们在生成程序的时候,会发现每个程序的起始地址都是一样的,那么这种一样的地址怎么赋给实际的物理地址上的呢?这就要依靠虚拟内存机制了。
虚拟内存着力于解决进程间内存分配的问题,并且它还有一个作用是使进程之间相互隔绝。例如不小心产生了一个野指针指向了其他内存的位置,但是实际上却不会破坏其他程序而只会破坏自己的程序,这是因为虚拟内存限制了每个程序所使用的空间,如果超出限制就会报错。
程序中所使用的空间叫做虚拟空间,一共有2的n次方。而系统上有一个物理地址空间。虚拟内存做的其实是把虚拟空间上的内存地址映射到物理空间上。在cpu中,有一个叫MMU的部件专门做虚拟地址和物理地址转化。
虚拟内存的组织形式虚拟内存中的内存其实是按页进行划分的。这类似与磁盘中的扇区概念,即使那个扇区中只有一个字节的数据,取数据时也是把一个扇区全取出来。
虚拟内存页的大小一般是4kb到2mb之间。而物理内存也是按页进行分块,并且块的大小和虚拟内存页的大小相同。
其实把程序加载到内存时也不是一股脑直接加载的,而是一块一块逐个加载,并且如果内存满了还有块替换策略,这实质上是把内存当做一级缓存使用。
虚拟页有三种情况:
...
储存设备与缓存
机械硬盘
结构: 由若干个盘片组成,每个盘片有2两面,每一面上有若干个磁道(柱面就是指和中心轴平行的圆柱面,有多个每个盘上都有两个磁道在上面) ,每个磁道上又划分成若干个扇区,扇区是数据访问的最小单位。中间的轴在不停转动。每个扇区都有一个编号。
显然如果扇区划分时是从中心发出多根射线的话是不好的。因为内圈的扇区划分小,外面的扇区划分大,因此每个扇区读写数据数目可能会有较大的差距。但是很可能只需要利用其中很小一部分,这样就造成了浪费。所以磁道与磁道之间扇区数目是不同的,尽量使数据分布均匀。
图中左边的架子是读写头,可以前后滑动。数据就是通过读写头进行读写的。
大致过程:先移动到对应扇区(寻道),然后等待读写头划过我们要读取的扇区。之后在读取这个扇区。要注意即使只需要读取一个字节也要把这个扇区全部读取完。如果是写的话,先把扇区中数据读取出来,然后再在这些数据中进行更改,最后再把这些数据写入到扇区中。
一般寻道在2-9ms,旋转也是10ms左右,而读取只需要0.02ms,所以说大头都在寻找过程中。并且要比dram慢2500倍,比sram慢40000倍。
旋转时间如果没有特殊规定一般都是算旋 ...
矩阵求解
直接解法高斯消去法高斯消去法是先将矩阵变为上/下三角矩阵,然后使用回带法进行求解,例如
\begin{bmatrix}
1 & 1 & 1 & 6\\
0 & 4 & -1 & 5\\
2 & -2 & 1 & 1
\end{bmatrix}\overset{r_3 - 2r_1}{\rightarrow}
\begin{bmatrix}
1 & 1 & 1 & 6\\
0 & 4 & -1 & 5\\
0 & -4 & -1 & -11
\end{bmatrix}\overset{r_3 - r_2}{\rightarrow}
\begin{bmatrix}
1 & 1 & 1 & 6\\
0 & 4 & -1 & 5\\
0 & 0 & -2 & -6
\end{bmatrix}因此$x_3 = 3 , x_2 = 2 , x_1 = 1$
\begin{bmatrix}
a_{11} & a_{12} & \dots & a_{1n}\\
0 & a_{22} & \dots & a_{2n}\\
\vdots & \vdots & & \vdo ...
harmony ability
Ability(能力)是鸿蒙软件的基础单位,一个应用可以包含多个Ability。鸿蒙支持应用以Ability为单位进行部署
Page AbilityPage提供页面管理和页面跳转的能力。例如外卖提供联系商家的业务入口,当用户使用此功能时,会跳转到通话应用的拨号页面。鸿蒙支持Page之间的跳转,并且指定跳转到某个AbilitySlice
创建右键就可以进行创建,并且它的配置文件如下{ "skills": [ { "entities": [ "entity.system.home" ], "actions": [//路由名称 "action.system.home" ] } ], "orientation": "uns ...
卷积神经网络
基础卷积神经网络的基本形式
整体结果为:
卷积层
如图所示,左边是输入,中间是卷积核,右边是输出。
如果输入为3通道,输出为2通道,那么卷积核需要6个,每三个卷积核卷积再求和可以得到一个输出
非线性激活函数种类:
其中现在最常使用的是ReLU函数,因为求导简单且不容易造成梯度消失
降采样层降采样层的作用是增大感受野,并且对形变不敏感。
max pooling: 在几个候选结果中选择最大值,例如4$\times$4到2$\times$2 也就是说原来4个映射到了现在的一个,映射规则为选取4个中的最大值
average pooling: 选取候选结果中的平均值
LeNet-5结构
C1的通道数为6,卷积核大小为5$\times$5
S2降采样层,28$\times$28降为14$\times$14
C3卷积层,卷积核$5 \times 5$,通道数16
CNN的问题和发展CNN的问题主要有过拟合、难收敛、计算代价大三点
AlexNetAlexNet是12年ImageNet比赛的冠军,当时其他人都适用概率的方法,AlexNet首次使用深度学习的方法比其他队高了十多个百分点,掀起了 ...
harmony java框架
文件结构
java: java代码,运行逻辑
element: 元素资源,存放一些json格式文件,主要是颜色,字符串,bool值等
graphic: 表示可绘制资源。例如按钮的样式
layout: 表示布局资源, 控制控件摆放位置和控件的一些属性
media: 表示媒体资源,如图片、视频等
build: 存放最终编译后的包
项目配置文件每个项目下都有一个config文件,它包含了该HAP的一些配置信息。
{ "app": { "bundleName": "com.example.learning",//同一个应用需要保持一致 "vendor": "example",//开发商 "version": {//版本 "code": 1000000,//内部版本号,用户不可见 "name": "1.0.0"//呈现的版本号 } ...
边缘检测
边缘一般来说,边缘是图像像素变化大的区域,但是这并不绝对如图所示,两个位置像素一样,但是我们会天然的把它区分黑白,这得益于我们对图像的整体理解。基础的图像滤波只考虑局部的因素,如果要得到更好的效果需要进行整体考虑。
边缘可以用来区分物体,是图像分类、图像裁剪、图像拼接等操作的基础。
导数在边缘检测中应用
梯度
梯度定义:
含义: 是一个向量,表示沿着这个方向导数获得最大值,也就是变换最快
离散化表示
\nabla I(x,y)=\begin{bmatrix}{ {\Bbb d} \over {\Bbb d}x}I(x,y) \\ { {\Bbb d} \over {\Bbb d}y}I(x,y) \end{bmatrix} = \begin{bmatrix}I(x+1,y)-I(x,y) \\ I(x,y+1)-I(x,y)\end{bmatrix}边缘检测Sobel, Prewitt, RobertSobel算子为:
\begin{bmatrix}
1 & 2 & 1\\
0 & 0 & 0\\
-1 & -2 & -1
\end{bmatrix}
\quad
\begin ...
算法设计与分析代码
子集和数问题由于本实验是为了验证数据集影响,因此没有采用一次增加两个的限界函数。此代码左支限界是 w+wi> target,右支限界是w+rest>=target. 并且由于实验网站要求在没有正确解的情况下输出近似解,因此每次触底或者左支终止之后还进行了记录。最后因为进行了排序,而数据集给出的答案中并没有进行排序,因此使用了一个结构体对开始的位置进行记录。
#include<iostream>#include<fstream>#include<vector>#include<string>#include <windows.h>#define N 6#define MAX_ANS 1000using namespace std;struct node{ int sum; int loc;};int time=0;int ans=0;int nearest = 0;int use[MAX_ANS][N+1];void quick(vector<node>& a, i ...