What do lines do 39/40/41 correspond to?
What does "when (tag_read)" mean? Shouldn't you be using a Bool() inside the when statement and not a object?
What is "line_no"? (sequential reads are performed by registering the address).
What are you trying to accomplish with tag_read = Reg(TagType())... [edited] you're creating a register of type TagType, not a node with values associated with it. Thus I suspect the error is that there is no default/initial value for that register if "tag_read_cond" is not true. Using Reg(init=something) will probably fix the error [end edits].
I'd probably lose the object TagType code. I'm not sure what you're trying to do with it. This code will declare a tagType and give it a set of default values:
val tag_read = new TagType()
tag_read.valid := Bool(false)
tag_read.dirty := Bool(false)
tag_read.tag := UInt(0)
val tag_ram = Mem(new TagType(), num_lines , seqRead = false )
when (tag_read_cond) {
tag_read := tag_ram(line_no)
}
Chisel gets angry if your variables do not have default values (i.e., there is a path through your logic in which a variable will not get set, since Chisel does not support X's/don't cares).
Although you can ditch most of that code and probably just write this if you don't mind the extra port:
val tag_ram = Mem(new TagType(), num_lines , seqRead = false )
val tag_read = tag_ram(line_no)
And for sequential memories:
val tag_ram = Mem(new TagType(), num_lines , seqRead = true )
val tag_read = tag_ram(RegEnable(line_no, tag_read_cond))
Note the address is registered, with an enable condition that can tell the memory only to read it when evaluated to true. The Chisel manual gives more examples/explanations on constructing sequential memories.