roshan12
Junior Member level 2
- Joined
- Dec 20, 2013
- Messages
- 21
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 203
The statement seems to make no sense. What do you mean exactly with "clock unit"?.Xilinx tend to include undesirable variables in its sensitivity list. While Quartus is trying to call some clock unit on its own.
The clocks appeared because some part of your code behaved like a clock. Also remember that XILINX and altera are not set up to do asynchronous stuff very well.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 module control_unit ( rst, start, control, path, zero, inc_pc, req_pc, req_rom, req_idec, req_alu, req_reg, req_ram, req_mux, req_mar, req_r_zero, load_pc, load_acc, load_reg, load_mar, load_r_zero, rw, ack_pc, ack_rom, ack_idec, ack_alu, ack_reg, ack_ram, ack_mux, ack_mar, ack_r_zero, mux_sel ); //input [2:0] opcode; input rst,start; input [1:0] control; input path,zero; input ack_pc, ack_rom, ack_idec, ack_alu, ack_reg, ack_ram, ack_mux, ack_mar, ack_r_zero; output reg inc_pc, req_pc, req_rom, req_idec, req_alu, req_reg, req_ram, req_mux, req_mar, req_r_zero, load_pc, load_acc, load_reg, load_mar, load_r_zero, rw; output reg [2:0] mux_sel; parameter state_size=6; //_____________STATE CODES___________ parameter idle =0; parameter fet_1 =1; parameter fet_2 =2; parameter fet_3 =3; parameter idec =4; parameter alu_im =5; parameter reg2alu =6; parameter reg_1 =7; //parameter acc2reg =8; parameter alu_1 =8; parameter load_1=9; parameter load_2=10; parameter load_3=11; parameter load_4=12; parameter store_1=13; parameter store_2=14; parameter store_3=15; parameter store_4=16; parameter br_1=17; parameter brz_1=18; //_________OPCODES____________ parameter MOV = 3'b000; parameter LOAD = 3'b001; parameter STORE = 3'b010; parameter AND = 3'b011; parameter OR = 3'b100; parameter XOR = 3'b101; parameter SUB = 3'b110; parameter ADD = 3'b111; reg [state_size-1:0] state,next_state; //__________________________________________________________________________________ always @ (start or rst or posedge ack_pc or posedge ack_rom or posedge ack_idec or posedge ack_mux or posedge ack_alu or posedge ack_reg or posedge ack_ram or posedge ack_mar or posedge ack_r_zero) begin if(rst==0 && start==1) begin state<=idle; req_mux=0; req_pc=0; req_rom=0; req_idec=0; req_alu=0; req_reg=0; req_ram=0; req_mar=0; req_r_zero=0; load_pc=0; load_acc=0; load_reg=0; load_mar=0; load_r_zero=0; rw=0; end else if(start==1 && rst==1) begin state<=next_state; end else begin req_pc=0; req_rom=0; req_idec=0; req_alu=0; req_reg=0; req_ram=0; load_pc=0; load_acc=0; load_reg=0; state<=idle; end end //_______________________________________________________________________________________ //_______________________________________________________________________________________ always @ (state) begin case (state) idle: next_state=fet_1; fet_1: begin next_state=fet_2; req_mux=0; //req_pc=0; req_rom=0; req_idec=0; req_alu=0; req_reg=0; req_ram=0; req_mar=0; req_r_zero=0; load_pc=0; load_acc=0; load_reg=0; load_mar=0; load_r_zero=0; rw=0; req_pc=1; end fet_2: begin next_state=fet_3; load_pc=0; inc_pc=1; req_pc=0; req_rom=1; end fet_3: begin next_state=idec; req_rom=0; req_idec=1; end idec: begin req_idec=0; if(path) begin case(control) 2'b00: begin next_state=load_1; mux_sel=00; req_mux=1; end 2'b01: begin next_state=br_1; mux_sel=00; req_mux=1; end 2'b10: begin next_state=brz_1; load_r_zero=1; req_r_zero=1; end 2'b11: begin next_state=store_1; mux_sel=00; req_mux=1; end default: req_mux=0; endcase end else begin case(control) 2'b00: begin mux_sel=00; next_state=alu_im; req_mux=1; end 2'b01: begin mux_sel=10; next_state=reg2alu; req_idec=0; req_reg=1; end 2'b10: begin mux_sel=00; next_state=reg_1; req_mux=1; end 2'b11: begin mux_sel=01; next_state=reg_1; req_mux=1; end default:begin req_mux=0; end endcase end end alu_im: begin next_state=fet_1; load_acc=1; req_mux=0; req_alu=1; end reg2alu: begin next_state=alu_1; req_reg=0; req_mux=1; end reg_1: begin next_state=fet_1; load_reg=1; req_mux=0; req_reg=1; end alu_1: begin next_state=fet_1; load_acc=1; req_mux=0; req_alu=1; end load_1:begin next_state=load_2; req_mux=0; load_mar=1; req_mar=1; end load_2:begin next_state=load_3; req_mar=0; rw=0; req_ram=1; end load_3:begin next_state=load_4; req_ram=0; mux_sel=11; req_mux=1; end load_4:begin next_state=fet_1; req_mux=0; load_reg=1; req_reg=1; end store_1:begin next_state=store_2; req_mux=0; load_mar=1; req_mar=1; end store_2:begin next_state=store_3; req_mar=0; req_reg=1; end store_3:begin next_state=store_4; req_reg=0; mux_sel=10; req_mux=1; end store_4:begin next_state=fet_1; req_mux=0; rw=1; req_ram=1; end br_1:begin next_state=fet_2; req_mux=0; inc_pc=0; load_pc=1; req_pc=1; end brz_1:begin req_r_zero=0; load_r_zero=0; if(zero) begin next_state=br_1; mux_sel=00; req_mux=1; end else begin next_state=fet_1; req_mux=1; end end default: begin req_mux=0; end endcase end endmodule
posedge ack_pc or
posedge ack_rom or
posedge ack_idec or
posedge ack_mux or
posedge ack_alu or
posedge ack_reg or
posedge ack_ram or
posedge ack_mar or
posedge ack_r_zero
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?