SystemVerilog开源编译解析工具slang入门2:单步调试

上一节介绍了编译和安装,本节介绍下如何使用VisualStudio进行单步调试,在VisualStudio界面中的调试下面选择调试和启动driver设置配置单步调试的配置

配置的lauch.vs.json文件内容如下:

{
  "version": "0.2.1",
  "defaults": {},
  "configurations": [
    {
      "type": "default",
      "project": "CMakeLists.txt",
      "projectTarget": "slang.exe (bin\\slang.exe)",
      "name": "slang.exe (bin\\slang.exe)",
        "args": [
            "F:\\test\\multi_logic.v",
            "--ast-json",
            "F:\\ast.json"
        ]
    }
  ]
}

这里编译的muti_logic.v文件内容为:

module multi_logic (a,clk,ou);
	input a,clk;
	output ou;      
	reg a,clk,ou;           
	always @(posedge clk) begin
        ou <= a;
	end
endmodule

执行调试指令,执行完成后结果如下图:

对应位置会生成对应的语法树对应的.json文件ast.json,内容为:

{
  "name": "$root",
  "kind": "Root",
  "addr": 2161194855600,
  "members": [
    {
      "name": "",
      "kind": "CompilationUnit",
      "addr": 2161195038752
    },
    {
      "name": "multi_logic",
      "kind": "Instance",
      "addr": 2161195041392,
      "body": {
        "name": "multi_logic",
        "kind": "InstanceBody",
        "addr": 2161195039120,
        "members": [
          {
            "name": "a",
            "kind": "Port",
            "addr": 2161195041512,
            "type": "reg",
            "direction": "In",
            "internalSymbol": "2161195040736 a"
          },
          {
            "name": "clk",
            "kind": "Port",
            "addr": 2161195041688,
            "type": "reg",
            "direction": "In",
            "internalSymbol": "2161195040912 clk"
          },
          {
            "name": "ou",
            "kind": "Port",
            "addr": 2161195041864,
            "type": "reg",
            "direction": "Out",
            "internalSymbol": "2161195041088 ou"
          },
          {
            "name": "a",
            "kind": "Variable",
            "addr": 2161195040736,
            "type": "reg",
            "lifetime": "Static"
          },
          {
            "name": "clk",
            "kind": "Variable",
            "addr": 2161195040912,
            "type": "reg",
            "lifetime": "Static"
          },
          {
            "name": "ou",
            "kind": "Variable",
            "addr": 2161195041088,
            "type": "reg",
            "lifetime": "Static"
          },
          {
            "name": "",
            "kind": "ProceduralBlock",
            "addr": 2161195041264,
            "procedureKind": "Always",
            "body": {
              "kind": "Timed",
              "timing": {
                "kind": "SignalEvent",
                "expr": {
                  "kind": "NamedValue",
                  "type": "reg",
                  "symbol": "2161195040912 clk"
                },
                "edge": "PosEdge"
              },
              "stmt": {
                "kind": "Block",
                "blockKind": "Sequential",
                "body": {
                  "kind": "ExpressionStatement",
                  "expr": {
                    "kind": "Assignment",
                    "type": "reg",
                    "left": {
                      "kind": "NamedValue",
                      "type": "reg",
                      "symbol": "2161195041088 ou"
                    },
                    "right": {
                      "kind": "NamedValue",
                      "type": "reg",
                      "symbol": "2161195040736 a"
                    },
                    "isNonBlocking": true
                  }
                }
              }
            }
          }
        ],
        "definition": "multi_logic"
      },
      "connections": [
      ]
    }
  ]
}
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值