12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package target.mips;
- import java.util.HashMap;
- import template.TPLInterface;
- import template.TemplateCtx;
- /**
- *
- * @author EUGENIO CARVALHO
- */
- public class TemplateMips extends template.Template {
- protected static HashMap<String, TPLInterface> templates = new HashMap<>();
- public TemplateMips(String template, TemplateCtx gctx) {
- super(template, gctx);
- }
- public TemplateMips() {
- }
- @Override
- public String Render(TemplateCtx ctx) {
- if (templates.isEmpty()) {
- templates.put("bin.R", New("{[codop]}{[RBIN(rs,5)]}{[RBIN(rt,5)]}{[RBIN(rd,5)]}{[BIN(sa,5)]}{[func]}", gctx));
- templates.put("bin.I", New("{[codop]}{[RBIN(rs,5)]}{[RBIN(rt,5)]}{[BIN(offset,16)]}", gctx));
- templates.put("bin.J", New("{[codop]}{[target]}", gctx));
- templates.put("bin.S", New("{[txt]}", gctx));
- }
- TListenerMips listener = new TListenerMips(ctx, gctx);
- // listener.AddressGap = 4;
- listener.templates = templates;
- walker.walk(listener, tree);
- return listener.toString();
- }
- @Override
- public TPLInterface New(String tpl, TemplateCtx gctx) {
- return new TemplateMips(tpl, gctx);
- }
- }
|