From: Adam Krolnik (adamk@cyrix.com)
Date: Mon May 11 1998 - 22:43:30 PDT
Begin forwarded message:
From: Adam Krolnik <adamk@eng.cyrix.com>
Date: Fri, 13 Mar 98 16:51:35 +0600
To: btf@boyd.com
Subject: BTF - B12 - Continuous assignment case expressions
Sender: owner-btf@boyd.com
<p><p>Behavioral Task Force - Enhancement Request
Assigned Enhancement Request Number: B12
Enhancement Name (Description): Continuous assignment case expressions
Date Submitted: 970319
Requestor: adamk@cyrix.com (Adam Krolnik)
Status: RO
Is enhancement intended to be synthesizable?:
If one wants to write a case expression, they must use an always block. This
is different from the style where assign statements are used to implement
combinational logic. One may decide to use the ternary operator to express
a pseudo-case structure, but it would seem that this doesn't directly fit
the mold of synthesizable mux structures.
assign data_out = (mux_select == 0) ? mux1 :
(mux_select == 1) ? mux2 :
(mux_select == 2) ? mux3 :
mux4;
This doesn't really look like a mux - more like a priority select block. One
has to write this to have something look like a mux.
always @(mux_select or mux1 or mux2 or mux3 or mux4)
begin
case (mux_select)
2'h0 : data_out = mux1;
2'h1 : data_out = mux2;
2'h2 : data_out = mux3;
2'h3 : data_out = mux4;
endcase
end
I would like to propose that a case structure be available to an assign statement. The above logic could then be written as:
assign data_out = case(mux_select)
2'h0: mux_1;
2'h1: mux_2;
2'h2: mux_3;
2'h3: mux_4;
endcase
This case statement returns a value equal to the size of the expression
selected.
<p>Motivations:
1. Looks more like a mux structure (1 selector) than equivalent ternary operator
(possibly multiple selectors) structure.
2. Simpler than creating an always block with a mux inside.
3. Simpler mux structure; only 1 lhs per structure rather than possible multiple.
<p>Proposal:
Section 6, Syntax table 6-1 "Syntax for continuous assignment"
[Regardless of acceptance of this, I think 'net_assignment' and 'net_decl_assignment'
should be shown in this box.]
"net_decl_assignment ::= net_identifier = expression"
"net_assignment ::= net_lvalue = expression"
1. Add the BNF forms listed below to this box.
2. Add this text to the end of the first paragraph.
The second form of a continuous assignment is the continuous assignment case statement. This allows a selection of an expression to be placed on a net.
3. Insert in between sections 6.1.2 "The continuous assignment statement" and 6.1.3
"Delays", "The continuous assignment case statement" The text should be as follows.
This is a multiway decision statement that tests whether an expression matches one of a number of other expressions and selects the expression accordingly. The default shall be optional. Use of multiple default statements in one statement shall be illegal. The case expression and the case item expression can be computed at runtime; neither expression is required to be a constant. The selected expression is assigned to the net.
Assignments on the net shall be continuous and automatic just like the continuous assigment statement.
Examples:
<p>4. Move example 3 to this new section; replace the text, "assign ...;" with
assign data = case (s)
0: bus0;
1: bus1;
2: bus2;
3: bus3;
default: Zee;
endcase;
4. Replace the text of subsection "a)" with
a) The value of s, a bus selector input variable, is compared to the 5 listed cases
(0, 1, 2, 3, other) and selects one of the 5 corresponding values to be assigned
to data.
<p>new BNF:
net_decl_assignment ::=
net_identifier = expression
| net_identifier = case_statement
net_assignment ::=
net_lvalue = expression
| net_lvalue = case_statement
[NOTE: the case_statement has three forms 'case', 'casex' and 'casez' all which
are applicable for the continuous version.]
<p> Adam Krolnik
Verification Engineer
Cyrix - NSM.
Richardson TX. 75085
<p>
This archive was generated by hypermail 2.1.4
: Mon Jul 08 2002 - 12:52:52 PDT
and
sponsored by Boyd Technology, Inc.