-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest2.cpp
More file actions
50 lines (39 loc) · 1.14 KB
/
test2.cpp
File metadata and controls
50 lines (39 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include "slang/syntax/SyntaxTree.h"
#include "slang/compilation/Compilation.h"
#include "slang/text/SourceManager.h"
#include "slang/diagnostics/DiagnosticEngine.h"
#include "slang/diagnostics/TextDiagnosticClient.h"
#include "slang/text/Json.h"
#include "slang/symbols/ASTSerializer.h"
#include "slang/symbols/CompilationUnitSymbols.h"
#include "slang/compilation/DesignTree.h"
#include "slang/symbols/InstanceSymbols.h"
using namespace slang;
struct debugFoo {
public:
Compilation comp;
SourceManager sm;
std::shared_ptr<SyntaxTree> t = SyntaxTree::fromText(R"(
module foo #(parameter int i) (
input logic clk
);
logic [5:0] bar;
always_ff @(posedge clk) begin
bar += 1'b1;
end
endmodule: foo
)", sm);
// Diagnostics& diags;
// RootSymbol& root;
// InstanceSymbol& elem;
// InstanceBodySymbol body;
const InstanceBodySymbol& setup() {
this->comp.addSyntaxTree(t);
auto& diags = comp.getAllDiagnostics();
auto& root = comp.getRoot();
auto& elem = (root.members()[1])->as<InstanceSymbol>();
const auto& body = elem.body;
return body;
}
};