How to add the reset signal to the sensitivity list in the generated Verilog code when writing a Chisel code, for example the code below for D flip flop:
val x = Reg(init = UInt(0, width = 1))
x := io.D
io.Q := x
will generate a Verilog code as this:
always @(posedge clk) begin
if(reset) begin
x <= 1'h0;
end else begin
x <= io_D;
end
end
as seen the reset is synchronous with the clock, how to code Chisel to generate something like this:
always @(posedge clk or posedge reset) begin
if(reset) begin
x <= 1'h0;
end else begin
x <= io_D;
end
end
where the reset signal is in the sensitivity list and hence asynchronous.
Edit: As pointed by chrisvp there is another question here and a discussion in chisel-users google group here