MenuBar
概要 †
- Nexys4 付属のI2C温度計を miniCPUで駆動して、温度を計測し、LEDに計測した温度を表示します。
- 「MiniCPUとI2Cバスの接続」を基にして, このtop.v を「MiniCPU簡易OS」の top.vで置き換え, ram.v を以下の ram.v で置き換えて使います。
- 分周比は、10010 程度で動かしてみて、その後、いろいろ変化させてみてください。
- 実行終了時に、led[7:0]に計測した温度の整数部分が表示されます。
動かし方 †
- bit ファイルがnexys4に書きこまれると、MiniCPU簡易OS動作モード0で実行が始まります。下ボタン(BTND,bd)を押すと、リセットがかかり、動作モードが0になります。
- 動作モード0の状態から、右ボタン(BTNE,br)を3回押して、動作モードを3にします。動作モードの変更はカラーLED1の色の変化で知ることができます。
- 動作モード3の状態で、スライドスイッチの左から5つを、10010 (ON,OFF,OFF,ON,OFF)にして、中心ボタン(bc)を押します。これで分周比が分周レジスタに入ります。16個のLEDの左から5つが、スライドスイッチのON,OFFに応じて光ります。
- 動作モード3の状態から、右ボタン(BTNE,br)を2回押して、動作モードを5にします。このモードで、MiniCPUの入出力がI2Cバスと結合され、クロックが、動作モード3で設定した分周比で自動的に供給されます。動作モード5の状態で、中心ボタン(bc)を押すと、MiniCPUの実行が始まります。
- 温度の計測が終わると、7セグメントLEDの下2桁に16進で温度が表示されます。
verilog †
- ram.v
PUSHI rtnval // push arg1... the address for receiving the result(temprature)
PUSH tempReadReg // push the register no. 0
push tempAddr // push the I2C temprature sensor address, 0x4b
pushi rtn0 // push the return address
JMP ri2c2 // call the ri2c2 ... read 2 byte data from the i2c device,
//
rtn0: pop rtncode // pop the return code
PUSH rtnval // push the result (temperature)
PUSHI 7 //
shr // shift right 7 bit
OUT // output to the LED
HALT //
rtnval: 0x0000
rtncode: 0x0000
tempReadReg: 0x0000
tempAddr: 0x004b
//
// wi2c1
// Write 1 byte to an i2c device
// arg 0: return address, arg1:device address, arg2:register no, arg3:1 byte value
// return ... if 1: ok, 0: error
//
wi2c1: PUSH wi2c1_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP wi2c1_rtn // save the return instruction
POP wi2c1_addr // save the arg1, the i2c slave address
pop wi2c1_reg // save the arg2, destination register address
pop wi2c1_val // save the value which will be assiinged to the destination register.
//
PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI wi2c1_l1 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c1_l1: push wi2c1_addr
pushi 1
shl // make the i2c device address with the write flag
//
pushi wi2c1_l2
jmp si2c1
//
wi2c1_l2: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c1_l3 //
JMP SubI2C1 // call the subroutine
//
wi2c1_l3: pushi wi2c1_reg
pushi wi2c1_l4
jmp si2c1
//
wi2c1_l4: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c1_l5 //
JMP SubI2C1 // call the subroutine
//
wi2c1_l5: push wi2c1_val
pushi wi2c1_l6
jmp si2c1
//
wi2c1_l6: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c1_l7 //
JMP SubI2C1 // call the subroutine
//
wi2c1_l7: PUSHI i2cStop // push arg1 .... write the ack
PUSHI wi2c1_l8 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c1_l8: pushI 1
wi2c1_rtn: jmp 0x000 // return
wi2c1_jmp: 0x4000
wi2c1_addr: 0x0000
wi2c1_reg: 0x0000
wi2c1_val: 0x0000
//
// wi2c2
// Write 2 byte to an i2c device
// arg 0: return address, arg1:device address, arg2:register no, arg3:two byte values
// return ... if 1: ok, 0: error
//
wi2c2: PUSH wi2c2_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP wi2c2_rtn // save the return instruction
POP wi2c2_addr // save the arg1, the i2c slave address
pop wi2c2_reg // save the arg2, destination register address
pop wi2c2_val // save the value which will be assiinged to the destination register.
//
PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI wi2c2_l1 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c2_l1: push wi2c2_addr
pushi 1
shl // make the i2c device address with the write flag
pop wi2c2_waddr
//
pushi wi2c2_l2
jmp si2c1
//
wi2c2_l2: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c2_l3 //
JMP SubI2C1 // call the subroutine
//
wi2c2_l3: push wi2c2_reg
pushi wi2c2_l4
jmp si2c1
//
wi2c2_l4: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c2_l5 //
JMP SubI2C1 // call the subroutine
//
wi2c2_l5: push wi2c2_val
pushi 0x00ff
band
pushi wi2c2_l6
jmp si2c1
//
wi2c2_l6: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c2_l7 //
JMP SubI2C1 // call the subroutine
//
wi2c2_l7: push wi2c2_val
pushi 8
shr
pushi wi2c2_l8
jmp si2c1
//
wi2c2_l8: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c2_l9 //
JMP SubI2C1 // call the subroutine
//
wi2c2_l9: PUSHI i2cStop // push arg1 .... write the ack
PUSHI wi2c2_l10 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c2_l10: pushI 1
wi2c2_rtn: jmp 0x000 // return
wi2c2_jmp: 0x4000
wi2c2_addr: 0x0000
wi2c2_reg: 0x0000
wi2c2_val: 0x0000
//
// wi2c4
// Write 4 byte to an i2c device
// arg 0: return address, arg1:device address, arg2:register no, arg3:1st 2 byte, arg4: 2nd 2byte,
// return ... if 1: ok, 0: error
//
wi2c4: PUSH wi2c4_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP wi2c4_rtn // save the return instruction
POP wi2c4_addr // save the arg1, the i2c slave address
pop wi2c4_reg // save the arg2, destination register address
pop wi2c4_val1 // save the 1st value which will be assiinged to the destination registers.
pop wi2c4_val2 // save the 2nd value which will be assiinged to the destination register2.
//
PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI wi2c4_l1 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c4_l1: push wi2c4_addr
pushi 1
shl // make the i2c device address with the write flag
pushi wi2c4_l2
jmp si2c1
//
wi2c4_l2: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l3 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l3: push wi2c4_reg
pushi wi2c4_l4
jmp si2c1
//
wi2c4_l4: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l5 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l5: push wi2c4_val1
pushi 0x00ff
band
pushi wi2c4_l6
jmp si2c1
//
wi2c4_l6: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l7 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l7: push wi2c4_val1
pushi 8
shr
pushi wi2c4_l8
jmp si2c1
//
wi2c4_l8: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l9 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l9: push wi2c4_val2
pushi 0x00ff
band
pushi wi2c4_l10
jmp si2c1
//
wi2c4_l10: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l11 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l11: push wi2c4_val2
pushi 8
shr
pushi wi2c4_l12
jmp si2c1
//
wi2c4_l12: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI wi2c4_l13 //
JMP SubI2C1 // call the subroutine
//
wi2c4_l13: PUSHI i2cStop // push arg1 .... write the ack
PUSHI wi2c4_l14 // push the return address
JMP SubI2C1 // call the subroutine
//
wi2c4_l14: pushI 1
wi2c4_rtn: jmp 0x000 // return
wi2c4_jmp: 0x4000
wi2c4_addr: 0x0000
wi2c4_reg: 0x0000
wi2c4_val1: 0x0000
wi2c4_val2: 0x0000
//
// si2c1
// Write 1 byte series to an i2c device
// ... arg1 ... device address, arg1... register no. arg2... 1 byte value
// return ... if 1: ok, 0: error
//
si2c1: PUSH si2c1_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP si2c1_rtn // save the return instruction
POP si2c1_val
PUSHI 8
POP si2c1_i
si2c1_a3: push si2c1_val
pushi 0x0080
band
JNZ si2c1_a1
pushi 0x0000
out
pushi 0x0002
out
pushi 0x0000
out
jmp si2c1_a2
si2c1_a1: pushi 0x0001
out
pushi 0x0003
out
pushi 0x0001
out
si2c1_a2: push si2c1_val
pushi 1
shl
pop si2c1_val
push si2c1_i
pushi 1
sub
pop si2c1_i
push si2c1_i
jnz si2c1_a3
si2c1_rtn: jmp 0x000
si2c1_jmp: 0x4000
si2c1_val: 0x0000
si2c1_i: 0x0000
//
// ri2c1
// Read 1 byte from an i2c device
// ... arg1 ... device address, arg2 ... register number, arg3 .... the address for receiving the data
// return ... if 1:ok, 0:error
//
ri2c1: PUSH ri2c1_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP ri2c1_rtn // save the return instruction
POP ri2c1_addr // save the arg1, the i2c slave address
pop ri2c1_reg // save the arg2, destination register address
pop ri2c1_raddr // save the address which receives the value of the destination register.
//
PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI ri2c1_a1 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c1_a1: push ri2c1_addr
pushi 1
shl // make the i2c device address with the write flag
pop wi2c1_waddr
//
pushi ri2c1_a2
jmp si2c1
//
ri2c1_a2: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c1_a3 //
JMP SubI2C1 // call the subroutine
//
ri2c1_a3: push ri2c1_reg
pushi ri2c1_a4
jmp si2c1
//
ri2c1_a4: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c1_a5 //
JMP SubI2C1 // call the subroutine
//
ri2c1_a5: PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI ri2c1_a6 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c1_a6: push ri2c1_addr
pushi 1
shl // make the i2c device address with the read flag
pushi 0x0001
BOR
pushi ri2c1_a7
jmp si2c1
//
ri2c1_a7: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c1_a8 //
JMP SubI2C1 // call the subroutine
//
ri2c1_a8: pushi i2cRead
pushi ri2c1_a9
jmp SubI2C1
//
ri2c1_a9: push ri2c1_raddr
in
st
//
PUSHI i2cNAck // push arg1 .... Ack
PUSHI ri2c1_a10 //
JMP SubI2C1 // call the subroutine
//
ri2c1_a10: PUSHI i2cStop // push arg1 .... write the ack
PUSHI ri2c1_a11 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c1_a11: pushI 1
ri2c1_rtn: jmp 0x000 // return
ri2c1_jmp: 0x4000
ri2c1_addr: 0x0000
ri2c1_reg: 0x0000
ri2c1_raddr: 0x0000
//
// ri2c2
// Read 2 byte series from an i2c device
// ... arg1 ... device address, arg2 ... register number, arg3 ... the address for receiving the data
// return ... if 1: ok, 0:error
//
ri2c2: PUSH ri2c2_jmp // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP ri2c2_rtn // save the return instruction
POP ri2c2_addr // save the arg1, the i2c slave address
pop ri2c2_reg // save the arg2, destination register address
pop ri2c2_raddr // save the address which receives the value of the destination register.
//
PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI ri2c2_a1 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c2_a1: push ri2c2_addr
pushi 1
shl // make the i2c device address with the write flag
//
pushi ri2c2_a2
jmp si2c1
//
ri2c2_a2: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c2_a3 //
JMP SubI2C1 // call the subroutine
//
ri2c2_a3: push ri2c2_reg
pushi ri2c2_a4
jmp si2c1
//
ri2c2_a4: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c2_a5 //
JMP SubI2C1 // call the subroutine
//
ri2c2_a5: PUSHI i2cStart // push arg1... the i2c slave Addr
PUSHI ri2c2_a6 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c2_a6: push ri2c2_addr
pushi 1
shl // make the i2c device address with the read flag
pushi 0x0001
BOR
pushi ri2c2_a7
jmp si2c1
//
ri2c2_a7: PUSHI i2cRAck // push arg1 .... read the ack
PUSHI ri2c2_a8 //
JMP SubI2C1 // call the subroutine
//
ri2c2_a8: pushi i2cRead
pushi ri2c2_l9
jmp SubI2C1
//
ri2c2_l9: in
pushi 8
shl
pop ri2c2_val1
//
PUSHI i2cWAck // push arg1 .... write the ack
PUSHI ri2c2_a10 //
JMP SubI2C1 // call the subroutine
//
ri2c2_a10: pushi i2cRead
pushi ri2c2_a11
jmp SubI2C1
//
ri2c2_a11: push ri2c2_raddr
in
push ri2c2_val1
bor
st
//
PUSHI i2cNAck // push arg1 .... Ack
PUSHI ri2c2_a12 //
JMP SubI2C1 // call the subroutine
//
ri2c2_a12: PUSHI i2cStop // push arg1 .... write the ack
PUSHI ri2c2_a13 // push the return address
JMP SubI2C1 // call the subroutine
//
ri2c2_a13: pushI 1
ri2c2_rtn: jmp 0x000 // return
ri2c2_jmp: 0x4000
ri2c2_addr: 0x0000
ri2c2_reg: 0x0000
ri2c2_raddr: 0x0000
ri2c2_val1: 0x0000
//
// SubI2C1 ... send the [arg1] steps of I2C [scl,sda] sequence after the address of [arg1 +1] to the i2c bus.
//
SubI2C1: PUSH LblJMP // subroutine. the 1st step to make the return instruction
BOR // make the return instruction using arg1 and the previous instruction
POP RtnSub1 // save the return instruction
POP Sub1Data2 // save the arg1
PUSH Sub1Data2
LD
POP N
PUSH Sub1Data2
PUSHI 1
ADD
POP Sub1SA
PUSHI 0
POP i
L1: PUSH i
PUSH Sub1SA
ADD
LD //... Sub1S[i];
OUT //... print(Sub1S[i]) ;
PUSH i
PUSHI 1
ADD
POP i
PUSH i
PUSH N
SUB
JNZ L1 // if(i<n) goto L1;
RtnSub1: JMP 0x000 // return
LblJMP: 0x4000
Sub1Data2: 0x0000
Sub1SA: 0x0000
i: 0x0000
N: 0x0000
//
// data for controlling i2c
// (MSB) ...... scl, sda (LSB)
//
// I2C start
i2cStart: 3
1 //01
3 //11
2 //10
0 //00
//
// I2C AddrWrite
i2cAddrW: 3
0 // 00
2 // 10 send 0 ... write
0 // 00
//
// I2C AddrRead
i2cAddrR: 3
1 // 01
3 // 11 ... read
1 // 01
//
// I2C
i2cRAck: 3
1 // 01
3 // 11 read ack
1 // 01
//
// I2C Write Ack
i2cWAck: 3
0 // 00
2 // 10 send 0 ... write
0 // 00
//
// I2C NAck
i2cNAck: 3
1 //01
3 // ... read
1 //
//
//
// stop
i2cStop: 3
2 // 10
3 // 11 stop the transfering
3 // 11
//
// I2C read 1byte
i2cRead: 0x0011
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
3 // 11
1 // 01
- 目的コード+アセンブラソース
mem[12'h000]=16'h100b ; // PUSHI rtnval
mem[12'h001]=16'h200d ; // PUSH tempReadReg
mem[12'h002]=16'h200e ; // push tempAddr
mem[12'h003]=16'h1005 ; // pushi rtn0
mem[12'h004]=16'h4104 ; // JMP ri2c2
mem[12'h005]=16'h300c ; //rtn0: pop rtncode
mem[12'h006]=16'h200b ; // PUSH rtnval
mem[12'h007]=16'h1007 ; // PUSHI 7
mem[12'h008]=16'hf004 ; // shr
mem[12'h009]=16'he000 ; // OUT
mem[12'h00a]=16'h0000 ; // HALT
mem[12'h00b]=16'h0000 ; //rtnval: 0x0000
mem[12'h00c]=16'h0000 ; //rtncode: 0x0000
mem[12'h00d]=16'h0000 ; //tempReadReg: 0x0000
mem[12'h00e]=16'h004b ; //tempAddr: 0x004b
mem[12'h00f]=16'h2031 ; //wi2c1: PUSH wi2c1_jmp
mem[12'h010]=16'hf006 ; // BOR
mem[12'h011]=16'h3030 ; // POP wi2c1_rtn
mem[12'h012]=16'h3032 ; // POP wi2c1_addr
mem[12'h013]=16'h3033 ; // pop wi2c1_reg
mem[12'h014]=16'h3034 ; // pop wi2c1_val
mem[12'h015]=16'h1167 ; // PUSHI i2cStart
mem[12'h016]=16'h1018 ; // PUSHI wi2c1_l1
mem[12'h017]=16'h4147 ; // JMP SubI2C1
mem[12'h018]=16'h2032 ; //wi2c1_l1: push wi2c1_addr
mem[12'h019]=16'h1001 ; // pushi 1
mem[12'h01a]=16'hf003 ; // shl
mem[12'h01b]=16'h101d ; // pushi wi2c1_l2
mem[12'h01c]=16'h40a8 ; // jmp si2c1
mem[12'h01d]=16'h1174 ; //wi2c1_l2: PUSHI i2cRAck
mem[12'h01e]=16'h1020 ; // PUSHI wi2c1_l3
mem[12'h01f]=16'h4147 ; // JMP SubI2C1
mem[12'h020]=16'h1033 ; //wi2c1_l3: pushi wi2c1_reg
mem[12'h021]=16'h1023 ; // pushi wi2c1_l4
mem[12'h022]=16'h40a8 ; // jmp si2c1
mem[12'h023]=16'h1174 ; //wi2c1_l4: PUSHI i2cRAck
mem[12'h024]=16'h1026 ; // PUSHI wi2c1_l5
mem[12'h025]=16'h4147 ; // JMP SubI2C1
mem[12'h026]=16'h2034 ; //wi2c1_l5: push wi2c1_val
mem[12'h027]=16'h1029 ; // pushi wi2c1_l6
mem[12'h028]=16'h40a8 ; // jmp si2c1
mem[12'h029]=16'h1174 ; //wi2c1_l6: PUSHI i2cRAck
mem[12'h02a]=16'h102c ; // PUSHI wi2c1_l7
mem[12'h02b]=16'h4147 ; // JMP SubI2C1
mem[12'h02c]=16'h1180 ; //wi2c1_l7: PUSHI i2cStop
mem[12'h02d]=16'h102f ; // PUSHI wi2c1_l8
mem[12'h02e]=16'h4147 ; // JMP SubI2C1
mem[12'h02f]=16'h1001 ; //wi2c1_l8: pushI 1
mem[12'h030]=16'h4000 ; //wi2c1_rtn: jmp 0x000
mem[12'h031]=16'h4000 ; //wi2c1_jmp: 0x4000
mem[12'h032]=16'h0000 ; //wi2c1_addr: 0x0000
mem[12'h033]=16'h0000 ; //wi2c1_reg: 0x0000
mem[12'h034]=16'h0000 ; //wi2c1_val: 0x0000
mem[12'h035]=16'h2062 ; //wi2c2: PUSH wi2c2_jmp
mem[12'h036]=16'hf006 ; // BOR
mem[12'h037]=16'h3061 ; // POP wi2c2_rtn
mem[12'h038]=16'h3063 ; // POP wi2c2_addr
mem[12'h039]=16'h3064 ; // pop wi2c2_reg
mem[12'h03a]=16'h3065 ; // pop wi2c2_val
mem[12'h03b]=16'h1167 ; // PUSHI i2cStart
mem[12'h03c]=16'h103e ; // PUSHI wi2c2_l1
mem[12'h03d]=16'h4147 ; // JMP SubI2C1
mem[12'h03e]=16'h2063 ; //wi2c2_l1: push wi2c2_addr
mem[12'h03f]=16'h1001 ; // pushi 1
mem[12'h040]=16'hf003 ; // shl
mem[12'h041]=16'h3000 ; // pop wi2c2_waddr
mem[12'h042]=16'h1044 ; // pushi wi2c2_l2
mem[12'h043]=16'h40a8 ; // jmp si2c1
mem[12'h044]=16'h1174 ; //wi2c2_l2: PUSHI i2cRAck
mem[12'h045]=16'h1047 ; // PUSHI wi2c2_l3
mem[12'h046]=16'h4147 ; // JMP SubI2C1
mem[12'h047]=16'h2064 ; //wi2c2_l3: push wi2c2_reg
mem[12'h048]=16'h104a ; // pushi wi2c2_l4
mem[12'h049]=16'h40a8 ; // jmp si2c1
mem[12'h04a]=16'h1174 ; //wi2c2_l4: PUSHI i2cRAck
mem[12'h04b]=16'h104d ; // PUSHI wi2c2_l5
mem[12'h04c]=16'h4147 ; // JMP SubI2C1
mem[12'h04d]=16'h2065 ; //wi2c2_l5: push wi2c2_val
mem[12'h04e]=16'h10ff ; // pushi 0x00ff
mem[12'h04f]=16'hf005 ; // band
mem[12'h050]=16'h1052 ; // pushi wi2c2_l6
mem[12'h051]=16'h40a8 ; // jmp si2c1
mem[12'h052]=16'h1174 ; //wi2c2_l6: PUSHI i2cRAck
mem[12'h053]=16'h1055 ; // PUSHI wi2c2_l7
mem[12'h054]=16'h4147 ; // JMP SubI2C1
mem[12'h055]=16'h2065 ; //wi2c2_l7: push wi2c2_val
mem[12'h056]=16'h1008 ; // pushi 8
mem[12'h057]=16'hf004 ; // shr
mem[12'h058]=16'h105a ; // pushi wi2c2_l8
mem[12'h059]=16'h40a8 ; // jmp si2c1
mem[12'h05a]=16'h1174 ; //wi2c2_l8: PUSHI i2cRAck
mem[12'h05b]=16'h105d ; // PUSHI wi2c2_l9
mem[12'h05c]=16'h4147 ; // JMP SubI2C1
mem[12'h05d]=16'h1180 ; //wi2c2_l9: PUSHI i2cStop
mem[12'h05e]=16'h1060 ; // PUSHI wi2c2_l10
mem[12'h05f]=16'h4147 ; // JMP SubI2C1
mem[12'h060]=16'h1001 ; //wi2c2_l10: pushI 1
mem[12'h061]=16'h4000 ; //wi2c2_rtn: jmp 0x000
mem[12'h062]=16'h4000 ; //wi2c2_jmp: 0x4000
mem[12'h063]=16'h0000 ; //wi2c2_addr: 0x0000
mem[12'h064]=16'h0000 ; //wi2c2_reg: 0x0000
mem[12'h065]=16'h0000 ; //wi2c2_val: 0x0000
mem[12'h066]=16'h20a3 ; //wi2c4: PUSH wi2c4_jmp
mem[12'h067]=16'hf006 ; // BOR
mem[12'h068]=16'h30a2 ; // POP wi2c4_rtn
mem[12'h069]=16'h30a4 ; // POP wi2c4_addr
mem[12'h06a]=16'h30a5 ; // pop wi2c4_reg
mem[12'h06b]=16'h30a6 ; // pop wi2c4_val1
mem[12'h06c]=16'h30a7 ; // pop wi2c4_val2
mem[12'h06d]=16'h1167 ; // PUSHI i2cStart
mem[12'h06e]=16'h1070 ; // PUSHI wi2c4_l1
mem[12'h06f]=16'h4147 ; // JMP SubI2C1
mem[12'h070]=16'h20a4 ; //wi2c4_l1: push wi2c4_addr
mem[12'h071]=16'h1001 ; // pushi 1
mem[12'h072]=16'hf003 ; // shl
mem[12'h073]=16'h1075 ; // pushi wi2c4_l2
mem[12'h074]=16'h40a8 ; // jmp si2c1
mem[12'h075]=16'h1174 ; //wi2c4_l2: PUSHI i2cRAck
mem[12'h076]=16'h1078 ; // PUSHI wi2c4_l3
mem[12'h077]=16'h4147 ; // JMP SubI2C1
mem[12'h078]=16'h20a5 ; //wi2c4_l3: push wi2c4_reg
mem[12'h079]=16'h107b ; // pushi wi2c4_l4
mem[12'h07a]=16'h40a8 ; // jmp si2c1
mem[12'h07b]=16'h1174 ; //wi2c4_l4: PUSHI i2cRAck
mem[12'h07c]=16'h107e ; // PUSHI wi2c4_l5
mem[12'h07d]=16'h4147 ; // JMP SubI2C1
mem[12'h07e]=16'h20a6 ; //wi2c4_l5: push wi2c4_val1
mem[12'h07f]=16'h10ff ; // pushi 0x00ff
mem[12'h080]=16'hf005 ; // band
mem[12'h081]=16'h1083 ; // pushi wi2c4_l6
mem[12'h082]=16'h40a8 ; // jmp si2c1
mem[12'h083]=16'h1174 ; //wi2c4_l6: PUSHI i2cRAck
mem[12'h084]=16'h1086 ; // PUSHI wi2c4_l7
mem[12'h085]=16'h4147 ; // JMP SubI2C1
mem[12'h086]=16'h20a6 ; //wi2c4_l7: push wi2c4_val1
mem[12'h087]=16'h1008 ; // pushi 8
mem[12'h088]=16'hf004 ; // shr
mem[12'h089]=16'h108b ; // pushi wi2c4_l8
mem[12'h08a]=16'h40a8 ; // jmp si2c1
mem[12'h08b]=16'h1174 ; //wi2c4_l8: PUSHI i2cRAck
mem[12'h08c]=16'h108e ; // PUSHI wi2c4_l9
mem[12'h08d]=16'h4147 ; // JMP SubI2C1
mem[12'h08e]=16'h20a7 ; //wi2c4_l9: push wi2c4_val2
mem[12'h08f]=16'h10ff ; // pushi 0x00ff
mem[12'h090]=16'hf005 ; // band
mem[12'h091]=16'h1093 ; // pushi wi2c4_l10
mem[12'h092]=16'h40a8 ; // jmp si2c1
mem[12'h093]=16'h1174 ; //wi2c4_l10: PUSHI i2cRAck
mem[12'h094]=16'h1096 ; // PUSHI wi2c4_l11
mem[12'h095]=16'h4147 ; // JMP SubI2C1
mem[12'h096]=16'h20a7 ; //wi2c4_l11: push wi2c4_val2
mem[12'h097]=16'h1008 ; // pushi 8
mem[12'h098]=16'hf004 ; // shr
mem[12'h099]=16'h109b ; // pushi wi2c4_l12
mem[12'h09a]=16'h40a8 ; // jmp si2c1
mem[12'h09b]=16'h1174 ; //wi2c4_l12: PUSHI i2cRAck
mem[12'h09c]=16'h109e ; // PUSHI wi2c4_l13
mem[12'h09d]=16'h4147 ; // JMP SubI2C1
mem[12'h09e]=16'h1180 ; //wi2c4_l13: PUSHI i2cStop
mem[12'h09f]=16'h10a1 ; // PUSHI wi2c4_l14
mem[12'h0a0]=16'h4147 ; // JMP SubI2C1
mem[12'h0a1]=16'h1001 ; //wi2c4_l14: pushI 1
mem[12'h0a2]=16'h4000 ; //wi2c4_rtn: jmp 0x000
mem[12'h0a3]=16'h4000 ; //wi2c4_jmp: 0x4000
mem[12'h0a4]=16'h0000 ; //wi2c4_addr: 0x0000
mem[12'h0a5]=16'h0000 ; //wi2c4_reg: 0x0000
mem[12'h0a6]=16'h0000 ; //wi2c4_val1: 0x0000
mem[12'h0a7]=16'h0000 ; //wi2c4_val2: 0x0000
mem[12'h0a8]=16'h20ca ; //si2c1: PUSH si2c1_jmp
mem[12'h0a9]=16'hf006 ; // BOR
mem[12'h0aa]=16'h30c9 ; // POP si2c1_rtn
mem[12'h0ab]=16'h30cb ; // POP si2c1_val
mem[12'h0ac]=16'h1008 ; // PUSHI 8
mem[12'h0ad]=16'h30cc ; // POP si2c1_i
mem[12'h0ae]=16'h20cb ; //si2c1_a3: push si2c1_val
mem[12'h0af]=16'h1080 ; // pushi 0x0080
mem[12'h0b0]=16'hf005 ; // band
mem[12'h0b1]=16'h60b9 ; // JNZ si2c1_a1
mem[12'h0b2]=16'h1000 ; // pushi 0x0000
mem[12'h0b3]=16'he000 ; // out
mem[12'h0b4]=16'h1002 ; // pushi 0x0002
mem[12'h0b5]=16'he000 ; // out
mem[12'h0b6]=16'h1000 ; // pushi 0x0000
mem[12'h0b7]=16'he000 ; // out
mem[12'h0b8]=16'h40bf ; // jmp si2c1_a2
mem[12'h0b9]=16'h1001 ; //si2c1_a1: pushi 0x0001
mem[12'h0ba]=16'he000 ; // out
mem[12'h0bb]=16'h1003 ; // pushi 0x0003
mem[12'h0bc]=16'he000 ; // out
mem[12'h0bd]=16'h1001 ; // pushi 0x0001
mem[12'h0be]=16'he000 ; // out
mem[12'h0bf]=16'h20cb ; //si2c1_a2: push si2c1_val
mem[12'h0c0]=16'h1001 ; // pushi 1
mem[12'h0c1]=16'hf003 ; // shl
mem[12'h0c2]=16'h30cb ; // pop si2c1_val
mem[12'h0c3]=16'h20cc ; // push si2c1_i
mem[12'h0c4]=16'h1001 ; // pushi 1
mem[12'h0c5]=16'hf001 ; // sub
mem[12'h0c6]=16'h30cc ; // pop si2c1_i
mem[12'h0c7]=16'h20cc ; // push si2c1_i
mem[12'h0c8]=16'h60ae ; // jnz si2c1_a3
mem[12'h0c9]=16'h4000 ; //si2c1_rtn: jmp 0x000
mem[12'h0ca]=16'h4000 ; //si2c1_jmp: 0x4000
mem[12'h0cb]=16'h0000 ; //si2c1_val: 0x0000
mem[12'h0cc]=16'h0000 ; //si2c1_i: 0x0000
mem[12'h0cd]=16'h2100 ; //ri2c1: PUSH ri2c1_jmp
mem[12'h0ce]=16'hf006 ; // BOR
mem[12'h0cf]=16'h30ff ; // POP ri2c1_rtn
mem[12'h0d0]=16'h3101 ; // POP ri2c1_addr
mem[12'h0d1]=16'h3102 ; // pop ri2c1_reg
mem[12'h0d2]=16'h3103 ; // pop ri2c1_raddr
mem[12'h0d3]=16'h1167 ; // PUSHI i2cStart
mem[12'h0d4]=16'h10d6 ; // PUSHI ri2c1_a1
mem[12'h0d5]=16'h4147 ; // JMP SubI2C1
mem[12'h0d6]=16'h2101 ; //ri2c1_a1: push ri2c1_addr
mem[12'h0d7]=16'h1001 ; // pushi 1
mem[12'h0d8]=16'hf003 ; // shl
mem[12'h0d9]=16'h3000 ; // pop wi2c1_waddr
mem[12'h0da]=16'h10dc ; // pushi ri2c1_a2
mem[12'h0db]=16'h40a8 ; // jmp si2c1
mem[12'h0dc]=16'h1174 ; //ri2c1_a2: PUSHI i2cRAck
mem[12'h0dd]=16'h10df ; // PUSHI ri2c1_a3
mem[12'h0de]=16'h4147 ; // JMP SubI2C1
mem[12'h0df]=16'h2102 ; //ri2c1_a3: push ri2c1_reg
mem[12'h0e0]=16'h10e2 ; // pushi ri2c1_a4
mem[12'h0e1]=16'h40a8 ; // jmp si2c1
mem[12'h0e2]=16'h1174 ; //ri2c1_a4: PUSHI i2cRAck
mem[12'h0e3]=16'h10e5 ; // PUSHI ri2c1_a5
mem[12'h0e4]=16'h4147 ; // JMP SubI2C1
mem[12'h0e5]=16'h1167 ; //ri2c1_a5: PUSHI i2cStart
mem[12'h0e6]=16'h10e8 ; // PUSHI ri2c1_a6
mem[12'h0e7]=16'h4147 ; // JMP SubI2C1
mem[12'h0e8]=16'h2101 ; //ri2c1_a6: push ri2c1_addr
mem[12'h0e9]=16'h1001 ; // pushi 1
mem[12'h0ea]=16'hf003 ; // shl
mem[12'h0eb]=16'h1001 ; // pushi 0x0001
mem[12'h0ec]=16'hf006 ; // BOR
mem[12'h0ed]=16'h10ef ; // pushi ri2c1_a7
mem[12'h0ee]=16'h40a8 ; // jmp si2c1
mem[12'h0ef]=16'h1174 ; //ri2c1_a7: PUSHI i2cRAck
mem[12'h0f0]=16'h10f2 ; // PUSHI ri2c1_a8
mem[12'h0f1]=16'h4147 ; // JMP SubI2C1
mem[12'h0f2]=16'h1184 ; //ri2c1_a8: pushi i2cRead
mem[12'h0f3]=16'h10f5 ; // pushi ri2c1_a9
mem[12'h0f4]=16'h4147 ; // jmp SubI2C1
mem[12'h0f5]=16'h2103 ; //ri2c1_a9: push ri2c1_raddr
mem[12'h0f6]=16'hd000 ; // in
mem[12'h0f7]=16'h8000 ; // st
mem[12'h0f8]=16'h117c ; // PUSHI i2cNAck
mem[12'h0f9]=16'h10fb ; // PUSHI ri2c1_a10
mem[12'h0fa]=16'h4147 ; // JMP SubI2C1
mem[12'h0fb]=16'h1180 ; //ri2c1_a10: PUSHI i2cStop
mem[12'h0fc]=16'h10fe ; // PUSHI ri2c1_a11
mem[12'h0fd]=16'h4147 ; // JMP SubI2C1
mem[12'h0fe]=16'h1001 ; //ri2c1_a11: pushI 1
mem[12'h0ff]=16'h4000 ; //ri2c1_rtn: jmp 0x000
mem[12'h100]=16'h4000 ; //ri2c1_jmp: 0x4000
mem[12'h101]=16'h0000 ; //ri2c1_addr: 0x0000
mem[12'h102]=16'h0000 ; //ri2c1_reg: 0x0000
mem[12'h103]=16'h0000 ; //ri2c1_raddr: 0x0000
mem[12'h104]=16'h2142 ; //ri2c2: PUSH ri2c2_jmp
mem[12'h105]=16'hf006 ; // BOR
mem[12'h106]=16'h3141 ; // POP ri2c2_rtn
mem[12'h107]=16'h3143 ; // POP ri2c2_addr
mem[12'h108]=16'h3144 ; // pop ri2c2_reg
mem[12'h109]=16'h3145 ; // pop ri2c2_raddr
mem[12'h10a]=16'h1167 ; // PUSHI i2cStart
mem[12'h10b]=16'h110d ; // PUSHI ri2c2_a1
mem[12'h10c]=16'h4147 ; // JMP SubI2C1
mem[12'h10d]=16'h2143 ; //ri2c2_a1: push ri2c2_addr
mem[12'h10e]=16'h1001 ; // pushi 1
mem[12'h10f]=16'hf003 ; // shl
mem[12'h110]=16'h1112 ; // pushi ri2c2_a2
mem[12'h111]=16'h40a8 ; // jmp si2c1
mem[12'h112]=16'h1174 ; //ri2c2_a2: PUSHI i2cRAck
mem[12'h113]=16'h1115 ; // PUSHI ri2c2_a3
mem[12'h114]=16'h4147 ; // JMP SubI2C1
mem[12'h115]=16'h2144 ; //ri2c2_a3: push ri2c2_reg
mem[12'h116]=16'h1118 ; // pushi ri2c2_a4
mem[12'h117]=16'h40a8 ; // jmp si2c1
mem[12'h118]=16'h1174 ; //ri2c2_a4: PUSHI i2cRAck
mem[12'h119]=16'h111b ; // PUSHI ri2c2_a5
mem[12'h11a]=16'h4147 ; // JMP SubI2C1
mem[12'h11b]=16'h1167 ; //ri2c2_a5: PUSHI i2cStart
mem[12'h11c]=16'h111e ; // PUSHI ri2c2_a6
mem[12'h11d]=16'h4147 ; // JMP SubI2C1
mem[12'h11e]=16'h2143 ; //ri2c2_a6: push ri2c2_addr
mem[12'h11f]=16'h1001 ; // pushi 1
mem[12'h120]=16'hf003 ; // shl
mem[12'h121]=16'h1001 ; // pushi 0x0001
mem[12'h122]=16'hf006 ; // BOR
mem[12'h123]=16'h1125 ; // pushi ri2c2_a7
mem[12'h124]=16'h40a8 ; // jmp si2c1
mem[12'h125]=16'h1174 ; //ri2c2_a7: PUSHI i2cRAck
mem[12'h126]=16'h1128 ; // PUSHI ri2c2_a8
mem[12'h127]=16'h4147 ; // JMP SubI2C1
mem[12'h128]=16'h1184 ; //ri2c2_a8: pushi i2cRead
mem[12'h129]=16'h112b ; // pushi ri2c2_l9
mem[12'h12a]=16'h4147 ; // jmp SubI2C1
mem[12'h12b]=16'hd000 ; //ri2c2_l9: in
mem[12'h12c]=16'h1008 ; // pushi 8
mem[12'h12d]=16'hf003 ; // shl
mem[12'h12e]=16'h3146 ; // pop ri2c2_val1
mem[12'h12f]=16'h1178 ; // PUSHI i2cWAck
mem[12'h130]=16'h1132 ; // PUSHI ri2c2_a10
mem[12'h131]=16'h4147 ; // JMP SubI2C1
mem[12'h132]=16'h1184 ; //ri2c2_a10: pushi i2cRead
mem[12'h133]=16'h1135 ; // pushi ri2c2_a11
mem[12'h134]=16'h4147 ; // jmp SubI2C1
mem[12'h135]=16'h2145 ; //ri2c2_a11: push ri2c2_raddr
mem[12'h136]=16'hd000 ; // in
mem[12'h137]=16'h2146 ; // push ri2c2_val1
mem[12'h138]=16'hf006 ; // bor
mem[12'h139]=16'h8000 ; // st
mem[12'h13a]=16'h117c ; // PUSHI i2cNAck
mem[12'h13b]=16'h113d ; // PUSHI ri2c2_a12
mem[12'h13c]=16'h4147 ; // JMP SubI2C1
mem[12'h13d]=16'h1180 ; //ri2c2_a12: PUSHI i2cStop
mem[12'h13e]=16'h1140 ; // PUSHI ri2c2_a13
mem[12'h13f]=16'h4147 ; // JMP SubI2C1
mem[12'h140]=16'h1001 ; //ri2c2_a13: pushI 1
mem[12'h141]=16'h4000 ; //ri2c2_rtn: jmp 0x000
mem[12'h142]=16'h4000 ; //ri2c2_jmp: 0x4000
mem[12'h143]=16'h0000 ; //ri2c2_addr: 0x0000
mem[12'h144]=16'h0000 ; //ri2c2_reg: 0x0000
mem[12'h145]=16'h0000 ; //ri2c2_raddr: 0x0000
mem[12'h146]=16'h0000 ; //ri2c2_val1: 0x0000
mem[12'h147]=16'h2162 ; //SubI2C1: PUSH LblJMP
mem[12'h148]=16'hf006 ; // BOR
mem[12'h149]=16'h3161 ; // POP RtnSub1
mem[12'h14a]=16'h3163 ; // POP Sub1Data2
mem[12'h14b]=16'h2163 ; // PUSH Sub1Data2
mem[12'h14c]=16'h7000 ; // LD
mem[12'h14d]=16'h3166 ; // POP N
mem[12'h14e]=16'h2163 ; // PUSH Sub1Data2
mem[12'h14f]=16'h1001 ; // PUSHI 1
mem[12'h150]=16'hf000 ; // ADD
mem[12'h151]=16'h3164 ; // POP Sub1SA
mem[12'h152]=16'h1000 ; // PUSHI 0
mem[12'h153]=16'h3165 ; // POP i
mem[12'h154]=16'h2165 ; //L1: PUSH i
mem[12'h155]=16'h2164 ; // PUSH Sub1SA
mem[12'h156]=16'hf000 ; // ADD
mem[12'h157]=16'h7000 ; // LD
mem[12'h158]=16'he000 ; // OUT
mem[12'h159]=16'h2165 ; // PUSH i
mem[12'h15a]=16'h1001 ; // PUSHI 1
mem[12'h15b]=16'hf000 ; // ADD
mem[12'h15c]=16'h3165 ; // POP i
mem[12'h15d]=16'h2165 ; // PUSH i
mem[12'h15e]=16'h2166 ; // PUSH N
mem[12'h15f]=16'hf001 ; // SUB
mem[12'h160]=16'h6154 ; // JNZ L1
mem[12'h161]=16'h4000 ; //RtnSub1: JMP 0x000
mem[12'h162]=16'h4000 ; //LblJMP: 0x4000
mem[12'h163]=16'h0000 ; //Sub1Data2: 0x0000
mem[12'h164]=16'h0000 ; //Sub1SA: 0x0000
mem[12'h165]=16'h0000 ; //i: 0x0000
mem[12'h166]=16'h0000 ; //N: 0x0000
mem[12'h167]=16'h0003 ; //i2cStart: 3
mem[12'h168]=16'h0001 ; // 1
mem[12'h169]=16'h0003 ; // 3
mem[12'h16a]=16'h0002 ; // 2
mem[12'h16b]=16'h0000 ; // 0
mem[12'h16c]=16'h0003 ; //i2cAddrW: 3
mem[12'h16d]=16'h0000 ; // 0
mem[12'h16e]=16'h0002 ; // 2
mem[12'h16f]=16'h0000 ; // 0
mem[12'h170]=16'h0003 ; //i2cAddrR: 3
mem[12'h171]=16'h0001 ; // 1
mem[12'h172]=16'h0003 ; // 3
mem[12'h173]=16'h0001 ; // 1
mem[12'h174]=16'h0003 ; //i2cRAck: 3
mem[12'h175]=16'h0001 ; // 1
mem[12'h176]=16'h0003 ; // 3
mem[12'h177]=16'h0001 ; // 1
mem[12'h178]=16'h0003 ; //i2cWAck: 3
mem[12'h179]=16'h0000 ; // 0
mem[12'h17a]=16'h0002 ; // 2
mem[12'h17b]=16'h0000 ; // 0
mem[12'h17c]=16'h0003 ; //i2cNAck: 3
mem[12'h17d]=16'h0001 ; // 1
mem[12'h17e]=16'h0003 ; // 3
mem[12'h17f]=16'h0001 ; // 1
mem[12'h180]=16'h0003 ; //i2cStop: 3
mem[12'h181]=16'h0002 ; // 2
mem[12'h182]=16'h0003 ; // 3
mem[12'h183]=16'h0003 ; // 3
mem[12'h184]=16'h0011 ; //i2cRead: 0x0011
mem[12'h185]=16'h0001 ; // 1
mem[12'h186]=16'h0003 ; // 3
mem[12'h187]=16'h0001 ; // 1
mem[12'h188]=16'h0003 ; // 3
mem[12'h189]=16'h0001 ; // 1
mem[12'h18a]=16'h0003 ; // 3
mem[12'h18b]=16'h0001 ; // 1
mem[12'h18c]=16'h0003 ; // 3
mem[12'h18d]=16'h0001 ; // 1
mem[12'h18e]=16'h0003 ; // 3
mem[12'h18f]=16'h0001 ; // 1
mem[12'h190]=16'h0003 ; // 3
mem[12'h191]=16'h0001 ; // 1
mem[12'h192]=16'h0003 ; // 3
mem[12'h193]=16'h0001 ; // 1
mem[12'h194]=16'h0003 ; // 3
mem[12'h195]=16'h0001 ; // 1
その他のソース †
- minicpu.v
- top.v
- top.xdc (vivado)
Counter: 2052,
today: 1,
yesterday: 1
|