当前位置: 首页 > news >正文

金华网站建设公司排名山东济南seo整站优化费用

金华网站建设公司排名,山东济南seo整站优化费用,wordpress 列表分页,销售用什么软件找客户今天来看一个具体实例#xff0c;上一篇传送门#xff1a;python SystemRDL 包介绍_Bug_Killer_Master的博客-CSDN博客 通常来说#xff0c;我们验证过程用到的情况大多都是需要提取reg field的路径以及reset 值等信息#xff0c;所以比较常见的一种方法就是先把rdl compil…         今天来看一个具体实例上一篇传送门python SystemRDL 包介绍_Bug_Killer_Master的博客-CSDN博客 通常来说我们验证过程用到的情况大多都是需要提取reg field的路径以及reset 值等信息所以比较常见的一种方法就是先把rdl compileelaborate 成Node信息然后输出成json文件因为Python 在其标准库中有一个优秀的 JSON 序列化程序。这意味着我们需要做的就是将寄存器模型中的信息提取为原始数据类型这些数据类型可以很好地转换为JSON。当然我们需要的所有信息都可以放到json文件中以便我们进一步使用。 下面就是转成json的例子首先假设我们的json文件里面各个层级的信息如下 1. convert_field def convert_field(rdlc: RDLCompiler, obj: node.FieldNode) - dict:json_obj dict()json_obj[type] fieldjson_obj[inst_name] obj.inst_namejson_obj[lsb] obj.lsbjson_obj[msb] obj.msbjson_obj[reset] obj.get_property(reset)json_obj[sw_access] obj.get_property(sw).namereturn json_obj FieldNode的所有property参考链接SystemRDL Property Reference — SystemRDL Compiler documentation (systemrdl-compiler.readthedocs.io) 2. convert_reg def convert_reg(rdlc: RDLCompiler, obj: node.RegNode) - dict:if obj.is_array:# Use the RDL Compiler message system to print an error# fatal() raises RDLCompileErrorrdlc.msg.fatal(JSON export does not support arrays,obj.inst.inst_src_ref)# Convert information about the registerjson_obj dict()json_obj[type] regjson_obj[inst_name] obj.inst_namejson_obj[addr_offset] obj.address_offset# Iterate over all the fields in this reg and convert themjson_obj[children] []for field in obj.fields():json_field convert_field(rdlc, field)json_obj[children].append(json_field)return json_obj RegNode的所有property参考链接 3.covert_addrmap_or_regfile def convert_addrmap_or_regfile(rdlc: RDLCompiler, obj: Union[node.AddrmapNode, node.RegfileNode]) - dict:if obj.is_array:rdlc.msg.fatal(JSON export does not support arrays,obj.inst.inst_src_ref)json_obj dict()if isinstance(obj, node.AddrmapNode):json_obj[type] addrmapelif isinstance(obj, node.RegfileNode):json_obj[type] regfileelse:raise RuntimeErrorjson_obj[inst_name] obj.inst_namejson_obj[addr_offset] obj.address_offsetjson_obj[children] []for child in obj.children():if isinstance(child, (node.AddrmapNode, node.RegfileNode)):json_child convert_addrmap_or_regfile(rdlc, child)elif isinstance(child, node.RegNode):json_child convert_reg(rdlc, child)json_obj[children].append(json_child)return json_obj 4.json dump def convert_to_json(rdlc: RDLCompiler, obj: node.RootNode, path: str):# Convert entire register model to primitive datatypes (a dict/list tree)json_obj convert_addrmap_or_regfile(rdlc, obj.top)# Write to a JSON filewith open(path, w, encodingutf-8) as f:json.dump(json_obj, f, indent4) 5.top_function import sys# Compile and elaborate files provided from the command line input_files sys.argv[1:] rdlc RDLCompiler() try:for input_file in input_files:rdlc.compile_file(input_file)root rdlc.elaborate() except RDLCompileError:sys.exit(1) # Dump the register model to a JSON file convert_to_json(rdlc, root, out.json) input rdl: addrmap tiny {reg {field {swrw;hwr;} f1[8] 123;field {swr;hww;} f2[8];}r1; }; output json: {type: addrmap,inst_name: tiny,addr_offset: 0,children: [{type: reg,inst_name: r1,addr_offset: 0,children: [{type: field,inst_name: f1,lsb: 0,msb: 7,reset: 123,sw_access: rw},{type: field,inst_name: f2,lsb: 8,msb: 15,reset: null,sw_access: r}]}] }
http://www.lebaoying.cn/news/5250.html

相关文章:

  • 地方网站方案个人网页背景图片大全
  • 网站推广方案怎么写的河北网站搜索排名优化方案
  • 如何用jsp做网站网站无法下载视频 怎么做
  • 找i满洲做卖房广告不收费的网站中国建筑官网超高层
  • 免费登记照制作app桂林seo哪家好
  • 佛山营销网站设计榆社网站建设
  • 泰国房产网站大全鲜花网站数据库建设
  • 昆山网站建设公司苏州爬虫科技wordpress连接更改
  • 做企业网站所要注意什么wordpress橫排友情链接
  • 做理财的网站网络功能设计
  • 中国建设网官方网站企业登录微信营销和微博营销的本质区别
  • 做淘宝要用的网站吗网站推广软件推广
  • 网站建设与管理A卷流动性管理
  • 全国货运信息网配货seo点击排名
  • 松江网站开发企业年金查询官网
  • 宁波做网站定制游戏网站策划
  • 深圳网站建设工作做网站有个名字叫小廖
  • 手机网站 搜索优化 百度创建一个网站 优帮云
  • 网站制作专家易语言怎么做网站
  • 绿色做环保网站的好处泰州网站整站优化
  • 绞铜机 东莞网站建设搜索最全的搜索引擎
  • 安庆市网站建设wordpress ip设置
  • 苏州网站建设姜超手机扁平化网站模版
  • 温州专门做网站wordpress忘记密码
  • 温州优化网站模板之家
  • 别人给我们做的网站如何关闭怎么让自己的网站
  • 做企业网站需要购什么seo服务收费
  • 网站添加文章梅州市住房和城乡建设局网站
  • 帝国cms 调用网站名称少儿编程加盟店电话
  • 新圩做网站公司wordpress 加速乐