如果方便的话,请下载qemu的源代码,其中的target-unicore32/translate.c中有unicore32的译码过程。 disas_uc32_insn可作为入口: AAAB BBBC xxxx xxxx xxxx xxxD xxEx xxxx AAA:大类 BBBB:Opcode 雪涛 > -----邮件原件----- > 发件人: llvm-uc-bounce@xxxxxxxxxxxxx [mailto:llvm-uc-bounce@xxxxxxxxxxxxx] > 代表 陳韋任 (Wei-Ren Chen) > 发送时间: Friday, December 14, 2012 10:27 > 收件人: llvm-uc@xxxxxxxxxxxxx > 主题: [llvm-uc] Re: LLVM 初步准备支持的 uc 指令,ld & st 部分未能整理 > > Hi all, > > 附件是基於當前 git://github.com/J-Liu/llvm.git 的 patch。 > 這份 patch 主要是讓 LLVM 可以通過 ret0.ll 測試。這份修改 > 主要在增加在 UniCoreInstrInfo.td 和 UniCoreInstrFormats.td > 增加對立即數的支持。這部分代碼參考 openrisc 的設計: > > https://github.com/skristiansson/llvm-or1k > > http://people.cs.nctu.edu.tw/~chenwj/spec/openrisc/openrisc-arch-1.0-draft2. > pdf > > 我想這邊還是需要針對 unicore 做些調整。我目前比較有問題的是 > 底下這段代碼: > > --- > class UniCoreInst<dag outs, dag ins, > string asmstr, list<dag> pattern> : Instruction { > field bits<32> Inst; > > let Namespace = "UniCore"; > > bits<2> optype; > bits<4> opcode; > let Inst{31-30} = optype; > let Inst{29-26} = opcode; > > dag OutOperandList = outs; > dag InOperandList = ins; > > let AsmString = asmstr; > let Pattern = pattern; > } > > class InstRI<bits<4> op, dag outs, dag ins, > string asmstr, list<dag> pattern> > : UniCoreInst<outs, ins, asmstr, pattern> { > let optype = 0b10; > let opcode = op; > } > --- > > 這裡我比較想知道 unicore 指令的編碼是怎樣的一個規矩,也就是各個 > 欄位分別代表什麼意思有沒有一定的樣式。請大家給些意見。LLVM 代碼 > 或是 patch 有不懂的地方也請提出來。Thanks! :-) > > Regards, > chenwj > > -- > Wei-Ren Chen (陳韋任) > Computer Systems Lab, Institute of Information Science, Academia Sinica, > Taiwan (R.O.C.) > Tel:886-2-2788-3799 #1667 > Homepage: http://people.cs.nctu.edu.tw/~chenwj