source: caseStudy_Huffmann/huffmann/huff_with_env/environment2.v

Last change on this file was 105, checked in by cecile, 12 years ago

Hufmann case study

File size: 420 bytes
Line 
1module environment(clk,val,i_addr,i_val,addr,ack);
2  input clk;
3  input i_val;
4  input [4:0]i_addr;
5  output [4:0] addr;
6  output val;
7  reg val;
8  reg r_val;
9  input ack;
10
11  reg addr;
12  initial addr = 0;
13  initial  val = 1;
14  initial  r_val = 1;
15  always @(posedge clk) begin
16    val = 0;
17    if(ack == 1)
18    begin
19      val = (r_val == 1)?0:i_val;
20      addr = i_addr;
21    end
22    r_val = i_val;
23  end
24 
25
26endmodule
27
Note: See TracBrowser for help on using the repository browser.