Internals: Add opLogIf(f). No functional change. Merge from Jeremy Bennet.
This commit is contained in:
parent
52024f4d80
commit
1b511dd130
|
|
@ -3076,7 +3076,7 @@ struct AstLogIf : public AstNodeBiop {
|
|||
AstLogIf(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiop(fl, lhsp, rhsp) {
|
||||
dtypeSetLogicBool(); }
|
||||
ASTNODE_NODE_FUNCS(LogIf, LOGIF)
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { V3ERROR_NA; }
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opLogIf(lhs,rhs); }
|
||||
virtual string emitVerilog() { return "%k(%l %f-> %r)"; }
|
||||
virtual string emitC() { return "VL_LOGIF_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; }
|
||||
virtual string emitSimpleOperator() { return "->"; }
|
||||
|
|
@ -3089,7 +3089,7 @@ struct AstLogIff : public AstNodeBiCom {
|
|||
AstLogIff(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : AstNodeBiCom(fl, lhsp, rhsp) {
|
||||
dtypeSetLogicBool(); }
|
||||
ASTNODE_NODE_FUNCS(LogIff, LOGIFF)
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { V3ERROR_NA; }
|
||||
virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) { out.opLogIff(lhs,rhs); }
|
||||
virtual string emitVerilog() { return "%k(%l %f<-> %r)"; }
|
||||
virtual string emitC() { return "VL_LOGIFF_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; }
|
||||
virtual string emitSimpleOperator() { return "<->"; }
|
||||
|
|
|
|||
|
|
@ -916,6 +916,18 @@ last:
|
|||
return setSingleBits(outc);
|
||||
}
|
||||
|
||||
V3Number& V3Number::opLogIf (const V3Number& lhs, const V3Number& rhs) {
|
||||
// i op j, 1 bit return, max(L(lhs),L(rhs)) calculation, careful need to
|
||||
// X/Z extend. Use opLogNot and opLogOr to do this for us.
|
||||
return opLogOr(opLogNot(lhs), rhs);
|
||||
}
|
||||
|
||||
V3Number& V3Number::opLogIff (const V3Number& lhs, const V3Number& rhs) {
|
||||
// i op j, 1 bit return, max(L(lhs),L(rhs)) calculation, careful need to
|
||||
// X/Z extend. Use opLogNot and opLogXor to do this for us.
|
||||
return opLogNot(opXor(lhs, rhs));
|
||||
}
|
||||
|
||||
V3Number& V3Number::opEq (const V3Number& lhs, const V3Number& rhs) {
|
||||
// i op j, 1 bit return, max(L(lhs),L(rhs)) calculation, careful need to X/Z extend.
|
||||
char outc = 1;
|
||||
|
|
|
|||
|
|
@ -227,6 +227,8 @@ public:
|
|||
V3Number& opLogNot (const V3Number& lhs);
|
||||
V3Number& opLogAnd (const V3Number& lhs, const V3Number& rhs);
|
||||
V3Number& opLogOr (const V3Number& lhs, const V3Number& rhs);
|
||||
V3Number& opLogIf (const V3Number& lhs, const V3Number& rhs);
|
||||
V3Number& opLogIff (const V3Number& lhs, const V3Number& rhs);
|
||||
V3Number& opAbsS (const V3Number& lhs);
|
||||
V3Number& opNegate (const V3Number& lhs);
|
||||
V3Number& opAdd (const V3Number& lhs, const V3Number& rhs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue