mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
Improve term_op signature #107
This commit is contained in:
parent
cf3f1af80c
commit
9ce3a25fa2
@ -1106,9 +1106,10 @@ class _ConvertVisitor(ast.NodeVisitor, _ConversionMixin):
|
|||||||
# propagate the node's vhd attribute
|
# propagate the node's vhd attribute
|
||||||
node.body.vhd = node.orelse.vhd = node.vhd
|
node.body.vhd = node.orelse.vhd = node.vhd
|
||||||
self.write('tern_op(')
|
self.write('tern_op(')
|
||||||
self.visit(node.body)
|
self.write('cond => ')
|
||||||
self.write(', cond => ')
|
|
||||||
self.visit(node.test)
|
self.visit(node.test)
|
||||||
|
self.write(', if_true => ')
|
||||||
|
self.visit(node.body)
|
||||||
self.write(', if_false => ')
|
self.write(', if_false => ')
|
||||||
self.visit(node.orelse)
|
self.visit(node.orelse)
|
||||||
self.write(')')
|
self.write(')')
|
||||||
|
@ -58,11 +58,11 @@ package pck_myhdl_%(version)s is
|
|||||||
|
|
||||||
function "-" (arg: unsigned) return signed;
|
function "-" (arg: unsigned) return signed;
|
||||||
|
|
||||||
function tern_op(if_true: std_logic; cond: boolean; if_false: std_logic) return std_logic;
|
function tern_op(cond: boolean; if_true: std_logic; if_false: std_logic) return std_logic;
|
||||||
|
|
||||||
function tern_op(if_true: unsigned; cond: boolean; if_false: unsigned) return unsigned;
|
function tern_op(cond: boolean; if_true: unsigned; if_false: unsigned) return unsigned;
|
||||||
|
|
||||||
function tern_op(if_true: signed; cond: boolean; if_false: signed) return signed;
|
function tern_op(cond: boolean; if_true: signed; if_false: signed) return signed;
|
||||||
|
|
||||||
end pck_myhdl_%(version)s;
|
end pck_myhdl_%(version)s;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ package body pck_myhdl_%(version)s is
|
|||||||
return - signed(resize(arg, arg'length+1));
|
return - signed(resize(arg, arg'length+1));
|
||||||
end function "-";
|
end function "-";
|
||||||
|
|
||||||
function tern_op(if_true: std_logic; cond: boolean; if_false: std_logic) return std_logic is
|
function tern_op(cond: boolean; if_true: std_logic; if_false: std_logic) return std_logic is
|
||||||
begin
|
begin
|
||||||
if cond then
|
if cond then
|
||||||
return if_true;
|
return if_true;
|
||||||
@ -172,7 +172,7 @@ package body pck_myhdl_%(version)s is
|
|||||||
end if;
|
end if;
|
||||||
end function tern_op;
|
end function tern_op;
|
||||||
|
|
||||||
function tern_op(if_true: unsigned; cond: boolean; if_false: unsigned) return unsigned is
|
function tern_op(cond: boolean; if_true: unsigned; if_false: unsigned) return unsigned is
|
||||||
begin
|
begin
|
||||||
if cond then
|
if cond then
|
||||||
return if_true;
|
return if_true;
|
||||||
@ -181,7 +181,7 @@ package body pck_myhdl_%(version)s is
|
|||||||
end if;
|
end if;
|
||||||
end function tern_op;
|
end function tern_op;
|
||||||
|
|
||||||
function tern_op(if_true: signed; cond: boolean; if_false: signed) return signed is
|
function tern_op(cond: boolean; if_true: signed; if_false: signed) return signed is
|
||||||
begin
|
begin
|
||||||
if cond then
|
if cond then
|
||||||
return if_true;
|
return if_true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user