mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +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
|
||||
node.body.vhd = node.orelse.vhd = node.vhd
|
||||
self.write('tern_op(')
|
||||
self.visit(node.body)
|
||||
self.write(', cond => ')
|
||||
self.write('cond => ')
|
||||
self.visit(node.test)
|
||||
self.write(', if_true => ')
|
||||
self.visit(node.body)
|
||||
self.write(', if_false => ')
|
||||
self.visit(node.orelse)
|
||||
self.write(')')
|
||||
|
@ -58,11 +58,11 @@ package pck_myhdl_%(version)s is
|
||||
|
||||
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;
|
||||
|
||||
@ -163,7 +163,7 @@ package body pck_myhdl_%(version)s is
|
||||
return - signed(resize(arg, arg'length+1));
|
||||
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
|
||||
if cond then
|
||||
return if_true;
|
||||
@ -172,7 +172,7 @@ package body pck_myhdl_%(version)s is
|
||||
end if;
|
||||
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
|
||||
if cond then
|
||||
return if_true;
|
||||
@ -181,7 +181,7 @@ package body pck_myhdl_%(version)s is
|
||||
end if;
|
||||
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
|
||||
if cond then
|
||||
return if_true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user