Created
June 13, 2016 14:33
-
-
Save mkatsimpris/a985b379f1bf0b2c783e715fdafbad3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @myhdl.block | |
| def dct_2d(inputs, outputs, clock, reset, num_fractional_bits=14): | |
| first_1d_output = output_interface() | |
| first_1d = dct_1d(inputs, first_1d_output, clock, | |
| reset, num_fractional_bits) | |
| inputs_2nd_stage = [input_1d_2nd_stage(first_1d_output.out_precision) | |
| for _ in range(8)] | |
| outputs_2nd_stage = [output_interface() for _ in range(8)] | |
| stage_2_insts = [dct_1d(inputs_2nd_stage[i], outputs_2nd_stage[i], clock, reset, | |
| num_fractional_bits) for i in range(8)] | |
| @always_comb | |
| def first_stage_to_second(): | |
| if first_1d_output.data_valid: | |
| inputs_2nd_stage[0].data_in.next = first_1d_output.out0 | |
| inputs_2nd_stage[0].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[1].data_in.next = first_1d_output.out1 | |
| inputs_2nd_stage[1].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[2].data_in.next = first_1d_output.out2 | |
| inputs_2nd_stage[2].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[3].data_in.next = first_1d_output.out3 | |
| inputs_2nd_stage[3].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[4].data_in.next = first_1d_output.out4 | |
| inputs_2nd_stage[4].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[5].data_in.next = first_1d_output.out5 | |
| inputs_2nd_stage[5].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[6].data_in.next = first_1d_output.out6 | |
| inputs_2nd_stage[6].data_valid.next = first_1d_output.data_valid | |
| inputs_2nd_stage[7].data_in.next = first_1d_output.out7 | |
| inputs_2nd_stage[7].data_valid.next = first_1d_output.data_valid | |
| @always_comb | |
| def second_stage_output(): | |
| if first_1d_output.data_valid: | |
| outputs.y00.next = outputs_2nd_stage[0].out0 | |
| outputs.y01.next = outputs_2nd_stage[0].out1 | |
| outputs.y02.next = outputs_2nd_stage[0].out2 | |
| outputs.y03.next = outputs_2nd_stage[0].out3 | |
| outputs.y04.next = outputs_2nd_stage[0].out4 | |
| outputs.y05.next = outputs_2nd_stage[0].out5 | |
| outputs.y06.next = outputs_2nd_stage[0].out6 | |
| outputs.y07.next = outputs_2nd_stage[0].out7 | |
| outputs.y10.next = outputs_2nd_stage[1].out0 | |
| outputs.y11.next = outputs_2nd_stage[1].out1 | |
| outputs.y12.next = outputs_2nd_stage[1].out2 | |
| outputs.y13.next = outputs_2nd_stage[1].out3 | |
| outputs.y14.next = outputs_2nd_stage[1].out4 | |
| outputs.y15.next = outputs_2nd_stage[1].out5 | |
| outputs.y16.next = outputs_2nd_stage[1].out6 | |
| outputs.y17.next = outputs_2nd_stage[1].out7 | |
| outputs.y20.next = outputs_2nd_stage[2].out0 | |
| outputs.y21.next = outputs_2nd_stage[2].out1 | |
| outputs.y22.next = outputs_2nd_stage[2].out2 | |
| outputs.y23.next = outputs_2nd_stage[2].out3 | |
| outputs.y24.next = outputs_2nd_stage[2].out4 | |
| outputs.y25.next = outputs_2nd_stage[2].out5 | |
| outputs.y26.next = outputs_2nd_stage[2].out6 | |
| outputs.y27.next = outputs_2nd_stage[2].out7 | |
| outputs.y30.next = outputs_2nd_stage[3].out0 | |
| outputs.y31.next = outputs_2nd_stage[3].out1 | |
| outputs.y32.next = outputs_2nd_stage[3].out2 | |
| outputs.y33.next = outputs_2nd_stage[3].out3 | |
| outputs.y34.next = outputs_2nd_stage[3].out4 | |
| outputs.y35.next = outputs_2nd_stage[3].out5 | |
| outputs.y36.next = outputs_2nd_stage[3].out6 | |
| outputs.y37.next = outputs_2nd_stage[3].out7 | |
| outputs.y40.next = outputs_2nd_stage[4].out0 | |
| outputs.y41.next = outputs_2nd_stage[4].out1 | |
| outputs.y42.next = outputs_2nd_stage[4].out2 | |
| outputs.y43.next = outputs_2nd_stage[4].out3 | |
| outputs.y44.next = outputs_2nd_stage[4].out4 | |
| outputs.y45.next = outputs_2nd_stage[4].out5 | |
| outputs.y46.next = outputs_2nd_stage[4].out6 | |
| outputs.y47.next = outputs_2nd_stage[4].out7 | |
| outputs.y50.next = outputs_2nd_stage[5].out0 | |
| outputs.y51.next = outputs_2nd_stage[5].out1 | |
| outputs.y52.next = outputs_2nd_stage[5].out2 | |
| outputs.y53.next = outputs_2nd_stage[5].out3 | |
| outputs.y54.next = outputs_2nd_stage[5].out4 | |
| outputs.y55.next = outputs_2nd_stage[5].out5 | |
| outputs.y56.next = outputs_2nd_stage[5].out6 | |
| outputs.y57.next = outputs_2nd_stage[5].out7 | |
| outputs.y60.next = outputs_2nd_stage[6].out0 | |
| outputs.y61.next = outputs_2nd_stage[6].out1 | |
| outputs.y62.next = outputs_2nd_stage[6].out2 | |
| outputs.y63.next = outputs_2nd_stage[6].out3 | |
| outputs.y64.next = outputs_2nd_stage[6].out4 | |
| outputs.y65.next = outputs_2nd_stage[6].out5 | |
| outputs.y66.next = outputs_2nd_stage[6].out6 | |
| outputs.y67.next = outputs_2nd_stage[6].out7 | |
| outputs.y70.next = outputs_2nd_stage[7].out0 | |
| outputs.y71.next = outputs_2nd_stage[7].out1 | |
| outputs.y72.next = outputs_2nd_stage[7].out2 | |
| outputs.y73.next = outputs_2nd_stage[7].out3 | |
| outputs.y74.next = outputs_2nd_stage[7].out4 | |
| outputs.y75.next = outputs_2nd_stage[7].out5 | |
| outputs.y76.next = outputs_2nd_stage[7].out6 | |
| outputs.y77.next = outputs_2nd_stage[7].out7 | |
| return second_stage_output, first_stage_to_second, first_1d, stage_2_insts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment