+ reg bootstrap_enb;
+
+ wire bus = ((busaddress[15:8] == 8'h00) && bootstrap_enb) || ((busaddress[15:7] == 9'b111111111) && (busaddress != 16'hFFFF)) /* 0 or 1 depending on which bus */
+ `ifdef isim
+ || (busaddress === 16'hxxxx) /* To avoid simulator glomulation. */
+ `endif
+ ;
+
+ assign bus0address = (bus == 0) ? busaddress : 16'bzzzzzzzzzzzzzzz;
+ assign bus1address = (bus == 1) ? busaddress : 16'bzzzzzzzzzzzzzzz;
+ assign bus0data = ((bus == 0) && buswr) ? buswdata : 8'bzzzzzzzz;
+ assign bus1data = ((bus == 1) && buswr) ? buswdata : 8'bzzzzzzzz;
+ assign busdata = (bus == 0) ? bus0data : bus1data;
+ assign bus0rd = (bus == 0) ? busrd : 1'b0;
+ assign bus1rd = (bus == 1) ? busrd : 1'b0;
+ assign bus0wr = (bus == 0) ? buswr : 1'b0;
+ assign bus1wr = (bus == 1) ? buswr : 1'b0;
+
+ reg ie, iedelay;
+
+ wire [7:0] rlc,rrc,rl,rr,sla,sra,swap,srl;
+ wire [3:0] rlcf,rrcf,rlf,rrf,slaf,sraf,swapf,srlf;
+ wire [7:0] alu_res;
+ wire [3:0] f_res;
+
+ assign rlc = {tmp[6:0],tmp[7]};
+ assign rlcf = {(tmp == 0 ? 1'b1 : 1'b0)
+ ,2'b0,
+ tmp[7]};
+
+ assign rrc = {tmp[0],tmp[7:1]};
+ assign rrcf = {(tmp == 0 ? 1'b1 : 1'b0),
+ 2'b0,
+ tmp[0]};
+
+ assign rl = {tmp[6:0],`_F[4]};
+ assign rlf = {({tmp[6:0],`_F[4]} == 0 ? 1'b1 : 1'b0),
+ 2'b0,
+ tmp[7]};
+
+ assign rr = {`_F[4],tmp[7:1]};
+ assign rrf = {({tmp[4],tmp[7:1]} == 0 ? 1'b1 : 1'b0),
+ 2'b0,
+ tmp[0]};
+
+ assign sla = {tmp[6:0],1'b0};
+ assign slaf = {(tmp[6:0] == 0 ? 1'b1 : 1'b0),
+ 2'b0,
+ tmp[7]};
+
+ assign sra = {tmp[7],tmp[7:1]};
+// assign sraf = {(tmp[7:1] == 0 ? 1'b1 : 1'b0),2'b0,tmp[0]}; now in assign srlf =
+
+ assign swap = {tmp[3:0],tmp[7:4]};
+ assign swapf = {(tmp == 1'b0 ? 1'b1 : 1'b0),
+ 3'b0};
+
+ assign srl = {1'b0,tmp[7:1]};
+ assign srlf = {(tmp[7:1] == 0 ? 1'b1 : 1'b0),
+ 2'b0,
+ tmp[0]};
+ assign sraf = srlf;
+
+ /* Y U Q */
+ assign {alu_res,f_res} =
+ opcode[5] ? (
+ opcode[4] ? (
+ opcode[3] ? {srl,srlf} : {swap,swapf}
+ ) : (
+ opcode[3] ? {sra,sraf} : {sla,slaf}
+ )
+ ) : (
+ opcode[4] ? (
+ opcode[3] ? {rr,rrf} : {rl,rlf}
+ ) : (
+ opcode[3] ? {rrc,rrcf} : {rlc,rlcf}
+ )
+ );
+