|
|
Go to the documentation of this file.
14 t +=
"always @(posedge clk) " +
name_ +
"_tmp <= " +
o1 +
";\n";
18 t +=
"always @(posedge clk) " +
name_ +
" <= " +
o1 +
";\n";
29 const std::map<
const VarBase*, std::set<std::string> >*
const previous_cut_strings)
const {
37 if (!previous_cut_strings || (previous_cut_strings && !previous_cut_strings->count(
cut_var_))) {
47 const std::map<
const VarBase*, std::set<std::string> >*
const previous_cut_strings)
const {
64 if (!previous_cut_strings || (previous_cut_strings && !previous_cut_strings->count(
this))) {
65 if (!cut_strings.count(
this))
67 cut_strings.at(
this).insert(
name +
" > " +
itos(lower_cut) +
" && " +
name +
" < " +
itos(upper_cut));
85 n1 = n1 +
"_delay" +
itos(l1);
87 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n";
100 n1 = n1 +
"_delay" +
itos(l1);
104 o1 =
"(" +
o1 +
"+1)>>>1";
106 o1 =
"( (" +
o1 +
">>>" +
itos(
lr_ - 1) +
")+1)>>>1";
111 t +=
"always @(posedge clk) " +
name_ +
" <= " +
o1;
112 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t <<
";\n";
121 t =
t +
"always @(posedge clk) " +
name_ +
" <= " +
name_ +
"_wire;\n";
122 fs <<
"// units " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
134 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t <<
";\n";
143 o1 +=
"_delay" +
itos(l1);
151 o2 +=
"_delay" +
itos(l2);
157 o1 =
o1 +
" + " + o2;
161 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
170 o1 +=
"_delay" +
itos(l1);
178 o2 +=
"_delay" +
itos(l2);
184 o1 =
o1 +
" - " + o2;
188 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
197 n1 = n1 +
"_delay" +
itos(l1);
202 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
211 n1 = n1 +
"_delay" +
itos(l1);
216 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
225 n1 = n1 +
"_delay" +
itos(l1);
228 t +=
"always @(posedge clk) " +
name_ +
" <= - " + n1;
229 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t <<
";\n";
238 n1 = n1 +
"_delay" +
itos(l1);
241 o1 =
"(" +
o1 +
"+1)>>>1";
248 t +=
"always @(posedge clk) " +
name_ +
" <= " +
o1;
249 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t <<
";\n";
258 n1 = n1 +
"_delay" +
itos(l1);
266 t +=
"assign " +
name_ +
" = " +
o1;
267 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t <<
";\n";
275 n1 = n1 +
"_delay" +
itos(l1);
279 n2 = n2 +
"_delay" +
itos(l2);
284 fs <<
"// " <<
nbits_ <<
" bits \t " <<
kstring() <<
"\t" <<
K_ <<
"\n" <<
t;
293 n1 = n1 +
"_delay" +
itos(l1);
297 t =
t +
"assign " +
t1 +
" = ";
302 fs <<
t <<
"; // address for the LUT\n";
309 fs <<
"Memory #( \n";
310 fs <<
" .RAM_WIDTH(" <<
nbits_ <<
"), // Specify RAM data width \n";
311 fs <<
" .RAM_DEPTH(" <<
Nelements_ <<
"), // Specify RAM depth (number of entries) \n";
312 fs <<
" .RAM_PERFORMANCE(\"HIGH_PERFORMANCE\"), // \"HIGH_PERFORMANCE\" = 2 clks latency \n";
313 fs <<
" .INIT_FILE() \n";
314 fs <<
" ) " <<
t2 <<
" ( \n";
315 fs <<
" .addra(" <<
itos(
nbaddr_) <<
"\'b0), // Write address bus, width determined from RAM_DEPTH \n";
316 fs <<
" .addrb(" <<
t1 <<
" ), // Read address bus, width determined from RAM_DEPTH \n";
317 fs <<
" .dina(" <<
itos(
nbits_) <<
"\'b0), // RAM input data, width determined from RAM_WIDTH \n";
318 fs <<
" .clka(clk), // Write clock \n";
319 fs <<
" .clkb(clk), // Read clock \n";
320 fs <<
" .wea(1\'b0), // Write enable \n";
321 fs <<
" .enb(1\'b1), // Read Enable, for additional power savings, disable when not in use \n";
322 fs <<
" .rstb(reset), // Output reset (does not affect memory contents) \n";
323 fs <<
" .regceb(1\'b1), // Output register enable \n";
324 fs <<
" .doutb(" <<
name_ <<
") // RAM output data, \n";
334 n1 = n1 +
"_delay" +
itos(l1);
337 n2 = n2 +
"_delay" +
itos(l2);
340 n3 = n3 +
"_delay" +
itos(l3);
351 fs <<
name_ +
" = DSP_postadd(" + n1 +
", " + n2 +
", " + n3 +
")" + n4 +
";";
359 fs <<
"wire " <<
name_ <<
";" << std::endl;
360 fs <<
"assign " <<
name_ <<
" = (";
361 std::map<const VarBase*, std::set<std::string> > cut_strings0, cut_strings1;
363 if (
cut->op() !=
"cut")
369 if (
cut->op() !=
"cut")
372 if (
cut->cut_var()->p1())
373 cut->cut_var()->p1()->print_cuts(cut_strings1,
step_,
verilog, &cut_strings1);
374 if (
cut->cut_var()->p2())
375 cut->cut_var()->p2()->print_cuts(cut_strings1,
step_,
verilog, &cut_strings1);
376 if (
cut->cut_var()->p3())
377 cut->cut_var()->p3()->print_cuts(cut_strings1,
step_,
verilog, &cut_strings1);
382 for (
const auto&
cut_var : cut_strings0) {
384 for (
const auto& cut_string :
cut_var.second) {
390 for (
const auto&
cut_var : cut_strings1) {
392 for (
const auto& cut_string :
cut_var.second) {
423 if (l1 < 0 || l2 < 0 || l3 < 0 || (l1 > 0 && l2 > 0 && l3 > 0)) {
425 sprintf(slog,
"%s::print_step(%i): something wrong with latencies! %i %i %i\n",
name_.c_str(),
step, l1, l2, l3);
431 if (
p1_->
op() !=
"const")
437 if (
p2_->
op() !=
"const")
443 if (
p3_->
op() !=
"const")
451 fs <<
cut->cut_var()->pipe_delays(
step_);
461 fs <<
"//\n// STEP " <<
i <<
"\n\n";
473 std::vector<VarBase*>
vd;
476 for (
int i = 0;
i < imax; ++
i) {
478 int step =
v[
i]->step() +
v[
i]->latency();
486 fs <<
" input clk,\n";
487 fs <<
" input reset,\n\n";
490 for (
int i = 0;
i < imax; ++
i)
491 fs <<
" input [" << (
vd[
i])->nbits() - 1 <<
":0] " << (
vd[
i])->
name() <<
"_wire,\n";
495 for (
int i = 0;
i < imax; ++
i)
497 fs <<
" output [" << (
v[
i])->
nbits() - 1 <<
":0] " << (
v[
i])->
name() <<
"_wire,\n";
499 fs <<
" output " << (
v[
i])->
name() <<
"_wire,\n";
502 fs <<
" output [" << (
v[imax])->nbits() - 1 <<
":0] " << (
v[imax])->
name() <<
"_wire\n";
504 fs <<
" output " << (
v[imax])->
name() <<
"_wire\n";
510 for (
int i = 0;
i < imax; ++
i) {
512 fs <<
"// calculating " << (
v[
i])->
name() <<
"\n";
521 fs <<
"// wiring the outputs \n";
522 fs <<
"// latency = " << maxstep <<
"\n";
524 for (
int i = 0;
i < imax; ++
i) {
526 int delay = maxstep -
v[
i]->step() -
v[
i]->latency();
528 fs <<
"assign " <<
n <<
" = " << (
v[
i])->
name() <<
";\n";
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print_cuts(std::map< const VarBase *, std::set< std::string > > &cut_strings, const int step, Verilog, const std::map< const VarBase *, std::set< std::string > > *const previous_cut_strings=nullptr) const
void writeLUT(std::ofstream &fs) const
void print_step(int step, std::ofstream &fs, Verilog)
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void inputs(std::vector< VarBase * > *vd)
void print_all(std::ofstream &fs, Verilog)
std::string kstring() const
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
std::vector< DeviationSensor2D * > vd
static struct trklet::VarBase::Verilog verilog
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
static std::string itos(int i)
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
virtual void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0)
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
static void design_print(const std::vector< VarBase * > &v, std::ofstream &fs, Verilog)
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print_truncation(std::string &t, const std::string &o1, const int ps, Verilog) const
static std::string pipe_delay_wire(VarBase *v, std::string name_delayed, int nbits, int delay)
std::vector< VarBase * > cuts_
std::vector< unsigned short int > LUT
Log< level::Info, true > LogVerbatim
static std::string pipe_delay(VarBase *v, int nbits, int delay)
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override
void print(std::map< const VarBase *, std::set< std::string > > &cut_strings, const int step, Verilog, const std::map< const VarBase *, std::set< std::string > > *const previous_cut_strings=nullptr) const
void print(std::ofstream &fs, Verilog, int l1=0, int l2=0, int l3=0) override