Created
February 25, 2016 15:13
-
-
Save cfelton/81c680347dc6b2d5a458 to your computer and use it in GitHub Desktop.
The following demonstrates a top-level interface conversion issue.
This file contains 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
import myhdl | |
from myhdl import Signal, intbv, always_comb | |
class Intf1(object): | |
def __init__(self): | |
self.a = Signal(intbv(0, min=0, max=2)) | |
self.b = Signal(intbv(0, min=0, max=4)) | |
self.c = Signal(intbv(0, min=0, max=8)) | |
class Intf2(object): | |
def __init__(self): | |
self.b = Signal(intbv(0, min=0, max=4)) | |
self.c = Signal(intbv(0, min=0, max=8)) | |
def assign(a, b): | |
@always_comb | |
def beh_assign(): | |
b.next = a | |
return beh_assign | |
def top_level_assign(intf_in, intf_out): | |
m1 = assign(intf_in.b, intf_out.b) | |
m2 = assign(intf_in.c, intf_out.c) | |
return m1, m2 | |
def convert(): | |
if1, if2 = Intf1(), Intf2() | |
myhdl.toVerilog(top_level_assign, if1, if2) | |
if __name__ == '__main__': | |
convert() |
This file contains 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: top_level_assign.v | |
// Generated by MyHDL 1.0dev | |
// Date: Thu Feb 25 09:06:48 2016 | |
`timescale 1ns/10ps | |
module top_level_assign ( | |
b, | |
b, | |
a, | |
a, | |
intf_in_a | |
); | |
output [2:0] b; | |
wire [2:0] b; | |
output [2:0] b; | |
wire [2:0] b; | |
input [2:0] a; | |
input [2:0] a; | |
input [0:0] intf_in_a; | |
assign b = a; | |
assign b = a; | |
endmodule |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment