mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-24 01:25:33 +00:00
Added spice backend
This commit is contained in:
parent
70476e2431
commit
bbe5aa446b
6 changed files with 306 additions and 0 deletions
32
techlibs/cmos/cmos_cells.lib
Normal file
32
techlibs/cmos/cmos_cells.lib
Normal file
|
@ -0,0 +1,32 @@
|
|||
library(demo) {
|
||||
cell(NOT) {
|
||||
area: 3;
|
||||
pin(A) { direction: input; }
|
||||
pin(Y) { direction: output;
|
||||
function: "A'"; }
|
||||
}
|
||||
cell(NAND) {
|
||||
area: 4;
|
||||
pin(A) { direction: input; }
|
||||
pin(B) { direction: input; }
|
||||
pin(Y) { direction: output;
|
||||
function: "(A*B)'"; }
|
||||
}
|
||||
cell(NOR) {
|
||||
area: 4;
|
||||
pin(A) { direction: input; }
|
||||
pin(B) { direction: input; }
|
||||
pin(Y) { direction: output;
|
||||
function: "(A+B)'"; }
|
||||
}
|
||||
cell(DFF) {
|
||||
area: 18;
|
||||
ff(IQ, IQN) { clocked_on: C;
|
||||
next_state: D; }
|
||||
pin(C) { direction: input;
|
||||
clock: true; }
|
||||
pin(D) { direction: input; }
|
||||
pin(Q) { direction: output;
|
||||
function: "IQ"; }
|
||||
}
|
||||
}
|
23
techlibs/cmos/cmos_cells.v
Normal file
23
techlibs/cmos/cmos_cells.v
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
module NOT(A, Y);
|
||||
input A;
|
||||
output Y = ~A;
|
||||
endmodule
|
||||
|
||||
module NAND(A, B, Y);
|
||||
input A, B;
|
||||
output Y = ~(A & B);
|
||||
endmodule
|
||||
|
||||
module NOR(A, B, Y);
|
||||
input A, B;
|
||||
output Y = ~(A | B);
|
||||
endmodule
|
||||
|
||||
module DFF(C, D, Q);
|
||||
input C, D;
|
||||
output reg Q;
|
||||
always @(posedge C)
|
||||
Q <= D;
|
||||
endmodule
|
||||
|
12
techlibs/cmos/counter.v
Normal file
12
techlibs/cmos/counter.v
Normal file
|
@ -0,0 +1,12 @@
|
|||
module counter (clk, rst, en, count);
|
||||
|
||||
input clk, rst, en;
|
||||
output reg [3:0] count;
|
||||
|
||||
always @(posedge clk)
|
||||
if (rst)
|
||||
count <= 4'd0;
|
||||
else if (en)
|
||||
count <= count + 4'd1;
|
||||
|
||||
endmodule
|
11
techlibs/cmos/counter.ys
Normal file
11
techlibs/cmos/counter.ys
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
read_verilog counter.v
|
||||
read_verilog -lib cmos_cells.v
|
||||
|
||||
proc;; memory;; techmap;;
|
||||
dfflibmap -liberty cmos_cells.lib
|
||||
abc -liberty cmos_cells.lib;;
|
||||
|
||||
write_verilog synth.v
|
||||
write_spice synth.sp
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue