2012年4月22日 星期日

DFF counter reference

Synchronous counter (D flipflops)

applet icon
The image above shows a thumbnail of the interactive Java applet embedded into this page. Unfortunately, your browser is not Java-aware or Java is disabled in the browser preferences. To start the applet, please enable Java and reload this page. (You might have to restart the browser.)


Circuit Description
A 4-bit synchronous counter built from D-flipflops with carry-input (count-enable) and carry-output. In this circuit, the single clock signal is directly connected to all flipflops, so that all flipflops change state at the same time.
Click the clock and nreset input switches or type the 'c' (clock), 'r' (reset), and 'x' (carry-in) bindkeys to operate the counter.
Obviously, this counter consists of four identical stages with a D-type flipflop, an XOR-gate, and a two-input AND-gate each. The XOR-gate in front of the D input of the flipflop basically converts the D-type flipflop into a toggle (T-type) flipflop. This is the same structure as the JK-flipflop with both J and K tied to logical-1, as shown in the previous applet.
While the carry-logic shown in the previous applet required an n-input AND gate for stage n, the carry-chain used in this applet is based on two-input gates. The difference in structure is similar to the carry-lookahead and the ripple-carry adders shown in the previous chapter. Obviously, the output of any AND gate is only high when all lower stage AND gates (and the carry input) are also high.
In other words,
Dn = Qn XOR (Qn-1 AND Qn-2 AND ... AND Q1 AND Q0 AND carry_in) 

[ref] http://tams-www.informatik.uni-hamburg.de/applets/hades/webdemos/30-counters/30-sync/sync-dff.html

A CMOS IC implementation of a "true single-phase edge-triggered flip-flop with reset"
 
[ref] http://en.wikipedia.org/wiki/Flip-flop_%28electronics%29
 

2012年4月13日 星期五

SSH login without password

1. execute this command as a normal user
>> ssh-keygen

2. in the ~/.ssh folder
>> cat id_rsa.pub >> authorized_keys

3. done

2012年4月9日 星期一

How to execute m-file in the Linux terminal background/foreground?

foreground execution in the terminal mode:
>> matlab -nojvm -nodisplay -nosplash

background execution in the terminal mode:
>> nohup matlab -nojvm -nodisplay -nosplash < 123.m > report123.log &

Ref:
[1]  http://www.math.ufl.edu/help/matlab/tec1.1.html

fonts in Centos 6 for matlab

'zero' and 'o' are distinguishable
    bitstream Vera Sans Mono
     DejaVu LGC Sans Mono
    Liberation Mono

Every letter has equal width
    Bitstream Vera Sans Mono
    Courier
    Courier 10 Pitch
    DejaVu LGC Sans Mono
     Dialoginput
    Liberation Mono
    Lucida Dans Typewriter
    Luxi Mono
    Monospaced
    Nimbus Mono L
    
Chinese words supported
    
    Dialog
    Dialoginput
    Monospaced
    SansSerif
     Serif
    ... other fonts with Chinese name
   
   
   

2012年4月7日 星期六

install nxserver on centos 6

I use matlab in linux server (centos)
Three remote control methods have different disadvantages..
XDMCP + SSH tunnel +matlab -->very very SLOW
VNC + Matlab--> crash sometimes and keypad disorders
   (press '0123456' in matlab command line, and the result shows '012456')
NXserver + Matlab --> lags when you scroll down in Matlab editor...
I can't find an excellent method in using Matlab in Centos 6...


Due to the application in a small group
the install guides on the internet are not suitable for me
so I write down some tips for myself

Environment:
Centos 6
SSH version 2 works well

Tips:
1. install
>> yum install nx freenx 

2. 
>> vi /etc/nxserver/node.conf
"SSHD_PORT=1234" 
"ENABLE_SSH_AUTHENTICATION="1"
 
>> vi /etc/ssh/sshd_config
"PasswordAuthentication yes" 

3.
service sshd restart 
 
4. 
nxserver --restart
 
5.
cat /var/lib/nxserver/home/.ssh/client.id_dsa.key
tell the client all the content of the file in some secret way
It may look like
"-----BEGIN DSA PRIVATE KEY-----
MIIBuwIBAAKBgQCXv9AzQXjxvXWskX9YomTfyG865gb4D02ZwWuRU/9
C3I9/bEWLdaWgJYkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF
QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuR7KeafeFZDf+fJ3
mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf
8xAPsSKs6yZ6j1FNklfu
-----END DSA PRIVATE KEY-----" 
 
6.
download the client from the nomachine official website