 |
|
|
|
|
|
|
|
|
|
|
|
|
SVUG Community Forum
|
|
| Author |
Messages |
|
Meng-Yuan
Posts:5
 |
| 07/31/2010 2:18 AM |
|
| I want to suggest a feature for the future release of SystemVerilog, however, I don't know where I can propose the feature. I post the feature here. If this post made someone unhappy, please excuse me.
The feature is that: is it possible for SystemVerilog supports "Module Inheritance" ability?
If SystemVerilog supports Module Inheritance,
we maybe able to reuse the module.
For example, the following is a pseudo SystemVerilog code:
---------------------------------
module Cat;
enum logic Ώ:0] {grey, orange} color;
endmodule
module Tom (output finish, input mouse) extends Cat;
// See http://en.wikipedia.org/wiki/Tom_and_Jerry
assign color = gery;
EatMouse eatMouse(finish, mouse);
endmodule
module Garfield extends Cat;
// See http://en.wikipedia.org/wiki/Garfield
assign color = orange;
endmodule
---------------------------------
Tom and Garfield modules reuse Cat module.
These reuses are meaningful, because
Garfield doesn't eat mouse.
Without Module Inhertanince ability, we have to
combine all codes into a module and use "Generate If" to make a decision of the kind of a cat. On the other word, we might only write:
---------------------------------
module Cat(output finish, input mouse);
parameter kind;
enum logic Ώ:0] {grey, orange} color;
if(kind == 0) begin // Tom.
assign color = gery;
EatMouse eatMouse(finish, mouse);
end
else begin // Garfield.
assign color = orange;
end
endmodule
---------------------------------
This code is quiet ugly compared with the "Module Inheritance" one and very difficult to maintain. And the IO ports "finish" and "mouse" is meaningless for Garfield.
Is it possible for "OOP for module"? |
|
|
|
|
Meng-Yuan
Posts:5
 |
| 07/31/2010 2:22 AM |
|
| I' sorry. I don't know why the newline characters are dropped in my post. |
|
|
|
|
Meng-Yuan
Posts:5
 |
| 07/31/2010 2:30 AM |
|
I want to suggest a feature for the future release of SystemVerilog, however, I don't know where I can propose the feature.
I post the feature here. If this post made someone unhappy, please excuse me.
The feature is that: is it possible for SystemVerilog supports "Module Inheritance" ability?
If SystemVerilog supports Module Inheritance, we maybe able to reuse the module.
For example, the following is a pseudo SystemVerilog code:
---------------------------------
module Cat;
enum logic [ 1:0] {grey, orange} color;
endmodule
module Tom (output finish, input mouse) extends Cat;
// See http://en.wikipedia.org/wiki/Tom_and_Jerry
assign color = gery;
EatMouse eatMouse(finish, mouse);
endmodule
module Garfield extends Cat;
// See http://en.wikipedia.org/wiki/Garfield
assign color = orange;
endmodule
---------------------------------
Tom and Garfield modules reuse Cat module. These reuses are meaningful, because Garfield doesn't eat mouse.
Without Module Inhertanince ability, we have to combine all codes into a module and use "Generate If" to make a decision of the kind of a cat.
On the other word, we might only write:
---------------------------------
module Cat(output finish, input mouse);
parameter kind;
enum logic [ 1:0] {grey, orange} color;
if(kind == 0) begin // Tom.
assign color = gery;
EatMouse eatMouse(finish, mouse);
end
else begin // Garfield.
assign color = orange;
end endmodule
---------------------------------
This code is quiet ugly compared with the "Module Inheritance" one and very difficult to maintain.
And the IO ports "finish" and "mouse" is meaningless for Garfield.
Is it possible for "OOP for module"?
|
|
|
|
|
Meng-Yuan
Posts:5
 |
| 07/31/2010 2:32 AM |
|
| I post the article again after fixing the newline character problem. |
|
|
|
|
SHALOM
Posts:47
 |
| 08/01/2010 5:49 AM |
|
This is under work for the next version of the Standard. See http://www.eda-stds.org/mantis/view.php?id=1356 and http://www.eda-stds.org/mantis/view.php?id=2997. Shalom |
|
|
|
|
Meng-Yuan
Posts:5
 |
| 08/01/2010 6:00 AM |
|
Hello, Shalom:
Thank you for your reply.
However, what feature I propose is "Module Inheritance" instead of "Multiple Inheritance."
"Multiple Inheritance" is used for "class,"
but "Module Inheritance" is used for "module (or interface)."
|
|
|
|
|
SHALOM
Posts:47
 |
| 08/01/2010 6:02 AM |
|
Oops. Sorry for not reading carefully. Shalom |
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
ActiveForums 3.7
|
|
|

|
|
|
|
|
|
|
|
|
|
 |
|