|
1 | 1 | # SystemVerilog Plugin |
2 | 2 |
|
3 | | -Reads SystemVerilog and UHDM files and processes them into Yosys AST. |
4 | | - |
5 | | -The plugin adds the following commands: |
6 | | - |
7 | | -* `read_systemverilog` |
8 | | -* `read_uhdm` |
9 | | - |
10 | | -A more detailed help on the supported commands can be obtained by running `help <command_name>` in Yosys. |
11 | | - |
12 | | -Please see the dedicated [integration repository](https://github.com/antmicro/yosys-uhdm-plugin-integration) which contains more information about installation and usage of this plugin. |
13 | | -This repository also runs dedicated CI pipelines that perform extensive testing of this plugin. |
14 | | - |
15 | | -## Installation |
16 | | - |
17 | | -A pre-built binary can be downloaded from the [release page](https://github.com/antmicro/yosys-uhdm-plugin-integration/releases). |
18 | | -The release archive contains an installation script that detects Yosys installation and installs the plugin. |
19 | | - |
20 | | -To build from sources please refer to the [integration repository](https://github.com/antmicro/yosys-uhdm-plugin-integration). |
21 | | - |
22 | | -## Usage |
23 | | - |
24 | | -Usage of the plugin is very simple. |
25 | | - |
26 | | -This paragraph describes the synthesis process given the following `counter.sv` file: |
27 | | - |
28 | | -``` |
29 | | -module top ( |
30 | | - input clk, |
31 | | - output [3:0] led |
32 | | -); |
33 | | - localparam BITS = 4; |
34 | | - localparam LOG2DELAY = 22; |
35 | | -
|
36 | | - wire bufg; |
37 | | - BUFG bufgctrl ( |
38 | | - .I(clk), |
39 | | - .O(bufg) |
40 | | - ); |
41 | | - reg [BITS+LOG2DELAY-1:0] counter = 0; |
42 | | - always @(posedge bufg) begin |
43 | | - counter <= counter + 1; |
44 | | - end |
45 | | - assign led[3:0] = counter >> LOG2DELAY; |
46 | | -endmodule |
47 | | -``` |
48 | | - |
49 | | -To load the plugin, execute `plugin -i systemverilog`. |
50 | | -Then to load SystemVerilog sources, execute `read_systemverilog`. |
51 | | -The rest of the flow is exactly the same as without the plugin. |
52 | | - |
53 | | -To synthesize the `counter.sv` file: |
54 | | - |
55 | | -``` |
56 | | -yosys> plugin -i systemverilog |
57 | | -yosys> read_systemverilog counter.v |
58 | | -1. Executing Verilog with UHDM frontend. |
59 | | -[INF:CM0023] Creating log file ./slpp_all/surelog.log. |
60 | | -[WRN:PA0205] counter.v:1: No timescale set for "top". |
61 | | -[INF:CP0300] Compilation... |
62 | | -[INF:CP0303] counter.v:1: Compile module "work@top". |
63 | | -(...) |
64 | | -Generating RTLIL representation for module `\top'. |
65 | | -
|
66 | | -yosys> synth_xilinx |
67 | | -
|
68 | | -2. Executing SYNTH_XILINX pass. |
69 | | -
|
70 | | -(...) |
71 | | -
|
72 | | -3.50. Printing statistics. |
73 | | -
|
74 | | -=== top === |
75 | | -
|
76 | | - Number of wires: 10 |
77 | | - Number of wire bits: 167 |
78 | | - Number of public wires: 4 |
79 | | - Number of public wire bits: 32 |
80 | | - Number of memories: 0 |
81 | | - Number of memory bits: 0 |
82 | | - Number of processes: 0 |
83 | | - Number of cells: 40 |
84 | | - BUFG 1 |
85 | | - CARRY4 7 |
86 | | - FDRE 26 |
87 | | - IBUF 1 |
88 | | - INV 1 |
89 | | - OBUF 4 |
90 | | -
|
91 | | - Estimated number of LCs: 0 |
92 | | -
|
93 | | -3.51. Executing CHECK pass (checking for obvious problems). |
94 | | -Checking module top... |
95 | | -Found and reported 0 problems. |
96 | | -
|
97 | | -yosys> write_edif counter.edif |
98 | | -
|
99 | | -4. Executing EDIF backend. |
100 | | -
|
101 | | -``` |
102 | | -As a result we get a `counter.edif` file that can be further processed to get the bitstream. |
103 | | - |
104 | | -### Parsing multiple files |
105 | | -When parsing multiple files you can either pass them together to the `read_systemverilog` command |
106 | | -or read them one by one using `-defer` flag. In the latter case, you will need to call |
107 | | -`readsystemverilog -link` after processing all files to elaborate them. An example flow would |
108 | | -look like below: |
109 | | -``` |
110 | | -plugin -i systemverilog |
111 | | -# Read each file separately |
112 | | -read_systemverilog -defer dut.sv |
113 | | -read_systemverilog -defer top.sv |
114 | | -# Finish reading files, elaborate the design |
115 | | -read_systemverilog -link |
116 | | -# Continue Yosys flow... |
117 | | -``` |
| 3 | +The SystemVerilog plugin has been moved to [chipsalliance/systemverilog-plugin](https://github.com/chipsalliance/systemverilog-plugin). |
0 commit comments