Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how can this code be rewrite using "assign"?

Status
Not open for further replies.

newbie_1

Member level 3
Member level 3
Joined
Sep 27, 2005
Messages
54
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,739
hi, i have a question about verilog,
how can i convert the following code using assign?

always @(*)
begin
case(d1)
2'b000: begin
do1 = 3'b101;
do2 = 3'b110;
end
2'b001: begin
do1 = 3'b101;
do2 = 3'b111;
end
2'b010: begin
....
....
2'b111: begin
do1 = 3'b001;
do2 = 3'b010;
default: begin
do1 = 3'b000;
do2 = 3'b000;
end
endcase
end


i don't wanna use the always sentence, and how can i rewrite the above code very briefly and make the code easy to be read?


thanks a lot
 

Hint: make a mux for do1 and do2.

assign do1[2:0] = (d1[2:0] == 3'b000) ? 3'b101 :
(d1[2:0] == 3'b001) ? 3'b101:
...
 

How about synthesis and convert back? Only idea, but I don't know how to implement
 

it will be very tedious if u use assign ,
try still using case statement, and add d1 to the sensitivity list,
it will be ok to be synthesized
 

    newbie_1

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top