Skip to content

Commit

Permalink
Mult variations (#1005)
Browse files Browse the repository at this point in the history
* Multiplier variations in commonlib for returning middle and high bits

* Fixes to multiply variations

* Multiply variations; remove unintended comments
  • Loading branch information
jeffsetter authored Apr 16, 2021
1 parent 5f7f356 commit 4765e74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/coreir/definitions/coreVerilog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ void CoreIRLoadVerilog_coreir(Context* c) {
{
"sext",
{
"{{(width_out-width_in){in[width_in-1]},},in}",
"{{(width_out-width_in){in[width_in-1]}},in}",
[]() {
// Can't use initializer list of vector of unique ptrs, so we
// explicitly construct it
Expand Down
12 changes: 6 additions & 6 deletions src/libs/commonlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,10 @@ Namespace* CoreIRLoadLibrary_commonlib(Context* c) {

def->addInstance("mult", "coreir.mul", {{"width", Const::make(c, 2*width)}});

Values sliceArgs = {{"width", Const::make(c, width)},
Values sliceArgs = {{"width", Const::make(c, 2*width)},
{"lo", Const::make(c, width/2)},
{"hi", Const::make(c, 3*width/2-1)}};
def->addInstance("slice", "coreir.sel", sliceArgs);
{"hi", Const::make(c, 3*width/2)}};
def->addInstance("slice", "coreir.slice", sliceArgs);

def->connect("self.in0", "sexta.in");
def->connect("self.in1", "sextb.in");
Expand All @@ -383,10 +383,10 @@ Namespace* CoreIRLoadLibrary_commonlib(Context* c) {

def->addInstance("mult", "coreir.mul", {{"width", Const::make(c, 2*width)}});

Values sliceArgs = {{"width", Const::make(c, width)},
Values sliceArgs = {{"width", Const::make(c, 2*width)},
{"lo", Const::make(c, width)},
{"hi", Const::make(c, 2*width-1)}};
def->addInstance("slice", "coreir.sel", sliceArgs);
{"hi", Const::make(c, 2*width)}};
def->addInstance("slice", "coreir.slice", sliceArgs);

def->connect("self.in0", "sexta.in");
def->connect("self.in1", "sextb.in");
Expand Down

0 comments on commit 4765e74

Please sign in to comment.