mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
ppa updates
added widths to modules, automated frequency sweep synthesis, added slack violation color coding to plots
This commit is contained in:
parent
230aae000e
commit
fcaf032a0d
@ -214,7 +214,39 @@ module ppa_alu #(parameter WIDTH=32) (
|
|||||||
else assign Result = FullResult;
|
else assign Result = FullResult;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_shiftleft #(parameter WIDTH=32) (
|
module ppa_shiftleft_8 #(parameter WIDTH=8) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
input logic [$clog2(WIDTH)-1:0] amt,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
|
||||||
|
assign y = a << amt;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_shiftleft_16 #(parameter WIDTH=16) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
input logic [$clog2(WIDTH)-1:0] amt,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
|
||||||
|
assign y = a << amt;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_shiftleft_32 #(parameter WIDTH=32) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
input logic [$clog2(WIDTH)-1:0] amt,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
|
||||||
|
assign y = a << amt;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_shiftleft_64 #(parameter WIDTH=64) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
input logic [$clog2(WIDTH)-1:0] amt,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
|
||||||
|
assign y = a << amt;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_shiftleft_128 #(parameter WIDTH=128) (
|
||||||
input logic [WIDTH-1:0] a,
|
input logic [WIDTH-1:0] a,
|
||||||
input logic [$clog2(WIDTH)-1:0] amt,
|
input logic [$clog2(WIDTH)-1:0] amt,
|
||||||
output logic [WIDTH-1:0] y);
|
output logic [WIDTH-1:0] y);
|
||||||
@ -329,30 +361,132 @@ module ppa_prioritythermometer #(parameter N = 8) (
|
|||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_priorityonehot #(parameter N = 8) (
|
module ppa_priorityonehot #(parameter WIDTH = 8) (
|
||||||
input logic [N-1:0] a,
|
input logic [WIDTH-1:0] a,
|
||||||
output logic [N-1:0] y);
|
output logic [WIDTH-1:0] y);
|
||||||
logic [N-1:0] nolower;
|
logic [WIDTH-1:0] nolower;
|
||||||
|
|
||||||
// create thermometer code mask
|
// create thermometer code mask
|
||||||
ppa_prioritythermometer #(N) maskgen(.a({a[N-2:0], 1'b0}), .y(nolower));
|
ppa_prioritythermometer #(WIDTH) maskgen(.a({a[WIDTH-2:0], 1'b0}), .y(nolower));
|
||||||
assign y = a & nolower;
|
assign y = a & nolower;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_priorityencoder #(parameter N = 8) (
|
module ppa_priorityonehot_8 #(parameter WIDTH = 8) (
|
||||||
input logic [N-1:0] a,
|
input logic [WIDTH-1:0] a,
|
||||||
output logic [$clog2(N)-1:0] y);
|
output logic [WIDTH-1:0] y);
|
||||||
// Carefully crafted so design compiler will synthesize into a fast tree structure
|
logic [WIDTH-1:0] nolower;
|
||||||
// Rather than linear.
|
|
||||||
|
|
||||||
// create thermometer code mask
|
// create thermometer code mask
|
||||||
|
ppa_priorityonehot #(WIDTH) poh (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityonehot_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
logic [WIDTH-1:0] nolower;
|
||||||
|
|
||||||
|
// create thermometer code mask
|
||||||
|
ppa_priorityonehot #(WIDTH) poh (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityonehot_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
logic [WIDTH-1:0] nolower;
|
||||||
|
|
||||||
|
// create thermometer code mask
|
||||||
|
ppa_priorityonehot #(WIDTH) poh (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityonehot_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
logic [WIDTH-1:0] nolower;
|
||||||
|
|
||||||
|
// create thermometer code mask
|
||||||
|
ppa_priorityonehot #(WIDTH) poh (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityonehot_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
logic [WIDTH-1:0] nolower;
|
||||||
|
|
||||||
|
// create thermometer code mask
|
||||||
|
ppa_priorityonehot #(WIDTH) poh (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder_8 #(parameter WIDTH = 8) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
ppa_priorityencoder #(WIDTH) pe (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
ppa_priorityencoder #(WIDTH) pe (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
ppa_priorityencoder #(WIDTH) pe (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
ppa_priorityencoder #(WIDTH) pe (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
ppa_priorityencoder #(WIDTH) pe (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_priorityencoder #(parameter WIDTH = 8) (
|
||||||
|
input logic [WIDTH-1:0] a,
|
||||||
|
output logic [$clog2(WIDTH)-1:0] y);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
always_comb
|
always_comb
|
||||||
for (i=0; i<N; i++) begin:pri
|
for (i=0; i<WIDTH; i++) begin:pri
|
||||||
if (a[i]) y= i;
|
if (a[i]) y= i;
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
module ppa_decoder_8 #(parameter WIDTH = 8) (
|
||||||
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
ppa_decoder #(WIDTH) dec (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_decoder_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
ppa_decoder #(WIDTH) dec (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_decoder_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
ppa_decoder #(WIDTH) dec (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_decoder_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
ppa_decoder #(WIDTH) dec (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_decoder_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
|
output logic [WIDTH-1:0] y);
|
||||||
|
ppa_decoder #(WIDTH) dec (.*);
|
||||||
|
endmodule
|
||||||
|
|
||||||
module ppa_decoder #(parameter WIDTH = 8) (
|
module ppa_decoder #(parameter WIDTH = 8) (
|
||||||
input logic [$clog2(WIDTH)-1:0] a,
|
input logic [$clog2(WIDTH)-1:0] a,
|
||||||
output logic [WIDTH-1:0] y);
|
output logic [WIDTH-1:0] y);
|
||||||
@ -362,7 +496,7 @@ module ppa_decoder #(parameter WIDTH = 8) (
|
|||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_mux2_1 #(parameter WIDTH = 1) (
|
module ppa_mux2_8 #(parameter WIDTH = 8) (
|
||||||
input logic [WIDTH-1:0] d0, d1,
|
input logic [WIDTH-1:0] d0, d1,
|
||||||
input logic s,
|
input logic s,
|
||||||
output logic [WIDTH-1:0] y);
|
output logic [WIDTH-1:0] y);
|
||||||
@ -404,7 +538,7 @@ endmodule
|
|||||||
|
|
||||||
// *** some way to express data-critical inputs
|
// *** some way to express data-critical inputs
|
||||||
|
|
||||||
module ppa_flop #(parameter WIDTH = 8) (
|
module ppa_flop_8 #(parameter WIDTH = 8) (
|
||||||
input logic clk,
|
input logic clk,
|
||||||
input logic [WIDTH-1:0] d,
|
input logic [WIDTH-1:0] d,
|
||||||
output logic [WIDTH-1:0] q);
|
output logic [WIDTH-1:0] q);
|
||||||
@ -413,7 +547,43 @@ module ppa_flop #(parameter WIDTH = 8) (
|
|||||||
q <= #1 d;
|
q <= #1 d;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_flopr #(parameter WIDTH = 8) (
|
module ppa_flop_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic clk,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flop_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic clk,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flop_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic clk,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flop_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic clk,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopr_8 #(parameter WIDTH = 8) (
|
||||||
input logic clk, reset,
|
input logic clk, reset,
|
||||||
input logic [WIDTH-1:0] d,
|
input logic [WIDTH-1:0] d,
|
||||||
output logic [WIDTH-1:0] q);
|
output logic [WIDTH-1:0] q);
|
||||||
@ -423,7 +593,47 @@ module ppa_flopr #(parameter WIDTH = 8) (
|
|||||||
else q <= #1 d;
|
else q <= #1 d;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_floprasynnc #(parameter WIDTH = 8) (
|
module ppa_flopr_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopr_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopr_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopr_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_floprasync_8 #(parameter WIDTH = 8) (
|
||||||
input logic clk, reset,
|
input logic clk, reset,
|
||||||
input logic [WIDTH-1:0] d,
|
input logic [WIDTH-1:0] d,
|
||||||
output logic [WIDTH-1:0] q);
|
output logic [WIDTH-1:0] q);
|
||||||
@ -433,7 +643,47 @@ module ppa_floprasynnc #(parameter WIDTH = 8) (
|
|||||||
else q <= #1 d;
|
else q <= #1 d;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module ppa_flopenr #(parameter WIDTH = 8) (
|
module ppa_floprasync_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk or posedge reset)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_floprasync_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk or posedge reset)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_floprasync_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk or posedge reset)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_floprasync_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic clk, reset,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk or posedge reset)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopenr_8 #(parameter WIDTH = 8) (
|
||||||
input logic clk, reset, en,
|
input logic clk, reset, en,
|
||||||
input logic [WIDTH-1:0] d,
|
input logic [WIDTH-1:0] d,
|
||||||
output logic [WIDTH-1:0] q);
|
output logic [WIDTH-1:0] q);
|
||||||
@ -442,3 +692,52 @@ module ppa_flopenr #(parameter WIDTH = 8) (
|
|||||||
if (reset) q <= #1 0;
|
if (reset) q <= #1 0;
|
||||||
else if (en) q <= #1 d;
|
else if (en) q <= #1 d;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopenr_16 #(parameter WIDTH = 16) (
|
||||||
|
input logic clk, reset, en,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else if (en) q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopenr_32 #(parameter WIDTH = 32) (
|
||||||
|
input logic clk, reset, en,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else if (en) q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopenr_64 #(parameter WIDTH = 64) (
|
||||||
|
input logic clk, reset, en,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else if (en) q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module ppa_flopenr_128 #(parameter WIDTH = 128) (
|
||||||
|
input logic clk, reset, en,
|
||||||
|
input logic [WIDTH-1:0] d,
|
||||||
|
output logic [WIDTH-1:0] q);
|
||||||
|
|
||||||
|
always_ff @(posedge clk)
|
||||||
|
if (reset) q <= #1 0;
|
||||||
|
else if (en) q <= #1 d;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
module csa #(parameter WIDTH=8) (
|
||||||
|
input logic [WIDTH-1:0] a, b, c,
|
||||||
|
output logic [WIDTH-1:0] sum, carry);
|
||||||
|
|
||||||
|
assign sum = a ^ b ^ c;
|
||||||
|
assign carry = (a & (b | c)) | (b & c);
|
||||||
|
|
||||||
|
endmodule // csa
|
@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
|
||||||
|
|
||||||
from distutils.log import error
|
from distutils.log import error
|
||||||
from statistics import median
|
from statistics import median
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -10,16 +12,23 @@ import matplotlib.lines as lines
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
def getData():
|
def getData(mod=None, width=None):
|
||||||
bashCommand = "grep 'Critical Path Length' runs/ppa_*/reports/*qor*"
|
specStr = ''
|
||||||
|
if mod != None:
|
||||||
|
specStr = mod
|
||||||
|
if width != None:
|
||||||
|
specStr += ('_'+str(width))
|
||||||
|
specStr += '*'
|
||||||
|
|
||||||
|
bashCommand = "grep 'Critical Path Length' runs/ppa_{}/reports/*qor*".format(specStr)
|
||||||
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
||||||
linesCPL = outputCPL.decode("utf-8").split('\n')[:-1]
|
linesCPL = outputCPL.decode("utf-8").split('\n')[:-1]
|
||||||
|
|
||||||
bashCommand = "grep 'Design Area' runs/ppa_*/reports/*qor*"
|
bashCommand = "grep 'Design Area' runs/ppa_{}/reports/*qor*".format(specStr)
|
||||||
outputDA = subprocess.check_output(['bash','-c', bashCommand])
|
outputDA = subprocess.check_output(['bash','-c', bashCommand])
|
||||||
linesDA = outputDA.decode("utf-8").split('\n')[:-1]
|
linesDA = outputDA.decode("utf-8").split('\n')[:-1]
|
||||||
|
|
||||||
bashCommand = "grep '100' runs/ppa_*/reports/*power*"
|
bashCommand = "grep '100' runs/ppa_{}/reports/*power*".format(specStr)
|
||||||
outputP = subprocess.check_output(['bash','-c', bashCommand])
|
outputP = subprocess.check_output(['bash','-c', bashCommand])
|
||||||
linesP = outputP.decode("utf-8").split('\n')[:-1]
|
linesP = outputP.decode("utf-8").split('\n')[:-1]
|
||||||
|
|
||||||
@ -30,7 +39,6 @@ def getData():
|
|||||||
p = re.compile('\d+\.\d+[e-]*\d+')
|
p = re.compile('\d+\.\d+[e-]*\d+')
|
||||||
|
|
||||||
allSynths = []
|
allSynths = []
|
||||||
|
|
||||||
for i in range(len(linesCPL)):
|
for i in range(len(linesCPL)):
|
||||||
line = linesCPL[i]
|
line = linesCPL[i]
|
||||||
mwm = wm.findall(line)[0][4:-4].split('_')
|
mwm = wm.findall(line)[0][4:-4].split('_')
|
||||||
@ -42,15 +50,16 @@ def getData():
|
|||||||
|
|
||||||
power = p.findall(linesP[i])
|
power = p.findall(linesP[i])
|
||||||
lpower = float(power[2])
|
lpower = float(power[2])
|
||||||
denergy = float(power[1])/freq
|
denergy = float(power[1])*delay
|
||||||
|
|
||||||
oneSynth = [mod, width, freq, delay, area, lpower, denergy]
|
oneSynth = [mod, width, freq, delay, area, lpower, denergy]
|
||||||
allSynths += [oneSynth]
|
allSynths += [oneSynth]
|
||||||
|
|
||||||
return allSynths
|
return allSynths
|
||||||
|
|
||||||
def getVals(module, freq, var):
|
def getVals(module, var, freq=None):
|
||||||
global allSynths
|
allSynths = getData(mod=module)
|
||||||
|
|
||||||
if (var == 'delay'):
|
if (var == 'delay'):
|
||||||
ind = 3
|
ind = 3
|
||||||
units = " (ns)"
|
units = " (ns)"
|
||||||
@ -68,15 +77,25 @@ def getVals(module, freq, var):
|
|||||||
|
|
||||||
widths = []
|
widths = []
|
||||||
metric = []
|
metric = []
|
||||||
|
if (freq != None):
|
||||||
for oneSynth in allSynths:
|
for oneSynth in allSynths:
|
||||||
if (oneSynth[0] == module) & (oneSynth[2] == freq):
|
if (oneSynth[2] == freq):
|
||||||
widths += [oneSynth[1]]
|
widths += [oneSynth[1]]
|
||||||
m = oneSynth[ind]
|
metric += [oneSynth[ind]]
|
||||||
if (ind==6): m*=1000
|
else:
|
||||||
metric += [m]
|
widths = [8, 16, 32, 64, 128]
|
||||||
|
for w in widths:
|
||||||
|
m = 10000 # large number to start
|
||||||
|
for oneSynth in allSynths:
|
||||||
|
if (oneSynth[1] == w):
|
||||||
|
if (oneSynth[3] < m):
|
||||||
|
m = oneSynth[3]
|
||||||
|
met = oneSynth[ind]
|
||||||
|
metric += [met]
|
||||||
return widths, metric, units
|
return widths, metric, units
|
||||||
|
|
||||||
def writeCSV(allSynths):
|
def writeCSV():
|
||||||
|
allSynths = getData()
|
||||||
file = open("ppaData.csv", "w")
|
file = open("ppaData.csv", "w")
|
||||||
writer = csv.writer(file)
|
writer = csv.writer(file)
|
||||||
writer.writerow(['Module', 'Width', 'Target Freq', 'Delay', 'Area', 'L Power (nW)', 'D energy (mJ)'])
|
writer.writerow(['Module', 'Width', 'Target Freq', 'Delay', 'Area', 'L Power (nW)', 'D energy (mJ)'])
|
||||||
@ -112,7 +131,7 @@ def genLegend(fits, coefs, module, r2):
|
|||||||
lines.Line2D([0], [0], color='steelblue', ls='', marker='o', label=' R^2='+ str(round(r2, 4)))]
|
lines.Line2D([0], [0], color='steelblue', ls='', marker='o', label=' R^2='+ str(round(r2, 4)))]
|
||||||
return legend_elements
|
return legend_elements
|
||||||
|
|
||||||
def plotPPA(module, freq, var, ax=None, fits='clsgn'):
|
def oneMetricPlot(module, var, freq=None, ax=None, fits='clsgn'):
|
||||||
'''
|
'''
|
||||||
module: string module name
|
module: string module name
|
||||||
freq: int freq (MHz)
|
freq: int freq (MHz)
|
||||||
@ -120,7 +139,7 @@ def plotPPA(module, freq, var, ax=None, fits='clsgn'):
|
|||||||
fits: constant, linear, square, log2, Nlog2
|
fits: constant, linear, square, log2, Nlog2
|
||||||
plots chosen variable vs width for all matching syntheses with regression
|
plots chosen variable vs width for all matching syntheses with regression
|
||||||
'''
|
'''
|
||||||
widths, metric, units = getVals(module, freq, var)
|
widths, metric, units = getVals(module, var, freq=freq)
|
||||||
coefs, r2, funcArr = regress(widths, metric, fits)
|
coefs, r2, funcArr = regress(widths, metric, fits)
|
||||||
|
|
||||||
xp = np.linspace(8, 140, 200)
|
xp = np.linspace(8, 140, 200)
|
||||||
@ -149,15 +168,6 @@ def plotPPA(module, freq, var, ax=None, fits='clsgn'):
|
|||||||
ax.set_title(module + " (target " + str(freq) + "MHz)")
|
ax.set_title(module + " (target " + str(freq) + "MHz)")
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
def makePlots(mod, freq):
|
|
||||||
fig, axs = plt.subplots(2, 2)
|
|
||||||
plotPPA(mod, freq, 'delay', ax=axs[0,0], fits='cg')
|
|
||||||
plotPPA(mod, freq, 'area', ax=axs[0,1], fits='s')
|
|
||||||
plotPPA(mod, freq, 'lpower', ax=axs[1,0], fits='c')
|
|
||||||
plotPPA(mod, freq, 'denergy', ax=axs[1,1], fits='s')
|
|
||||||
plt.suptitle(mod + " (target " + str(freq) + "MHz)")
|
|
||||||
plt.show()
|
|
||||||
|
|
||||||
def regress(widths, var, fits='clsgn'):
|
def regress(widths, var, fits='clsgn'):
|
||||||
|
|
||||||
funcArr = genFuncs(fits)
|
funcArr = genFuncs(fits)
|
||||||
@ -210,39 +220,58 @@ def genFuncs(fits='clsgn'):
|
|||||||
return funcArr
|
return funcArr
|
||||||
|
|
||||||
def noOutliers(freqs, delays, areas):
|
def noOutliers(freqs, delays, areas):
|
||||||
med = statistics.median(freqs)
|
|
||||||
f=[]
|
f=[]
|
||||||
d=[]
|
d=[]
|
||||||
a=[]
|
a=[]
|
||||||
|
try:
|
||||||
|
med = statistics.median(freqs)
|
||||||
for i in range(len(freqs)):
|
for i in range(len(freqs)):
|
||||||
norm = freqs[i]/med
|
norm = freqs[i]/med
|
||||||
if (norm > 0.25) & (norm<1.75):
|
if (norm > 0.25) & (norm<1.75):
|
||||||
f += [freqs[i]]
|
f += [freqs[i]]
|
||||||
d += [delays[i]]
|
d += [delays[i]]
|
||||||
a += [areas[i]]
|
a += [areas[i]]
|
||||||
|
except: pass
|
||||||
|
|
||||||
return f, d, a
|
return f, d, a
|
||||||
|
|
||||||
def freqPlot(mod, width):
|
def freqPlot(mod, width):
|
||||||
freqs = []
|
allSynths = getData(mod=mod, width=width)
|
||||||
delays = []
|
|
||||||
areas = []
|
freqsV, delaysV, areasV, freqsA, delaysA, areasA = ([] for i in range(6))
|
||||||
for oneSynth in allSynths:
|
for oneSynth in allSynths:
|
||||||
if (mod == oneSynth[0]) & (width == oneSynth[1]):
|
if (mod == oneSynth[0]) & (width == oneSynth[1]):
|
||||||
freqs += [oneSynth[2]]
|
if (1000/oneSynth[3] < oneSynth[2]):
|
||||||
delays += [oneSynth[3]]
|
freqsV += [oneSynth[2]]
|
||||||
areas += [oneSynth[4]]
|
delaysV += [oneSynth[3]]
|
||||||
|
areasV += [oneSynth[4]]
|
||||||
|
else:
|
||||||
|
freqsA += [oneSynth[2]]
|
||||||
|
delaysA += [oneSynth[3]]
|
||||||
|
areasA += [oneSynth[4]]
|
||||||
|
|
||||||
freqs, delays, areas = noOutliers(freqs, delays, areas)
|
freqsV, delaysV, areasV = noOutliers(freqsV, delaysV, areasV)
|
||||||
|
freqsA, delaysA, areasA = noOutliers(freqsA, delaysA, areasA)
|
||||||
|
|
||||||
adprod = np.multiply(areas, delays)
|
adprodA = np.multiply(areasA, delaysA)
|
||||||
adsq = np.multiply(adprod, delays)
|
adsqA = np.multiply(adprodA, delaysA)
|
||||||
|
adprodV = np.multiply(areasV, delaysV)
|
||||||
|
adsqV = np.multiply(adprodV, delaysV)
|
||||||
|
|
||||||
|
legend_elements = [lines.Line2D([0], [0], color='green', ls='', marker='o', label='timing achieved'),
|
||||||
|
lines.Line2D([0], [0], color='blue', ls='', marker='o', label='slack violated')]
|
||||||
|
|
||||||
f, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, sharex=True)
|
f, (ax1, ax2, ax3, ax4) = plt.subplots(4, 1, sharex=True)
|
||||||
ax1.scatter(freqs, delays)
|
ax1.scatter(freqsA, delaysA, color='green')
|
||||||
ax2.scatter(freqs, areas)
|
ax1.scatter(freqsV, delaysV, color='blue')
|
||||||
ax3.scatter(freqs, adprod)
|
ax2.scatter(freqsA, areasA, color='green')
|
||||||
ax4.scatter(freqs, adsq)
|
ax2.scatter(freqsV, areasV, color='blue')
|
||||||
ax4.set_xlabel("Freq (MHz)")
|
ax3.scatter(freqsA, adprodA, color='green')
|
||||||
|
ax3.scatter(freqsV, adprodV, color='blue')
|
||||||
|
ax4.scatter(freqsA, adsqA, color='green')
|
||||||
|
ax4.scatter(freqsV, adsqV, color='blue')
|
||||||
|
ax1.legend(handles=legend_elements)
|
||||||
|
ax4.set_xlabel("Target Freq (MHz)")
|
||||||
ax1.set_ylabel('Delay (ns)')
|
ax1.set_ylabel('Delay (ns)')
|
||||||
ax2.set_ylabel('Area (sq microns)')
|
ax2.set_ylabel('Area (sq microns)')
|
||||||
ax3.set_ylabel('Area * Delay')
|
ax3.set_ylabel('Area * Delay')
|
||||||
@ -250,12 +279,19 @@ def freqPlot(mod, width):
|
|||||||
ax1.set_title(mod + '_' + str(width))
|
ax1.set_title(mod + '_' + str(width))
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
allSynths = getData()
|
def plotPPA(mod, freq=None):
|
||||||
writeCSV(allSynths)
|
fig, axs = plt.subplots(2, 2)
|
||||||
|
oneMetricPlot(mod, 'delay', ax=axs[0,0], fits='clg', freq=freq)
|
||||||
|
oneMetricPlot(mod, 'area', ax=axs[0,1], fits='s', freq=freq)
|
||||||
|
oneMetricPlot(mod, 'lpower', ax=axs[1,0], fits='c', freq=freq)
|
||||||
|
oneMetricPlot(mod, 'denergy', ax=axs[1,1], fits='s', freq=freq)
|
||||||
|
titleStr = " (target " + str(freq)+ "MHz)" if freq != None else " min delay"
|
||||||
|
plt.suptitle(mod + titleStr)
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# writeCSV()
|
||||||
# makeCoefTable()
|
# makeCoefTable()
|
||||||
|
|
||||||
# freqPlot('add', 64)
|
freqPlot('decoder', 8)
|
||||||
|
|
||||||
makePlots('shifter', 5000)
|
plotPPA('decoder')
|
||||||
|
|
||||||
# plotPPA('mult', 5000, 'delay', fits='cls')
|
|
1050
synthDC/ppaData.csv
1050
synthDC/ppaData.csv
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
# Madeleine Masser-Frye mmasserfrye@hmc.edu 5/22
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import re
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
|
|
||||||
|
|
||||||
@ -14,27 +17,59 @@ def deleteRedundant(LoT):
|
|||||||
bashCommand = synthStr.format(*synth)
|
bashCommand = synthStr.format(*synth)
|
||||||
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
||||||
|
|
||||||
d = 0.26
|
def getData():
|
||||||
f = 1/d * 1000
|
bashCommand = "grep 'Critical Path Length' runs/ppa_*/reports/*qor*"
|
||||||
arr = [-40, -20, -8, -6, -4, -2, 0, 2, 4, 6, 8, 20, 40]
|
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
||||||
|
linesCPL = outputCPL.decode("utf-8").split('\n')[:-1]
|
||||||
|
|
||||||
widths = ['128']
|
cpl = re.compile('\d{1}\.\d{6}')
|
||||||
modules = ['comparator']
|
f = re.compile('_\d*_MHz')
|
||||||
freqs = [str(round(f+f*x/100)) for x in arr]
|
wm = re.compile('ppa_\w*_\d*_qor')
|
||||||
|
|
||||||
|
allSynths = []
|
||||||
|
|
||||||
|
for i in range(len(linesCPL)):
|
||||||
|
line = linesCPL[i]
|
||||||
|
mwm = wm.findall(line)[0][4:-4].split('_')
|
||||||
|
freq = int(f.findall(line)[0][1:-4])
|
||||||
|
delay = float(cpl.findall(line)[0])
|
||||||
|
mod = mwm[0]
|
||||||
|
width = int(mwm[1])
|
||||||
|
|
||||||
|
oneSynth = [mod, width, freq, delay]
|
||||||
|
allSynths += [oneSynth]
|
||||||
|
|
||||||
|
return allSynths
|
||||||
|
|
||||||
|
allSynths = getData()
|
||||||
|
arr = [-40, -20, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10, 14, 20, 40]
|
||||||
|
|
||||||
|
widths = [8]
|
||||||
|
modules = ['decoder']
|
||||||
tech = 'sky90'
|
tech = 'sky90'
|
||||||
|
|
||||||
|
|
||||||
LoT = []
|
LoT = []
|
||||||
for module in modules:
|
|
||||||
for width in widths:
|
## initial sweep to get estimate of min delay
|
||||||
for freq in freqs:
|
# freqs = ['17200']
|
||||||
LoT += [[module, width, tech, freq]]
|
# for module in modules:
|
||||||
|
# for width in widths:
|
||||||
|
# for freq in freqs:
|
||||||
|
# LoT += [[module, width, tech, freq]]
|
||||||
|
|
||||||
|
# thorough sweep based on estimate of min delay
|
||||||
|
for m in modules:
|
||||||
|
for w in widths:
|
||||||
|
delays = []
|
||||||
|
for oneSynth in allSynths:
|
||||||
|
if (oneSynth[0] == m) & (oneSynth[1] == w):
|
||||||
|
delays += [oneSynth[3]]
|
||||||
|
try: f = 1000/min(delays)
|
||||||
|
except: print(m)
|
||||||
|
for freq in [str(round(f+f*x/100)) for x in arr]:
|
||||||
|
LoT += [[m, w, tech, freq]]
|
||||||
|
|
||||||
deleteRedundant(LoT)
|
deleteRedundant(LoT)
|
||||||
|
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
pool.starmap(runCommand, LoT)
|
pool.starmap(runCommand, LoT)
|
||||||
pool.close()
|
pool.close()
|
||||||
|
|
||||||
bashCommand = "wait"
|
|
||||||
outputCPL = subprocess.check_output(['bash','-c', bashCommand])
|
|
Loading…
Reference in New Issue
Block a user