Connecting simple port of struct to a systemC instance - specman

I'm interested in writing a simple port of struct to a systemC class instance. Do I have to mark the e struct fields of intetest with physical fields(%)?

No. You can use the new feature that converts e struct to c and vice versa.
When defining a port, use the
simple port of struct .. is instance

Related

Can nettype be used to define struct in System Verilog?

Can nettype be used to define struct in SystemVerilog language?
I am getting failure in defining so, can anybody tell me?
A nettype cannot be used as a member of a struct. Only other data types can be used as struct members. A nettype is a kind of signal that can have a data type, including a struct, but a nettype itself is not a data type.

Swift: How to conform to protocol with associated types if I have two types to associate?

OK weird question perhaps, and it's only because I don't really know what I'm asking for so I'll try to describe it best I can. Please direct me appropriately if this has been asked before.
So I'm using the awesome Codable protocol with pretty much all my models and I'm making a class that handles some storing, let's call it Storage<Model: Codable> which has a generic type conforming to Codable because one instance of this class will handle storage for one type of model.
Now I need to be notified when things change in the Storage instance, like stuff getting written to disk and deletions. So I make a new protocol StorageListener that declares functions like func storage(_ storage: Storage<CodableType>, didRemoveModelForKey key: String). Now since this uses the Storage type which requires use of a generic Model an associated type must be declared: associatedtype CodableType: Codable.
So I now use type erasure to make an AnyStorageListener<AnyCodableType: Codable>: StorageListener, that I can store in an array in my Storage class.
Now this is fine, I can just conform my ViewModel or whatever to StorageListener and declare the typealias CodableType = MyModel but what if I need my ViewModel to listen to two Storages of different types?
What I've come up with is using listener container objects that I can initialize with closures to the protocol functions and thus work around the problem. That should work but I was wondering if there's a cleaner solution? Perhaps some way to type erasure away the generic requirement altogether?

Does E language support multiple inheritance?

I would like to build a new struct that inherits from other multiple structs, something like that:
struct new_struct like struct_a, struct_b, struct_c is {
// The new_struct supposed to have all the fields of struct a/b/c
};
Is there a way to inherit from multiple structs in E?
Thank you for your help
No, there is no multiple inheritance in e. However, not long ago interfaces were added, this is probably the closest thing.
What is exactly your purpose? In some cases 'struct_member' macro or when subtype can do a job expected from multiple inheritance.

What are struct “wrapper types”?

In the Swift.org migration guide under the SDK section reference is made to struct “wrapper types”, I have a number of questions related to them.
In Swift 3, many of Foundation’s “stringly-typed” APIs have been
changed to use struct “wrapper types”, such as the new
Notification.Name type. Since, it’s common for notification names and
other string constants to be declared globally or as static members,
the best way to take advantage of these new types is usually to
construct the wrapper at the point of declaration:
What are these, are they a wrapper function? As described by wikipedia or are they an implementation of the Adapter Pattern
What are the benefits of using a struct “wrapper type”?

what is difference between cdev_alloc and cdev_init

I'm creating a character device. I found two way to initialize char device
cdev_alloc
and
cdev_init
According to book, if i'm embedding struct cdev in my device struct then i should use cdev_init
Can any one tell me that what are difference between them?
you can use either:
struct cdev my_cdev;
in this case you don't need to call cdev_alloc because memory is already allocated. Instead you must call cdev_init(&my_cdev, &fops).
and then my_cdev.owner = THIS_MODULE;
OR
you can use:
struct cdev *my_cdev_p;
in this case you must call cdev_alloc() to allocate memory.
Then, you have to initialize my_cdev_p->ops=&fops; and my_cdev_p->owner = THIS_MODULE;. Never use cdev_init() in this case!
Note that the 2 above methods don't belong to the old mechanism.
According to linux device drivers 3rd edition .
cdev_alloc() is a older mechanism .this is used for getting cdev structure at runtime of your character driver module .then you have to manually assign operation to ops variable to cdev structure .However cdev_init is the new mechanism in this we have to pass cdev structure variable (or already initialized cdev structure pointer) and file operation variable,for information go here
http://lwn.net/Kernel/LDD3/
chapter 3
According to LDD3 for using cdev_init cdev should be initialized and shouldn't be NULL, so either use struct cdev dev as suggested by kripanand or if using struct cdev *dev then allocate dev memory using kzalloc, if using kmalloc memset would be required. This is wat cdev_alloc does.
I've now replaced cdev_alloc in my code as
//vcar->dev=cdev_alloc;
vcar->dev=kzalloc(sizeof(struct cdev),GFP_KERNEL);