mirror of https://github.com/YosysHQ/yosys.git
Revisions (#4)
* area should be 1 for all LUTs * clean up macros * add log_assert to fail noisily when encountering oddly configured DFF * clean help msg * flatten set to true by default * update * merge mult tests * remove redundant test * move all dsp tests to single file and remove redundant tests * update ram tests * add more dff tests * fix c++20 compile errors * add option to dump verilog * default to use abc9 * remove -abc9 option since its the default now --------- Co-authored-by: tony <minchunlin@gmail.com>
This commit is contained in:
parent
6fe0e00050
commit
d41688f7d7
|
@ -126,7 +126,7 @@ code sigA sigB sigD preAdderStatic moveBtoA
|
|||
// sigA should be the input to the multiplier without the preAdd. sigB and sigD should be
|
||||
//the preAdd inputs. If our "A" input into the multiplier is from the preAdd (not sigA), then
|
||||
// we basically swap it.
|
||||
sigA = port(dsp, \B);
|
||||
sigA = sigB;
|
||||
}
|
||||
|
||||
// port B of preAdderStatic must be mapped to port D of DSP for subtraction
|
||||
|
@ -368,7 +368,7 @@ match ff
|
|||
filter !ff->type.in($adff, $adffe) || allowAsync
|
||||
|
||||
// clock must be consistent
|
||||
filter clock == SigBit() || port(ff, \CLK) == clock
|
||||
filter clock == SigBit() || port(ff, \CLK)[0] == clock
|
||||
endmatch
|
||||
|
||||
code argQ
|
||||
|
@ -415,7 +415,7 @@ match ff
|
|||
filter GetSize(port(ff, \D)) >= offset + GetSize(argD)
|
||||
filter port(ff, \D).extract(offset, GetSize(argD)) == argD
|
||||
|
||||
filter clock == SigBit() || port(ff, \CLK) == clock
|
||||
filter clock == SigBit() || port(ff, \CLK)[0] == clock
|
||||
endmatch
|
||||
|
||||
code argQ
|
||||
|
|
|
@ -145,7 +145,7 @@ match ff
|
|||
filter GetSize(port(ff, \Q)) >= offset + GetSize(argQ)
|
||||
filter port(ff, \Q).extract(offset, GetSize(argQ)) == argQ
|
||||
|
||||
filter clock == SigBit() || port(ff, \CLK) == clock
|
||||
filter clock == SigBit() || port(ff, \CLK)[0] == clock
|
||||
endmatch
|
||||
|
||||
code argQ
|
||||
|
|
|
@ -51,7 +51,7 @@ module CFG1 (
|
|||
endspecify
|
||||
endmodule
|
||||
|
||||
(* abc9_lut=2 *)
|
||||
(* abc9_lut=1 *)
|
||||
module CFG2 (
|
||||
output Y,
|
||||
input A,
|
||||
|
@ -65,7 +65,7 @@ module CFG2 (
|
|||
endspecify
|
||||
endmodule
|
||||
|
||||
(* abc9_lut=3 *)
|
||||
(* abc9_lut=1 *)
|
||||
module CFG3 (
|
||||
output Y,
|
||||
input A,
|
||||
|
@ -81,7 +81,7 @@ module CFG3 (
|
|||
endspecify
|
||||
endmodule
|
||||
|
||||
(* abc9_lut=3 *)
|
||||
(* abc9_lut=1 *)
|
||||
module CFG4 (
|
||||
output Y,
|
||||
input A,
|
||||
|
@ -291,13 +291,6 @@ module ARI1 (
|
|||
endspecify
|
||||
endmodule
|
||||
|
||||
// module FCEND_BUFF
|
||||
// module FCINIT_BUFF
|
||||
// module FLASH_FREEZE
|
||||
// module OSCILLATOR
|
||||
// module SYSCTRL_RESET_STATUS
|
||||
// module LIVE_PROBE_FB
|
||||
|
||||
(* blackbox *)
|
||||
module GCLKBUF (
|
||||
(* iopad_external_pin *)
|
||||
|
@ -320,28 +313,6 @@ module GCLKBUF_DIFF (
|
|||
);
|
||||
endmodule
|
||||
|
||||
(* blackbox *)
|
||||
module GCLKBIBUF (
|
||||
input D,
|
||||
input E,
|
||||
input EN,
|
||||
(* iopad_external_pin *)
|
||||
inout PAD,
|
||||
(* clkbuf_driver *)
|
||||
output Y
|
||||
);
|
||||
endmodule
|
||||
|
||||
// module DFN1
|
||||
// module DFN1C0
|
||||
// module DFN1E1
|
||||
// module DFN1E1C0
|
||||
// module DFN1E1P0
|
||||
// module DFN1P0
|
||||
// module DLN1
|
||||
// module DLN1C0
|
||||
// module DLN1P0
|
||||
|
||||
module INV (
|
||||
input A,
|
||||
output Y
|
||||
|
@ -588,121 +559,6 @@ module TRIBUFF_DIFF (
|
|||
parameter IOSTD = "";
|
||||
endmodule
|
||||
|
||||
// module DDR_IN
|
||||
// module DDR_OUT
|
||||
// module RAM1K18
|
||||
// module RAM64x18
|
||||
// module MACC
|
||||
|
||||
(* blackbox *)
|
||||
module SYSRESET (
|
||||
(* iopad_external_pin *)
|
||||
input DEVRST_N,
|
||||
output POWER_ON_RESET_N);
|
||||
endmodule
|
||||
|
||||
|
||||
(* blackbox *)
|
||||
module XTLOSC (
|
||||
(* iopad_external_pin *)
|
||||
input XTL,
|
||||
output CLKOUT);
|
||||
parameter [1:0] MODE = 2'h3;
|
||||
parameter real FREQUENCY = 20.0;
|
||||
endmodule
|
||||
|
||||
(* blackbox *)
|
||||
module RAM1K18 (
|
||||
input [13:0] A_ADDR,
|
||||
input [2:0] A_BLK,
|
||||
(* clkbuf_sink *)
|
||||
input A_CLK,
|
||||
input [17:0] A_DIN,
|
||||
output [17:0] A_DOUT,
|
||||
input [1:0] A_WEN,
|
||||
input [2:0] A_WIDTH,
|
||||
input A_WMODE,
|
||||
input A_ARST_N,
|
||||
input A_DOUT_LAT,
|
||||
input A_DOUT_ARST_N,
|
||||
(* clkbuf_sink *)
|
||||
input A_DOUT_CLK,
|
||||
input A_DOUT_EN,
|
||||
input A_DOUT_SRST_N,
|
||||
|
||||
input [13:0] B_ADDR,
|
||||
input [2:0] B_BLK,
|
||||
(* clkbuf_sink *)
|
||||
input B_CLK,
|
||||
input [17:0] B_DIN,
|
||||
output [17:0] B_DOUT,
|
||||
input [1:0] B_WEN,
|
||||
input [2:0] B_WIDTH,
|
||||
input B_WMODE,
|
||||
input B_ARST_N,
|
||||
input B_DOUT_LAT,
|
||||
input B_DOUT_ARST_N,
|
||||
(* clkbuf_sink *)
|
||||
input B_DOUT_CLK,
|
||||
input B_DOUT_EN,
|
||||
input B_DOUT_SRST_N,
|
||||
input A_EN,
|
||||
input B_EN,
|
||||
input SII_LOCK,
|
||||
output BUSY);
|
||||
endmodule
|
||||
|
||||
(* blackbox *)
|
||||
module RAM64x18 (
|
||||
input [9:0] A_ADDR,
|
||||
input [1:0] A_BLK,
|
||||
input [2:0] A_WIDTH,
|
||||
output [17:0] A_DOUT,
|
||||
input A_DOUT_ARST_N,
|
||||
(* clkbuf_sink *)
|
||||
input A_DOUT_CLK,
|
||||
input A_DOUT_EN,
|
||||
input A_DOUT_LAT,
|
||||
input A_DOUT_SRST_N,
|
||||
(* clkbuf_sink *)
|
||||
input A_ADDR_CLK,
|
||||
input A_ADDR_EN,
|
||||
input A_ADDR_LAT,
|
||||
input A_ADDR_SRST_N,
|
||||
input A_ADDR_ARST_N,
|
||||
|
||||
input [9:0] B_ADDR,
|
||||
input [1:0] B_BLK,
|
||||
input [2:0] B_WIDTH,
|
||||
output [17:0] B_DOUT,
|
||||
input B_DOUT_ARST_N,
|
||||
(* clkbuf_sink *)
|
||||
input B_DOUT_CLK,
|
||||
input B_DOUT_EN,
|
||||
input B_DOUT_LAT,
|
||||
input B_DOUT_SRST_N,
|
||||
(* clkbuf_sink *)
|
||||
input B_ADDR_CLK,
|
||||
input B_ADDR_EN,
|
||||
input B_ADDR_LAT,
|
||||
input B_ADDR_SRST_N,
|
||||
input B_ADDR_ARST_N,
|
||||
|
||||
input [9:0] C_ADDR,
|
||||
(* clkbuf_sink *)
|
||||
input C_CLK,
|
||||
input [17:0] C_DIN,
|
||||
input C_WEN,
|
||||
input [1:0] C_BLK,
|
||||
input [2:0] C_WIDTH,
|
||||
|
||||
input A_EN,
|
||||
input B_EN,
|
||||
input C_EN,
|
||||
input SII_LOCK,
|
||||
output BUSY);
|
||||
endmodule
|
||||
|
||||
(* blackbox *)
|
||||
module MACC_PA (
|
||||
input DOTP,
|
||||
|
|
|
@ -218,6 +218,7 @@ struct MicrochipDffOptPass : public Pass {
|
|||
worthy_post_ce = true;
|
||||
} else if (sig_CE.data != State::S1) {
|
||||
// Strange. Should not happen in a reasonable flow, so bail.
|
||||
log_assert(false); // This DFF is always off
|
||||
continue;
|
||||
} else {
|
||||
lut_d_post_ce = lut_d;
|
||||
|
@ -241,6 +242,7 @@ struct MicrochipDffOptPass : public Pass {
|
|||
worthy_post_s = true;
|
||||
} else if (sig_S.data != (inv_s ? State::S1 : State::S0)) {
|
||||
// Strange. Should not happen in a reasonable flow, so bail.
|
||||
log_assert(false); // DFF is always in set mode
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -263,6 +265,7 @@ struct MicrochipDffOptPass : public Pass {
|
|||
worthy_post_r = true;
|
||||
} else if (sig_R.data != (inv_r ? State::S1 : State::S0)) {
|
||||
// Strange. Should not happen in a reasonable flow, so bail.
|
||||
log_assert(false); // DFF is always in reset mode
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,10 +33,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
log("\n");
|
||||
log(" synth_microchip [options]\n");
|
||||
log("\n");
|
||||
log("This command runs synthesis for Microchip FPGAs. Operating on\n");
|
||||
log("partly selected designs is not supported (you must submit a fully-selected \n");
|
||||
log("design). This command creates netlists that are compatible with Microchip \n");
|
||||
log("PolarFire devices.\n");
|
||||
log("This command runs synthesis for Microchip FPGAs. This command creates \n");
|
||||
log("netlists that are compatible with Microchip PolarFire devices. \n");
|
||||
log("\n");
|
||||
log(" -top <module>\n");
|
||||
log(" use the specified module as the top module\n");
|
||||
|
@ -55,6 +53,9 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
log(" Write the design to the specified BLIF file. Writing of an output file\n");
|
||||
log(" is omitted if this parameter is not specified.\n");
|
||||
log("\n");
|
||||
log(" -vlog <file>\n");
|
||||
log(" write the design to the specified Verilog file. writing of an output\n");
|
||||
log(" file is omitted if this parameter is not specified.\n");
|
||||
log(" -nobram\n");
|
||||
log(" Do not use block RAM cells in output netlist\n");
|
||||
log("\n");
|
||||
|
@ -76,11 +77,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
log(" 'from_label' is synonymous to 'begin', and empty 'to_label' is\n");
|
||||
log(" synonymous to the end of the command list.\n");
|
||||
log("\n");
|
||||
log(" -flatten\n");
|
||||
log(" Flatten design before synthesis.\n");
|
||||
log("\n");
|
||||
log(" -flatten_before_abc\n");
|
||||
log(" Flatten design before abc tech mapping.\n");
|
||||
log(" -noflatten\n");
|
||||
log(" do not flatten design before synthesis\n");
|
||||
log("\n");
|
||||
log(" -dff\n");
|
||||
log(" Run 'abc'/'abc9' with -dff option\n");
|
||||
|
@ -89,8 +87,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
log(" Run 'abc' with '-D 1' option to enable flip-flop retiming.\n");
|
||||
log(" implies -dff.\n");
|
||||
log("\n");
|
||||
log(" -abc9\n");
|
||||
log(" Use new ABC9 flow (EXPERIMENTAL)\n");
|
||||
log(" -abc\n");
|
||||
log(" Use classic ABC flow instead of ABC9\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log("The following commands are executed by this synthesis command:\n");
|
||||
|
@ -98,10 +96,9 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
log("\n");
|
||||
}
|
||||
|
||||
std::string top_opt, edif_file, blif_file, family;
|
||||
std::string top_opt, edif_file, blif_file, vlog_file, family;
|
||||
bool flatten, retime, noiopad, noclkbuf, nobram, nocarry, nowidelut, nodsp;
|
||||
bool abc9, dff;
|
||||
bool flatten_before_abc;
|
||||
int lut_size;
|
||||
|
||||
// debug dump switches
|
||||
|
@ -112,8 +109,9 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
top_opt = "-auto-top";
|
||||
edif_file.clear();
|
||||
blif_file.clear();
|
||||
vlog_file.clear();
|
||||
family = "polarfire";
|
||||
flatten = false;
|
||||
flatten = true;
|
||||
retime = false;
|
||||
noiopad = false;
|
||||
noclkbuf = false;
|
||||
|
@ -121,9 +119,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
nobram = false;
|
||||
nowidelut = false;
|
||||
nodsp = false;
|
||||
abc9 = false;
|
||||
abc9 = true;
|
||||
dff = false;
|
||||
flatten_before_abc = false;
|
||||
lut_size = 4;
|
||||
|
||||
debug_memory = false;
|
||||
|
@ -153,6 +150,10 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
blif_file = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-vlog" && argidx + 1 < args.size()) {
|
||||
vlog_file = args[++argidx];
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-run" && argidx + 1 < args.size()) {
|
||||
size_t pos = args[argidx + 1].find(':');
|
||||
if (pos == std::string::npos)
|
||||
|
@ -161,12 +162,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
run_to = args[argidx].substr(pos + 1);
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-flatten") {
|
||||
flatten = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-flatten_before_abc") {
|
||||
flatten_before_abc = true;
|
||||
if (args[argidx] == "-noflatten") {
|
||||
flatten = false;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-retime") {
|
||||
|
@ -201,8 +198,8 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
nobram = true;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-abc9") {
|
||||
abc9 = true;
|
||||
if (args[argidx] == "-abc") {
|
||||
abc9 = false;
|
||||
continue;
|
||||
}
|
||||
if (args[argidx] == "-nodsp") {
|
||||
|
@ -479,8 +476,6 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
|
||||
if (check_label("map_luts")) {
|
||||
run("opt_expr -mux_undef -noclkinv");
|
||||
if (flatten_before_abc)
|
||||
run("flatten");
|
||||
if (help_mode)
|
||||
run("abc -luts 2:2,3,6:5[,10,20] [-dff] [-D 1]", "(option for '-nowidelut', '-dff', '-retime')");
|
||||
else if (abc9) {
|
||||
|
@ -535,6 +530,12 @@ struct SynthMicrochipPass : public ScriptPass {
|
|||
if (!blif_file.empty() || help_mode)
|
||||
run(stringf("write_blif %s", blif_file.c_str()));
|
||||
}
|
||||
|
||||
if (check_label("vlog"))
|
||||
{
|
||||
if (!vlog_file.empty() || help_mode)
|
||||
run(stringf("write_verilog %s", help_mode ? "<file-name>" : vlog_file.c_str()));
|
||||
}
|
||||
}
|
||||
} SynthMicrochipPass;
|
||||
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module Registers(
|
||||
input clk,
|
||||
input en,
|
||||
input rst,
|
||||
input D,
|
||||
output reg Q
|
||||
);
|
||||
parameter LOAD_DATA = 1;
|
||||
|
||||
// active low async reset
|
||||
always @(posedge clk, negedge rst) begin
|
||||
if (rst == 0) begin
|
||||
Q <= LOAD_DATA;
|
||||
end else if(en) begin
|
||||
Q <= D;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,24 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# read verilog files
|
||||
read_verilog Registers.v
|
||||
|
||||
synth_microchip -top Registers -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-none t:SLE t:CLKBUF %% t:* %D
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module carryout (cout,out,a, b,c);
|
||||
parameter n = 6;
|
||||
parameter k = 2;
|
||||
output reg [k*(n+1)-1:0] out;
|
||||
output reg cout;
|
||||
input [n:0] a;
|
||||
input [n:0] b;
|
||||
input [n-1:0] c;
|
||||
|
||||
always @(a,b,c)
|
||||
begin
|
||||
{cout,out} = a * b + c;
|
||||
|
||||
end
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog carryout.v
|
||||
|
||||
synth_microchip -top carryout -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module cascade(
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
output signed [11:0] out_P,
|
||||
|
||||
input signed [4:0] casA,
|
||||
input signed [4:0] casB
|
||||
|
||||
);
|
||||
|
||||
wire signed [9:0] cascade;
|
||||
// first dsp
|
||||
assign cascade = casA * casB;
|
||||
|
||||
// second dsp
|
||||
assign out_P = in_A * (in_B + in_D) + cascade;
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog cascade.v
|
||||
|
||||
synth_microchip -top cascade -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 2 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -0,0 +1,76 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
# active low async reset with enable
|
||||
read_verilog <<EOT
|
||||
module top(
|
||||
input clk,
|
||||
input en,
|
||||
input rst,
|
||||
input D,
|
||||
output reg Q
|
||||
);
|
||||
always @(posedge clk, negedge rst) begin
|
||||
if (rst == 0) begin
|
||||
Q <= 1;
|
||||
end else if(en) begin
|
||||
Q <= D;
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top top -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-none t:SLE t:CLKBUF %% t:* %D
|
||||
|
||||
design -reset
|
||||
read_verilog -D NO_INIT ../common/dffs.v
|
||||
synth_microchip -top dff -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-none t:SLE t:CLKBUF %% t:* %D
|
||||
|
||||
design -reset
|
||||
read_verilog -D NO_INIT ../common/dffs.v
|
||||
synth_microchip -top dffe -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-none t:SLE t:CLKBUF %% t:* %D
|
||||
|
||||
design -reset
|
||||
read_verilog -D NO_INIT ../common/adffs.v
|
||||
synth_microchip -top adff -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-count 1 t:CFG1
|
||||
select -assert-none t:SLE t:CLKBUF t:CFG1 %% t:* %D
|
||||
|
||||
design -reset
|
||||
read_verilog -D NO_INIT ../common/adffs.v
|
||||
synth_microchip -top adffn -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-none t:SLE t:CLKBUF %% t:* %D
|
||||
|
||||
design -reset
|
||||
read_verilog -D NO_INIT ../common/adffs.v
|
||||
synth_microchip -top dffs -family polarfire -noiopad
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CLKBUF
|
||||
select -assert-count 1 t:CFG1
|
||||
select -assert-none t:SLE t:CLKBUF t:CFG1 %% t:* %D
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
read_verilog dff_opt.v
|
||||
|
||||
synth_microchip -top dff_opt -abc9 -family polarfire -noiopad
|
||||
synth_microchip -top dff_opt -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:SLE
|
||||
select -assert-count 1 t:CFG4
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# pre-adder
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module pre_adder(
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
output [11:0] out_Y
|
||||
);
|
||||
assign out_Y = in_A * (in_B + in_D);
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top pre_adder -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# post-adder
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module post_adder(
|
||||
input signed[17:0] in_A,
|
||||
input signed [17:0] in_B,
|
||||
input signed [17:0] in_C,
|
||||
output signed [35:0] out_Y
|
||||
);
|
||||
assign out_Y = (in_B*in_A)+in_C;
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top post_adder -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# pre-adder + post-adder
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module pre_post_adder(
|
||||
input signed[5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [11:0] in_C,
|
||||
input signed [4:0] in_D,
|
||||
output signed [12:0] out_Y
|
||||
);
|
||||
assign out_Y = ((in_D + in_B)*in_A)+in_C;
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top pre_post_adder -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
|
||||
# multiply accumulate
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module mac(
|
||||
input clk,
|
||||
input signed [4:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
input srst_P,
|
||||
output reg signed [11:0] out_P
|
||||
);
|
||||
always@(posedge clk) begin
|
||||
if (~srst_P) begin
|
||||
out_P <= 12'h000;
|
||||
end else begin
|
||||
out_P <= in_A * (in_B + in_D) + out_P;
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top mac -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
|
||||
# cascade
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module cas(
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
input signed [4:0] casA,
|
||||
input signed [4:0] casB,
|
||||
output signed [11:0] out_P
|
||||
);
|
||||
wire signed [9:0] cascade;
|
||||
assign cascade = casA * casB;
|
||||
assign out_P = in_A * (in_B + in_D) + cascade;
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top cas -family polarfire -noiopad
|
||||
select -assert-count 2 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# carryout
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module carryout (cout,out,a, b,c);
|
||||
parameter n = 6;
|
||||
parameter k = 2;
|
||||
output reg [k*(n+1)-1:0] out;
|
||||
output reg cout;
|
||||
input [n:0] a;
|
||||
input [n:0] b;
|
||||
input [n-1:0] c;
|
||||
always @(*)
|
||||
begin
|
||||
{cout,out} = a * b + c;
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top carryout -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# pipeline registers
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module pipeline(
|
||||
input clk,
|
||||
input srst_A,
|
||||
input srst_B,
|
||||
input srst_D,
|
||||
input srst_P,
|
||||
input arst_D,
|
||||
input srst_C,
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_C,
|
||||
input signed [4:0] in_D,
|
||||
output reg [11:0] out_P
|
||||
);
|
||||
wire srst_A_N;
|
||||
wire srst_B_N;
|
||||
wire srst_C_N;
|
||||
wire srst_D_N;
|
||||
wire srst_P_N;
|
||||
assign srst_A_N = ~srst_A;
|
||||
assign srst_B_N = ~srst_B;
|
||||
assign srst_C_N = ~srst_C;
|
||||
assign srst_D_N = ~srst_D;
|
||||
assign srst_P_N = ~srst_P;
|
||||
|
||||
reg signed [5:0] reg_A;
|
||||
reg signed [4:0] reg_B;
|
||||
reg signed [4:0] reg_C;
|
||||
reg signed [4:0] reg_D;
|
||||
|
||||
always@(posedge clk) begin // sync reset A
|
||||
// if (~srst_A_N) begin
|
||||
if (srst_A_N) begin
|
||||
reg_A = 6'b000000;
|
||||
end else begin
|
||||
reg_A = in_A;
|
||||
end
|
||||
end
|
||||
|
||||
always@(posedge clk) begin // sync reset B
|
||||
if (srst_B_N) begin
|
||||
reg_B = 5'b00000;
|
||||
end else begin
|
||||
reg_B = in_B;
|
||||
end
|
||||
end
|
||||
|
||||
always@(posedge clk, negedge arst_D) begin // async reset D
|
||||
if (~arst_D) begin
|
||||
reg_D = 5'b00000;
|
||||
end else begin
|
||||
reg_D = in_D;
|
||||
end
|
||||
end
|
||||
|
||||
always@(posedge clk) begin // sync reset C
|
||||
if (srst_C_N) begin
|
||||
reg_C = 5'b00000;
|
||||
end else begin
|
||||
reg_C = in_C;
|
||||
end
|
||||
end
|
||||
|
||||
// sync reset P
|
||||
always@(posedge clk) begin
|
||||
if (srst_P_N) begin
|
||||
out_P = 12'h000;
|
||||
end else begin
|
||||
out_P = reg_A * (reg_B + reg_D) + reg_C;
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top pipeline -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
module full_dsp(
|
||||
input signed[5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [11:0] in_C,
|
||||
input signed [4:0] in_D,
|
||||
|
||||
output signed [12:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = ((in_D + in_B)*in_A)+in_C;
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog full_dsp.v
|
||||
|
||||
synth_microchip -top full_dsp -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module large_mult(
|
||||
input signed [20:0] in1,
|
||||
input signed [17:0] in2,
|
||||
output signed [38:0] out1
|
||||
);
|
||||
assign out1 = in1 * in2;
|
||||
endmodule
|
|
@ -1,23 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog large_mult.v
|
||||
|
||||
synth_microchip -top large_mult -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 2 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module mac(
|
||||
input clk,
|
||||
input signed [4:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
output reg signed [11:0] out_P,
|
||||
|
||||
input srst_P,
|
||||
|
||||
input signed [4:0] casA,
|
||||
input signed [4:0] casB
|
||||
|
||||
);
|
||||
|
||||
|
||||
// sync reset P
|
||||
always@(posedge clk) begin
|
||||
if (~srst_P) begin
|
||||
out_P <= 12'h000;
|
||||
end else begin
|
||||
out_P <= in_A * (in_B + in_D) + out_P;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
|
@ -1,24 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# read verilog files
|
||||
read_verilog mac.v
|
||||
|
||||
# run the synth flow, specifies top module and additional parameters
|
||||
synth_microchip -top mac -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -0,0 +1,51 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
# regular unsigned multiply
|
||||
read_verilog ../common/mul.v
|
||||
chparam -set X_WIDTH 8 -set Y_WIDTH 8 -set A_WIDTH 16
|
||||
hierarchy -top top
|
||||
proc
|
||||
synth_microchip -family polarfire -noiopad
|
||||
cd top # Constrain all select calls below inside the top module
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# regular signed multiply
|
||||
design -reset
|
||||
read_verilog <<EOT
|
||||
module signed_mult(
|
||||
input signed [17:0] in_A,
|
||||
input signed [17:0] in_B,
|
||||
output signed [35:0] out_Y
|
||||
);
|
||||
assign out_Y = in_A * in_B;
|
||||
endmodule
|
||||
EOT
|
||||
synth_microchip -top signed_mult -family polarfire -noiopad
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
||||
# wide multiply
|
||||
design -reset
|
||||
read_verilog ../common/mul.v
|
||||
chparam -set X_WIDTH 30 -set Y_WIDTH 16 -set A_WIDTH 46
|
||||
hierarchy -top top
|
||||
proc
|
||||
synth_microchip -family polarfire -noiopad
|
||||
cd top # Constrain all select calls below inside the top module
|
||||
select -assert-count 2 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module postAdd_mult(
|
||||
input signed[17:0] in_A,
|
||||
input signed [17:0] in_B,
|
||||
input signed [17:0] in_C,
|
||||
|
||||
output signed [35:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = (in_B*in_A)+in_C;
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog postAdd_mult.v
|
||||
|
||||
synth_microchip -top postAdd_mult -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module post_adder(
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
input signed [11:0] in_C,
|
||||
|
||||
output [12:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = (in_D + in_B) * in_A + in_C;
|
||||
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,23 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog post_adder.v
|
||||
|
||||
synth_microchip -top post_adder -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module pre_adder_dsp(
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
|
||||
output [11:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = in_A * (in_B + in_D);
|
||||
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog pre_adder_dsp.v
|
||||
|
||||
synth_microchip -top pre_adder_dsp -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -15,10 +15,16 @@
|
|||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog ram_SDP.v
|
||||
|
||||
synth_microchip -top ram_SDP -abc9 -family polarfire -noiopad
|
||||
|
||||
synth_microchip -top ram_SDP -family polarfire -noiopad
|
||||
select -assert-count 1 t:RAM1K20
|
||||
select -assert-count 1 t:CFG1
|
||||
select -assert-none t:RAM1K20 t:CFG1 %% t:* %D
|
||||
|
||||
# very similar to ram_SDP.v, except read enable is always active
|
||||
design -reset
|
||||
read_verilog ../common/blockram.v
|
||||
hierarchy -top sync_ram_sdp
|
||||
chparam -set DATA_WIDTH 32 -set ADDRESS_WIDTH 8
|
||||
synth_microchip -top sync_ram_sdp -family polarfire -noiopad
|
||||
select -assert-count 1 t:RAM1K20
|
||||
select -assert-none t:RAM1K20 %% t:* %D
|
|
@ -27,30 +27,26 @@ reg [addr_width - 1 : 0] addra_reg, addrb_reg;
|
|||
reg [data_width - 1 : 0] mem [(2**addr_width) - 1 : 0];
|
||||
|
||||
always @ (posedge clka)
|
||||
begin
|
||||
addra_reg <= addra;
|
||||
if(wea)
|
||||
mem[addra] <= dataina;
|
||||
begin
|
||||
addra_reg <= addra;
|
||||
|
||||
if(wea) begin
|
||||
mem[addra] <= dataina;
|
||||
qa <= dataina;
|
||||
end else begin
|
||||
qa <= mem[addra];
|
||||
end
|
||||
|
||||
always @ (posedge clkb)
|
||||
begin
|
||||
addrb_reg <= addrb;
|
||||
if(web)
|
||||
mem[addrb] <= datainb;
|
||||
end
|
||||
|
||||
always @ (posedge clka)
|
||||
begin
|
||||
if(~wea)
|
||||
qa <= mem[addra];
|
||||
else qa <= dataina;
|
||||
end
|
||||
|
||||
always @ (posedge clkb)
|
||||
begin
|
||||
if(~web)
|
||||
qb <= mem[addrb];
|
||||
else qb <= datainb;
|
||||
addrb_reg <= addrb;
|
||||
if(web) begin
|
||||
mem[addrb] <= datainb;
|
||||
qb <= datainb;
|
||||
end else begin
|
||||
qb <= mem[addrb];
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
|
@ -15,8 +15,16 @@
|
|||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog ram_TDP.v
|
||||
|
||||
synth_microchip -top ram_TDP -abc9 -family polarfire -noiopad -debug_memory
|
||||
|
||||
synth_microchip -top ram_TDP -family polarfire -noiopad
|
||||
select -assert-count 1 t:RAM1K20
|
||||
select -assert-none t:RAM1K20 %% t:* %D
|
||||
|
||||
# similar to ram_TDP.v, but different write mode and read_enable=~write_enable
|
||||
design -reset
|
||||
read_verilog ../common/blockram.v
|
||||
hierarchy -top sync_ram_tdp
|
||||
chparam -set DATA_WIDTH 2 -set ADDRESS_WIDTH 10
|
||||
synth_microchip -top sync_ram_tdp -family polarfire -noiopad
|
||||
select -assert-count 1 t:RAM1K20
|
||||
select -assert-count 2 t:CFG1
|
||||
select -assert-none t:RAM1K20 t:CFG1 %% t:* %D
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
read_verilog reduce.v
|
||||
|
||||
synth_microchip -top reduce -abc9 -family polarfire -noiopad
|
||||
synth_microchip -top reduce -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:XOR8
|
||||
select -assert-none t:XOR8 %% t:* %D
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module reg_c(
|
||||
input clk,
|
||||
|
||||
// active high
|
||||
input en_A,
|
||||
input en_B,
|
||||
input en_D,
|
||||
input en_P,
|
||||
|
||||
// active low
|
||||
input srst_A,
|
||||
input srst_B,
|
||||
input srst_D,
|
||||
input srst_P,
|
||||
|
||||
// active low
|
||||
input arst_D,
|
||||
|
||||
input srst_C,
|
||||
input arst_C,
|
||||
|
||||
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_C,
|
||||
input signed [4:0] in_D,
|
||||
|
||||
|
||||
output reg [11:0] out_P
|
||||
|
||||
);
|
||||
|
||||
|
||||
// MACC_PA takes active low resets
|
||||
wire srst_A_N;
|
||||
wire srst_B_N;
|
||||
wire srst_C_N;
|
||||
wire srst_D_N;
|
||||
wire srst_P_N;
|
||||
assign srst_A_N = ~srst_A;
|
||||
assign srst_B_N = ~srst_B;
|
||||
assign srst_C_N = ~srst_C;
|
||||
assign srst_D_N = ~srst_D;
|
||||
assign srst_P_N = ~srst_P;
|
||||
|
||||
// input reg
|
||||
reg signed [5:0] reg_A;
|
||||
reg signed [4:0] reg_B;
|
||||
reg signed [4:0] reg_C;
|
||||
reg signed [4:0] reg_D;
|
||||
|
||||
// sync reset A
|
||||
always@(posedge clk) begin
|
||||
// if (~srst_A_N) begin
|
||||
if (srst_A_N) begin
|
||||
reg_A = 6'b000000;
|
||||
end else begin
|
||||
reg_A = in_A;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
// sync reset B
|
||||
always@(posedge clk) begin
|
||||
if (srst_B_N) begin
|
||||
reg_B = 5'b00000;
|
||||
end else begin
|
||||
reg_B = in_B;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
// async reset D
|
||||
always@(posedge clk, negedge arst_D) begin
|
||||
if (~arst_D) begin
|
||||
reg_D = 5'b00000;
|
||||
end else begin
|
||||
reg_D = in_D;
|
||||
end
|
||||
end
|
||||
|
||||
// sync reset C
|
||||
always@(posedge clk) begin
|
||||
if (srst_C_N) begin
|
||||
reg_C = 5'b00000;
|
||||
end else begin
|
||||
reg_C = in_C;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
// sync reset P
|
||||
always@(posedge clk) begin
|
||||
if (srst_P_N) begin
|
||||
out_P = 12'h000;
|
||||
end else begin
|
||||
out_P = reg_A * (reg_B + reg_D) + reg_C;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog reg_c.v
|
||||
|
||||
synth_microchip -top reg_c -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module reg_test(
|
||||
input clk,
|
||||
|
||||
// active high
|
||||
input en_A,
|
||||
input en_B,
|
||||
input en_D,
|
||||
input en_P,
|
||||
|
||||
// active low
|
||||
input srst_A,
|
||||
input srst_B,
|
||||
input srst_D,
|
||||
input srst_P,
|
||||
|
||||
// active low
|
||||
input arst_D,
|
||||
|
||||
input signed [5:0] in_A,
|
||||
input signed [4:0] in_B,
|
||||
input signed [4:0] in_D,
|
||||
|
||||
output reg [11:0] out_P
|
||||
|
||||
);
|
||||
|
||||
|
||||
// MACC_PA takes active low resets
|
||||
wire srst_A_N;
|
||||
wire srst_B_N;
|
||||
wire srst_D_N;
|
||||
wire srst_P_N;
|
||||
assign srst_A_N = ~srst_A;
|
||||
assign srst_B_N = ~srst_B;
|
||||
assign srst_D_N = ~srst_D;
|
||||
assign srst_P_N = ~srst_P;
|
||||
|
||||
// input reg
|
||||
reg signed [5:0] reg_A;
|
||||
reg signed [4:0] reg_B;
|
||||
reg signed [4:0] reg_D;
|
||||
|
||||
// sync reset A
|
||||
always@(posedge clk) begin
|
||||
if (srst_A_N) begin
|
||||
reg_A = 6'b000000;
|
||||
end else begin
|
||||
reg_A = in_A;
|
||||
end
|
||||
end
|
||||
|
||||
// sync reset B
|
||||
always@(posedge clk) begin
|
||||
if (srst_B_N) begin
|
||||
reg_B = 5'b00000;
|
||||
end else begin
|
||||
reg_B = in_B;
|
||||
end
|
||||
end
|
||||
|
||||
// async reset D
|
||||
always@(posedge clk, negedge arst_D) begin
|
||||
if (~arst_D) begin
|
||||
reg_D = 5'b00000;
|
||||
end else begin
|
||||
reg_D = in_D;
|
||||
end
|
||||
end
|
||||
|
||||
// sync reset P
|
||||
always@(posedge clk) begin
|
||||
if (srst_P_N) begin
|
||||
out_P = 12'h000;
|
||||
end else begin
|
||||
out_P = reg_A * (reg_B + reg_D);
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog reg_test.v
|
||||
|
||||
synth_microchip -top reg_test -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module signed_mult(
|
||||
input signed [17:0] in_A,
|
||||
input signed [17:0] in_B,
|
||||
|
||||
output signed [35:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = in_A * in_B;
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog signed_mult.v
|
||||
|
||||
synth_microchip -top signed_mult -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module simple_ram (clk,wr,addr,din,dout);
|
||||
input clk;
|
||||
input [19:0] din;
|
||||
input wr;
|
||||
input [9:0] addr;
|
||||
output [19:0] dout;
|
||||
|
||||
|
||||
reg [9:0] addr_reg;
|
||||
reg [19:0] mem [0:1023] ;
|
||||
assign dout = mem[addr_reg];
|
||||
|
||||
always@(posedge clk) begin
|
||||
addr_reg <= addr;
|
||||
if(wr)
|
||||
mem[addr]<= din;
|
||||
end
|
||||
endmodule
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog simple_ram.v
|
||||
|
||||
synth_microchip -top simple_ram -abc9 -family polarfire -noiopad
|
||||
|
||||
read_verilog ../common/blockram.v
|
||||
hierarchy -top sync_ram_sp
|
||||
chparam -set DATA_WIDTH 20 -set ADDRESS_WIDTH 10
|
||||
synth_microchip -top sync_ram_sp -family polarfire -noiopad
|
||||
select -assert-count 1 t:RAM1K20
|
||||
select -assert-none t:RAM1K20 %% t:* %D
|
||||
select -assert-none t:RAM1K20 %% t:* %D
|
|
@ -1,28 +0,0 @@
|
|||
/*
|
||||
ISC License
|
||||
|
||||
Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
module unsigned_mult(
|
||||
input [10:0] in_A,
|
||||
input signed [10:0] in_B,
|
||||
|
||||
output [21:0] out_Y
|
||||
);
|
||||
|
||||
assign out_Y = in_A * in_B;
|
||||
|
||||
endmodule
|
|
@ -1,22 +0,0 @@
|
|||
# ISC License
|
||||
#
|
||||
# Copyright (C) 2024 Microchip Technology Inc. and its subsidiaries
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
read_verilog unsigned_mult.v
|
||||
|
||||
synth_microchip -top unsigned_mult -abc9 -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MACC_PA
|
||||
select -assert-none t:MACC_PA %% t:* %D
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
read_verilog uram_ar.v
|
||||
|
||||
synth_microchip -top uram_ar -abc9 -family polarfire -noiopad
|
||||
synth_microchip -top uram_ar -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:RAM64x12
|
||||
select -assert-none t:RAM64x12 %% t:* %D
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
read_verilog uram_sr.v
|
||||
|
||||
synth_microchip -top uram_sr -abc9 -family polarfire -noiopad
|
||||
synth_microchip -top uram_sr -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:RAM64x12
|
||||
select -assert-none t:RAM64x12 %% t:* %D
|
||||
|
|
|
@ -16,7 +16,20 @@
|
|||
|
||||
read_verilog widemux.v
|
||||
|
||||
synth_microchip -top widemux -abc9 -family polarfire -noiopad
|
||||
synth_microchip -top widemux -family polarfire -noiopad
|
||||
|
||||
select -assert-count 1 t:MX4
|
||||
select -assert-none t:MX4 %% t:* %D
|
||||
select -assert-none t:MX4 %% t:* %D
|
||||
|
||||
|
||||
# RTL style is different here forming a different structure
|
||||
read_verilog ../common/mux.v
|
||||
design -save read
|
||||
|
||||
hierarchy -top mux4
|
||||
proc
|
||||
equiv_opt -assert -map +/microchip/cells_sim.v synth_microchip -top mux4 -family polarfire -noiopad
|
||||
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
||||
cd mux4 # Constrain all select calls below inside the top module
|
||||
select -assert-count 3 t:CFG3
|
||||
select -assert-none t:CFG3 %% t:* %D
|
Loading…
Reference in New Issue