Install - NetlistSVG

NetlistSVG ์„ค์น˜ํ•˜๊ธฐ

๋ฒ ๋ฆด๋กœ๊ทธ ์ฝ”๋“œ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์†์‰ฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค์ˆ˜ ์žˆ๋Š” NPM ํŒจํ‚ค์ง€์˜ NetlistSVG๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

node.js & npm & npm ํŒจํ‚ค์ง€์—์„œ netlistsvg ์„ค์น˜๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

Node.js ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€์—์„œ ๋ฐ”์ด๋„ˆ๋ฆฌ ํŒŒ์ผ์„ ๋ฐ›์•„๋„ ๋˜๊ณ , ๋นŒ๋“œํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค.

๊นƒํ—ˆ๋ธŒ ๋ ˆํฌ์ง€ํ† ์— netlistsvg ๋ฅผ ์‹คํ–‰ํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š” ์˜ˆ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

netlistsvg install

1
2
$ git clone https://github.com/nturley/netlistsvg
$ cd examples

examples ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์— ์žˆ๋Š” D flip-flop ์˜ˆ์ œ๋กœ svg ์ด๋ฏธ์ง€ ํŒŒ์ผ์„ ๋งŒ๋“ค์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ œ์˜ ๋ชจ๋“ˆ ์ด๋ฆ„์„ DFF์—์„œ dff ์†Œ๋ฌธ์ž๋กœ ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

dff.v

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// module DFF (output reg Q, input C, D, R);
module dff (
	input C, D, R, 
    output reg Q
);

	always @(posedge C)
		if (~R) begin
			Q <= 1'b0;
		end else begin
			Q <= D;
		end

endmodule

ํด๋Ÿญ C ๊ฐ€ rising edge ์ผ๋•Œ ๋™์ž‘ํ•˜๊ณ ,

๋ฆฌ์…‹ ์ž…๋ ฅ R ์ด negative ์‹ ํ˜ธ๊ฐ€ ๋“ค์–ด์˜ค๋ฉด ์ถœ๋ ฅ Q ๋ฅผ 0์œผ๋กœ ๋ฆฌ์…‹ํ•ฉ๋‹ˆ๋‹ค.

๋ฆฌ์…‹ ์ž…๋ ฅ์ด ์—†์„ ๊ฒฝ์šฐ, ์ถœ๋ ฅ Q ๋Š” ์ž…๋ ฅ D ๊ฐ’์„ ์ €์žฅํ•˜๊ณ , ๋ณ€๊ฒฝ์ด ์—†์œผ๋ฉด ํด๋Ÿญ๊ณผ ์ƒ๊ด€์—†์ด ํ•ด๋‹น ๊ฐ’์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

draw

1
2
$ yosys -q -p "prep -top dff  write_json dff.json" dff.v
$ netlistsvg dff.json -o dff.svg