Category Archives: Others

Read Spartan6LX DNA Serial Number

Spartan6 Contain DNA logic — DNA_PORT, We can let this as random seed:) This is 57bits numbers. DNA_PORT DNA_PORT_inst(   .DOUT(dna_dout),   .CLK(dna_clk),   .DIN(1’b0),   .READ(dna_read),   .SHIFT(dna_shift) ); DNA_PORT is act as SPI Slave, capture at raise edge, … Continue reading

Posted in Others | Tagged , , , , , | Comments Off on Read Spartan6LX DNA Serial Number

About Sequence points

具体参考: http://c-faq.com/expr/seqpoints.html http://en.wikipedia.org/wiki/Sequence_point http://blog.tinlans.org/2010/08/06/sequence-point/ 简单说就是如下的代码 int i = 0; char a[100]; i = i++; i = (i++) + (++i); a[i] = i++; 其实行为是未定义的,而且编译器是会提示的! ipp.c: In function ‘main’: ipp.c:9:7: warning: operation on ‘i’ may be undefined [-Wsequence-point] i = i++; ^ … Continue reading

Posted in Others | Tagged , | Comments Off on About Sequence points

logitech M310 vs M320

I have old M310, and Buy “new” M320 which is upgraded product. But M320 is not “upgraded” actually!!!

Posted in Others | Tagged , , | 1 Comment

About xilinx fpga bit, prom mcs, spi mcs.

Most of time I used impact to generate MCS from BIT, but it is too complex, I think too many step is useless. I need a command line tool to convert format:) So I decided to analyze difference between BIT … Continue reading

Posted in Others | Tagged , , , , | Comments Off on About xilinx fpga bit, prom mcs, spi mcs.

opencv 找不到 cv.h

本来觉得安装 libopencv-dev 就够了,但是发现需要装另外的包

测试一下

Posted in Others | Tagged , , | Comments Off on opencv 找不到 cv.h

用lua替换ini做配置文件

自己只想要一个配置文件,本想用flex+bison,但是总觉得这么点功能,用这个方法得不偿失,而且还是ming的;使用windows下的ini接口总不舒服;而linux下的配置库移植过来也不是很好;想整合python过于麻烦,而且一直有库,我不想要库,只想要能解析文本的;tk脚本不会用;用正则表达式,对我来讲简单,但是怕其他人看不懂代码,貌似有些人就是很反感正则表达式(其实正则表达式也算一门编程语言了,而且维护的确是问题)…… 突然想到愤怒的小鸟使用lua开发的,于是尝试把lua整合到程序里,异常的简单,源码直接编译就行(连附加的预定义宏都没有!),用起来也挺方便的,lua_pushxxx和lua_toxxx就可以了,涉及到table的时候麻烦一点,只要能理解lua的堆栈模型就很顺手。反正整个过程很简单,用了一个下午把之前的ini全改成lua了。

Posted in Others | Tagged , , | Comments Off on 用lua替换ini做配置文件

Opera 开源了?!!!

今天找到一个网站:http://sourcecode.opera.com/ 只可惜下载回来之后发觉是Chrome核心,唉,Opera就这么没了。。。 自从Opera选择Chrome内核后,不想用它了,不过今天也看到Opera Mail邮件客户端,仔细检查了一下,发现这个邮件客户端使用的是Opera原来的内核!!!

Posted in Others | Tagged , | Comments Off on Opera 开源了?!!!

Picoblaze Utils 对工具链的需求

自己的Picoblaze已经在用了,并且项目已经结了。 把想法记录一下,否则过一段时间就忘了。 先说说需求的由来,本来SPI Master是用Verilog来写的,刚开始还好,到后来需要加入数据变换、饱和、读写SRAM,渐渐的用Verilog开始很麻烦了…… 因为Picoblaze的每个指令都是2个clock,于是转到Picoblaze。用汇编写了第一版的固件,比verilog方便很多,无论是改变时序,还是增加一些功能。但是汇编有个很烦的问题——条件判断和循环! 当程序变大、变复杂之后,各种跳转就会让人头晕,而且很容易一不小心跳错。也有函数忘了写return导致直接跑飞,退出中断isr忘记重新使能中断……oh,no…… 一、于是开始找编译器

Posted in Others | Tagged , , , , | 2 Comments

Finished picoblaze-utils

完成PicoBlaze的工具链,目前用python的正则表达式来做,主要是想快速构建一个工具链,以后有时间再使用llvm(c++)或cparser(python)来重写前端。 当前的c语法和汇编很接近,并且没有push和pop操作,需要自己封装成宏。需要自己分配寄存器。但是PicoBlaze本来就不是很强大,定位是可编程状态机,所以暂时够用了。 代码上传到github了,以GPLv2发布。 https://github.com/buaabyl/picoblaze_utils

Posted in Others | Tagged , , , , , , , | Comments Off on Finished picoblaze-utils

Create a windows hosts config tool

Using python to to this, load from hosts, then parse using re. then modify, and write back.

Posted in Others | Tagged , , , , | Comments Off on Create a windows hosts config tool