Skip to content

Commit

Permalink
Extend liberty tests
Browse files Browse the repository at this point in the history
  • Loading branch information
povik committed Aug 13, 2024
1 parent 78382ea commit c35f5e3
Show file tree
Hide file tree
Showing 17 changed files with 556 additions and 4 deletions.
2 changes: 2 additions & 0 deletions tests/liberty/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.log
test.ys
*.filtered
*.verilogsim
15 changes: 15 additions & 0 deletions tests/liberty/XNOR2X1.lib.filtered.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
library(ls05_stdcells) {
cell(XNOR2X1) {
area : 206080.0 ;
pin(B) {
direction : input ;
}
pin(A) {
direction : input ;
}
pin(Y) {
direction : output ;
function : !(B&!A|!B&A) ;
}
}
}
6 changes: 6 additions & 0 deletions tests/liberty/XNOR2X1.lib.verilogsim.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module XNOR2X1 (B, A, Y);
input B;
input A;
output Y;
assign Y = !(B&!A|!B&A); // !(B&!A|!B&A)
endmodule
8 changes: 8 additions & 0 deletions tests/liberty/busdef.lib.filtered.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
library(supergate) {
cell(SRAM) {
area : 1 ;
pin(CE1) {
direction : input ;
}
}
}
3 changes: 3 additions & 0 deletions tests/liberty/busdef.lib.verilogsim.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SRAM (CE1);
input CE1;
endmodule
4 changes: 4 additions & 0 deletions tests/liberty/issue3498_bad.lib.filtered.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library(fake) {
cell(bugbad) {
}
}
2 changes: 2 additions & 0 deletions tests/liberty/issue3498_bad.lib.verilogsim.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module bugbad ();
endmodule
211 changes: 211 additions & 0 deletions tests/liberty/normal.lib.filtered.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
library(supergate) {
cell(inv) {
area : 1 ;
pin(A) {
direction : input ;
}
pin(Y) {
direction : output ;
function : A' ;
}
}
cell(tri_inv) {
area : 4 ;
pin(A) {
direction : input ;
}
pin(S) {
direction : input ;
}
pin(Z) {
direction : output ;
function : A' ;
}
}
cell(buffer) {
area : 5 ;
pin(A) {
direction : input ;
}
pin(Y) {
direction : output ;
function : A ;
}
}
cell(nand2) {
area : 3 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(Y) {
direction : output ;
function : (A * B)' ;
}
}
cell(nor2) {
area : 3 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(Y) {
direction : output ;
function : (A + B)' ;
}
}
cell(xor2) {
area : 6 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(Y) {
direction : output ;
function : (A *B') + (A' * B) ;
}
}
cell(imux2) {
area : 5 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(S) {
direction : input ;
}
pin(Y) {
direction : output ;
function : ( (A * S) + (B * S') )' ;
}
}
cell(dff) {
area : 6 ;
ff(IQ, IQN) {
next_state : D ;
clocked_on : CLK ;
clear : RESET ;
preset : PRESET ;
clear_preset_var1 : L ;
clear_preset_var2 : L ;
}
pin(D) {
direction : input ;
}
pin(CLK) {
direction : input ;
}
pin(RESET) {
direction : input ;
}
pin(PRESET) {
direction : input ;
}
pin(Q) {
direction : output ;
function : IQ ;
}
pin(QN) {
direction : output ;
function : IQN ;
}
}
cell(latch) {
area : 5 ;
latch(IQ, IQN) {
enable : G ;
data_in : D ;
}
pin(D) {
direction : input ;
}
pin(G) {
direction : input ;
}
pin(Q) {
direction : output ;
function : IQ ;
}
pin(QN) {
direction : output ;
function : IQN ;
}
}
cell(aoi211) {
area : 3 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(C) {
direction : input ;
}
pin(Y) {
direction : output ;
function : ((A * B) + C)' ;
}
}
cell(oai211) {
area : 3 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(C) {
direction : input ;
}
pin(Y) {
direction : output ;
function : ((A + B) * C)' ;
}
}
cell(halfadder) {
area : 5 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(C) {
direction : output ;
function : (A * B) ;
}
pin(Y) {
direction : output ;
function : (A *B') + (A' * B) ;
}
}
cell(fulladder) {
area : 8 ;
pin(A) {
direction : input ;
}
pin(B) {
direction : input ;
}
pin(CI) {
direction : input ;
}
pin(CO) {
direction : output ;
function : (((A * B)+(B * CI))+(CI * A)) ;
}
pin(Y) {
direction : output ;
function : ((A^B)^CI) ;
}
}
}
117 changes: 117 additions & 0 deletions tests/liberty/normal.lib.verilogsim.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
module inv (A, Y);
input A;
output Y;
assign Y = ~A; // A'
endmodule
module tri_inv (A, S, Z);
input A;
input S;
output Z;
assign Z = ~A; // A'
endmodule
module buffer (A, Y);
input A;
output Y;
assign Y = A; // A
endmodule
module nand2 (A, B, Y);
input A;
input B;
output Y;
assign Y = ~(A&B); // (A * B)'
endmodule
module nor2 (A, B, Y);
input A;
input B;
output Y;
assign Y = ~(A|B); // (A + B)'
endmodule
module xor2 (A, B, Y);
input A;
input B;
output Y;
assign Y = (A&~B)|(~A&B); // (A *B') + (A' * B)
endmodule
module imux2 (A, B, S, Y);
input A;
input B;
input S;
output Y;
assign Y = ~(&(A&S)|(B&~S)&); // ( (A * S) + (B * S') )'
endmodule
module dff (D, CLK, RESET, PRESET, Q, QN);
reg IQ, IQN;
input D;
input CLK;
input RESET;
input PRESET;
output Q;
assign Q = IQ; // IQ
output QN;
assign QN = IQN; // IQN
always @(posedge CLK, posedge RESET, posedge PRESET) begin
if ((RESET) && (PRESET)) begin
IQ <= 0;
IQN <= 0;
end
else if (RESET) begin
IQ <= 0;
IQN <= 1;
end
else if (PRESET) begin
IQ <= 1;
IQN <= 0;
end
else begin
// D
IQ <= D;
IQN <= ~(D);
end
end
endmodule
module latch (D, G, Q, QN);
reg IQ, IQN;
input D;
input G;
output Q;
assign Q = IQ; // IQ
output QN;
assign QN = IQN; // IQN
always @* begin
if (G) begin
IQ <= D;
IQN <= ~(D);
end
end
endmodule
module aoi211 (A, B, C, Y);
input A;
input B;
input C;
output Y;
assign Y = ~((A&B)|C); // ((A * B) + C)'
endmodule
module oai211 (A, B, C, Y);
input A;
input B;
input C;
output Y;
assign Y = ~((A|B)&C); // ((A + B) * C)'
endmodule
module halfadder (A, B, C, Y);
input A;
input B;
output C;
assign C = (A&B); // (A * B)
output Y;
assign Y = (A&~B)|(~A&B); // (A *B') + (A' * B)
endmodule
module fulladder (A, B, CI, CO, Y);
input A;
input B;
input CI;
output CO;
assign CO = (((A&B)|(B&CI))|(CI&A)); // (((A * B)+(B * CI))+(CI * A))
output Y;
assign Y = ((A^B)^CI); // ((A^B)^CI)
endmodule
Loading

0 comments on commit c35f5e3

Please sign in to comment.