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.

Error in designing a 5bit binary to thermometer decoder in Verilog

Status
Not open for further replies.

sal_

Newbie level 2
Joined
Feb 4, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,308
a net is not a legal lvalue in this context

Hi guys, would be very appreciative of any help anyone can give. I'm trying to design a 5bit binary to thermometer decoder for use in a 10bit segmented current DAC.

//Verilog HDL for "lablib", "ee435" "behavioral"

module ee435 (bin, thermometer);

input [4:0] bin;
reg [4:0] breg;

always @ (bin)
begin
breg = bin;
case (breg)

5'b00000: thermometer = 31'b0000000000000000000000000000000;
5'b00001: thermometer = 31'b0000000000000000000000000000001;
5'b00010: thermometer = 31'b0000000000000000000000000000011;
5'b00011: thermometer = 31'b0000000000000000000000000000111;
5'b00100: thermometer = 31'b0000000000000000000000000001111;
5'b00101: thermometer = 31'b0000000000000000000000000011111;
5'b00110: thermometer = 31'b0000000000000000000000000111111;
5'b00111: thermometer = 31'b0000000000000000000000001111111;
5'b01000: thermometer = 31'b0000000000000000000000011111111;
5'b01001: thermometer = 31'b0000000000000000000000111111111;
5'b01010: thermometer = 31'b0000000000000000000001111111111;
5'b01011: thermometer = 31'b0000000000000000000011111111111;
5'b01100: thermometer = 31'b0000000000000000000111111111111;
5'b01101: thermometer = 31'b0000000000000000001111111111111;
5'b01110: thermometer = 31'b0000000000000000011111111111111;
5'b01111: thermometer = 31'b0000000000000000111111111111111;
5'b10000: thermometer = 31'b0000000000000001111111111111111;
5'b10001: thermometer = 31'b0000000000000011111111111111111;
5'b10010: thermometer = 31'b0000000000000111111111111111111;
5'b10011: thermometer = 31'b0000000000001111111111111111111;
5'b10100: thermometer = 31'b0000000000011111111111111111111;
5'b10101: thermometer = 31'b0000000000111111111111111111111;
5'b10110: thermometer = 31'b0000000001111111111111111111111;
5'b10111: thermometer = 31'b0000000011111111111111111111111;
5'b11000: thermometer = 31'b0000000111111111111111111111111;
5'b11001: thermometer = 31'b0000001111111111111111111111111;
5'b11010: thermometer = 31'b0000011111111111111111111111111;
5'b11011: thermometer = 31'b0000111111111111111111111111111;
5'b11100: thermometer = 31'b0001111111111111111111111111111;
5'b11101: thermometer = 31'b0011111111111111111111111111111;
5'b11110: thermometer = 31'b0111111111111111111111111111111;
5'b11111: thermometer = 31'b1111111111111111111111111111111;

endcase
end
endmodule

The error that appears when im trying to parse is:

ncvlog: *E,WANOTL (/home/lablib/ee435/behavioral/verilog.v, 16|20): a net is not a legal lvalue in this context [9. 3. 1. (IEEE) ]. 5'b00001: thermometer = 31'b0000.....;

for all my case statements. I'm pretty new to verilog so i expect it's something basic, cheers guys!
 

wanotl

output[30:0] thermometer;
reg[30:0] thermometer;

The above statements are missing, if you don't declare thermometer o/p, it will treated as wire which is not you wanted by looking at your code.
 

    sal_

    Points: 2
    Helpful Answer Positive Rating
e,wanotl

thermometer should declare as "reg"
 

binary to termometer decoder

thanks guys, worked a treat!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top