Last active
August 29, 2015 14:18
-
-
Save cfelton/bb4e0850c5245a1ef960 to your computer and use it in GitHub Desktop.
Example of an interface property conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from myhdl import * | |
class Intf(object): | |
def __init__(self): | |
self.a = Signal(intbv(0)[8:]) | |
self.b = Signal(intbv(0)[8:]) | |
self._x = Signal(intbv(0)[8:]) | |
@property | |
def c(self): | |
return self._x | |
def m_propattr(intf1, intf2): | |
@always_comb | |
def rtl(): | |
intf1.a.next = intf2.c | |
return rtl | |
intf1 = Intf() | |
intf2 = Intf() | |
toVerilog(m_propattr, intf1, intf2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: m_propattr.v | |
// Generated by MyHDL 0.9.dev0 | |
// Date: Sat Apr 4 09:51:24 2015 | |
`timescale 1ns/10ps | |
module m_propattr ( | |
intf1_a, | |
intf1_b, | |
intf1__x, | |
intf2_a, | |
intf2_b, | |
intf2_c | |
); | |
output [7:0] intf1_a; | |
wire [7:0] intf1_a; | |
input [7:0] intf1_b; | |
input [7:0] intf1__x; | |
input [7:0] intf2_a; | |
input [7:0] intf2_b; | |
input [7:0] intf2_c; | |
assign intf1_a = intf2_c; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment