mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-08 15:25:08 +00:00
libparse: fix up tests since liberty expression parsing now normalizes the form of these expressions
This commit is contained in:
parent
bf29f6dc11
commit
b0a3d6a3e7
8 changed files with 176 additions and 17 deletions
|
|
@ -2,5 +2,5 @@ module XNOR2X1 (B, A, Y);
|
||||||
input B;
|
input B;
|
||||||
input A;
|
input A;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = !(B&!A|!B&A); // "!(B&!A|!B&A)"
|
assign Y = (~((B&(~A))|((~B)&A))); // "!(B&!A|!B&A)"
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ library(dff) {
|
||||||
area : 1;
|
area : 1;
|
||||||
ff("IQ", "IQN") {
|
ff("IQ", "IQN") {
|
||||||
next_state : "(D)";
|
next_state : "(D)";
|
||||||
clocked_on : "CLK";
|
clocked_on : (CLK);
|
||||||
}
|
}
|
||||||
pin(D) {
|
pin(D) {
|
||||||
direction : input;
|
direction : input;
|
||||||
|
|
@ -15,7 +15,7 @@ library(dff) {
|
||||||
}
|
}
|
||||||
pin(Q) {
|
pin(Q) {
|
||||||
direction: output;
|
direction: output;
|
||||||
function : "IQ";
|
function : IQ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ library(dff) {
|
||||||
area : 1 ;
|
area : 1 ;
|
||||||
ff("IQ", "IQN") {
|
ff("IQ", "IQN") {
|
||||||
next_state : "(D)" ;
|
next_state : "(D)" ;
|
||||||
clocked_on : "CLK" ;
|
clocked_on : ( CLK ) ;
|
||||||
}
|
}
|
||||||
pin(D) {
|
pin(D) {
|
||||||
direction : input ;
|
direction : input ;
|
||||||
|
|
@ -13,7 +13,7 @@ library(dff) {
|
||||||
}
|
}
|
||||||
pin(Q) {
|
pin(Q) {
|
||||||
direction : output ;
|
direction : output ;
|
||||||
function : "IQ" ;
|
function : IQ ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ module dff (D, CLK, Q);
|
||||||
input D;
|
input D;
|
||||||
input CLK;
|
input CLK;
|
||||||
output Q;
|
output Q;
|
||||||
assign Q = IQ; // "IQ"
|
assign Q = IQ; // IQ
|
||||||
always @(posedge CLK) begin
|
always @(posedge CLK) begin
|
||||||
// "(D)"
|
// "(D)"
|
||||||
"IQ" <= (D);
|
"IQ" <= D;
|
||||||
"IQN" <= ~((D));
|
"IQN" <= ~(D);
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
module inv (A, Y);
|
module inv (A, Y);
|
||||||
input A;
|
input A;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~A; // "A'"
|
assign Y = (~A); // "A'"
|
||||||
endmodule
|
endmodule
|
||||||
module tri_inv (A, S, Z);
|
module tri_inv (A, S, Z);
|
||||||
input A;
|
input A;
|
||||||
input S;
|
input S;
|
||||||
output Z;
|
output Z;
|
||||||
assign Z = ~A; // "A'"
|
assign Z = (~A); // "A'"
|
||||||
endmodule
|
endmodule
|
||||||
module buffer (A, Y);
|
module buffer (A, Y);
|
||||||
input A;
|
input A;
|
||||||
|
|
@ -18,26 +18,26 @@ module nand2 (A, B, Y);
|
||||||
input A;
|
input A;
|
||||||
input B;
|
input B;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~(A&B); // "(A * B)'"
|
assign Y = (~(A&B)); // "(A * B)'"
|
||||||
endmodule
|
endmodule
|
||||||
module nor2 (A, B, Y);
|
module nor2 (A, B, Y);
|
||||||
input A;
|
input A;
|
||||||
input B;
|
input B;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~(A|B); // "(A + B)'"
|
assign Y = (~(A|B)); // "(A + B)'"
|
||||||
endmodule
|
endmodule
|
||||||
module xor2 (A, B, Y);
|
module xor2 (A, B, Y);
|
||||||
input A;
|
input A;
|
||||||
input B;
|
input B;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = (A&~B)|(~A&B); // "(A *B') + (A' * B)"
|
assign Y = ((A&(~B))|((~A)&B)); // "(A *B') + (A' * B)"
|
||||||
endmodule
|
endmodule
|
||||||
module imux2 (A, B, S, Y);
|
module imux2 (A, B, S, Y);
|
||||||
input A;
|
input A;
|
||||||
input B;
|
input B;
|
||||||
input S;
|
input S;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~(&(A&S)|(B&~S)&); // "( (A * S) + (B * S') )'"
|
assign Y = (~((A&S)|(B&(~S)))); // "( (A * S) + (B * S') )'"
|
||||||
endmodule
|
endmodule
|
||||||
module dff (D, CLK, RESET, PRESET, Q, QN);
|
module dff (D, CLK, RESET, PRESET, Q, QN);
|
||||||
reg "IQ", "IQN";
|
reg "IQ", "IQN";
|
||||||
|
|
@ -89,14 +89,14 @@ module aoi211 (A, B, C, Y);
|
||||||
input B;
|
input B;
|
||||||
input C;
|
input C;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~((A&B)|C); // "((A * B) + C)'"
|
assign Y = (~((A&B)|C)); // "((A * B) + C)'"
|
||||||
endmodule
|
endmodule
|
||||||
module oai211 (A, B, C, Y);
|
module oai211 (A, B, C, Y);
|
||||||
input A;
|
input A;
|
||||||
input B;
|
input B;
|
||||||
input C;
|
input C;
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = ~((A|B)&C); // "((A + B) * C)'"
|
assign Y = (~((A|B)&C)); // "((A + B) * C)'"
|
||||||
endmodule
|
endmodule
|
||||||
module halfadder (A, B, C, Y);
|
module halfadder (A, B, C, Y);
|
||||||
input A;
|
input A;
|
||||||
|
|
@ -104,7 +104,7 @@ module halfadder (A, B, C, Y);
|
||||||
output C;
|
output C;
|
||||||
assign C = (A&B); // "(A * B)"
|
assign C = (A&B); // "(A * B)"
|
||||||
output Y;
|
output Y;
|
||||||
assign Y = (A&~B)|(~A&B); // "(A *B') + (A' * B)"
|
assign Y = ((A&(~B))|((~A)&B)); // "(A *B') + (A' * B)"
|
||||||
endmodule
|
endmodule
|
||||||
module fulladder (A, B, CI, CO, Y);
|
module fulladder (A, B, CI, CO, Y);
|
||||||
input A;
|
input A;
|
||||||
|
|
|
||||||
60
tests/liberty/unquoted.lib
Normal file
60
tests/liberty/unquoted.lib
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
library(dff_unquoted) {
|
||||||
|
cell (dff1) {
|
||||||
|
area : 1;
|
||||||
|
ff("IQ", "IQN") {
|
||||||
|
next_state : !D;
|
||||||
|
clocked_on : (CLK);
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction: output;
|
||||||
|
function : IQ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cell (dff2) {
|
||||||
|
area : 1;
|
||||||
|
ff(IQ, IQN) {
|
||||||
|
next_state : D';
|
||||||
|
clocked_on : CLK;
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction: output;
|
||||||
|
function : "IQ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cell (dffe) {
|
||||||
|
area : 6;
|
||||||
|
ff("IQ", "IQN") {
|
||||||
|
next_state : (D&EN) | (IQ&!EN);
|
||||||
|
clocked_on : !CLK;
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(EN) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction: output;
|
||||||
|
function : "IQ";
|
||||||
|
}
|
||||||
|
pin(QN) {
|
||||||
|
direction: output;
|
||||||
|
function : "IQN";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
tests/liberty/unquoted.lib.filtered.ok
Normal file
60
tests/liberty/unquoted.lib.filtered.ok
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
library(dff_unquoted) {
|
||||||
|
cell(dff1) {
|
||||||
|
area : 1 ;
|
||||||
|
ff("IQ", "IQN") {
|
||||||
|
next_state : !D ;
|
||||||
|
clocked_on : ( CLK ) ;
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction : output ;
|
||||||
|
function : IQ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cell(dff2) {
|
||||||
|
area : 1 ;
|
||||||
|
ff(IQ, IQN) {
|
||||||
|
next_state : D ' ;
|
||||||
|
clocked_on : CLK ;
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction : output ;
|
||||||
|
function : "IQ" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cell(dffe) {
|
||||||
|
area : 6 ;
|
||||||
|
ff("IQ", "IQN") {
|
||||||
|
next_state : ( D & EN ) | ( IQ & ! EN ) ;
|
||||||
|
clocked_on : !CLK ;
|
||||||
|
}
|
||||||
|
pin(D) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(EN) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(CLK) {
|
||||||
|
direction : input ;
|
||||||
|
}
|
||||||
|
pin(Q) {
|
||||||
|
direction : output ;
|
||||||
|
function : "IQ" ;
|
||||||
|
}
|
||||||
|
pin(QN) {
|
||||||
|
direction : output ;
|
||||||
|
function : "IQN" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
tests/liberty/unquoted.lib.verilogsim.ok
Normal file
39
tests/liberty/unquoted.lib.verilogsim.ok
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
module dff1 (D, CLK, Q);
|
||||||
|
reg "IQ", "IQN";
|
||||||
|
input D;
|
||||||
|
input CLK;
|
||||||
|
output Q;
|
||||||
|
assign Q = IQ; // IQ
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
// !D
|
||||||
|
"IQ" <= (~D);
|
||||||
|
"IQN" <= ~((~D));
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
module dff2 (D, CLK, Q);
|
||||||
|
reg IQ, IQN;
|
||||||
|
input D;
|
||||||
|
input CLK;
|
||||||
|
output Q;
|
||||||
|
assign Q = IQ; // "IQ"
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
// D '
|
||||||
|
IQ <= (~D);
|
||||||
|
IQN <= ~((~D));
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
|
module dffe (D, EN, CLK, Q, QN);
|
||||||
|
reg "IQ", "IQN";
|
||||||
|
input D;
|
||||||
|
input EN;
|
||||||
|
input CLK;
|
||||||
|
output Q;
|
||||||
|
assign Q = IQ; // "IQ"
|
||||||
|
output QN;
|
||||||
|
assign QN = IQN; // "IQN"
|
||||||
|
always @(posedge (~CLK)) begin
|
||||||
|
// ( D & EN ) | ( IQ & ! EN )
|
||||||
|
"IQ" <= ((D&EN)|(IQ&(~EN)));
|
||||||
|
"IQN" <= ~(((D&EN)|(IQ&(~EN))));
|
||||||
|
end
|
||||||
|
endmodule
|
||||||
Loading…
Add table
Add a link
Reference in a new issue